jenkins-docs/simple-java-maven-app

Error: Unable to access jarfile target/my-app

saami97 opened this issue · 2 comments

image

image

`+ ./jenkins/scripts/deliver.sh
The following Maven command installs your Maven-built Java application
into the local Maven repository, which will ultimately be stored in
Jenkinss local Maven repository (and the "maven-repository" Docker data
volume).

  • mvn jar:jar install:install help:evaluate -Dexpression=project.name
    [�[1;34mINFO�[m] Scanning for projects...
    [�[1;34mINFO�[m]
    [�[1;34mINFO�[m] �[1m----------------------< �[0;36mcom.mycompany.app:my-app�[0;1m >----------------------�[m
    [�[1;34mINFO�[m] �[1mBuilding my-app 1.0-SNAPSHOT�[m
    [�[1;34mINFO�[m] �[1m--------------------------------[ jar ]---------------------------------�[m
    [�[1;34mINFO�[m]
    [�[1;34mINFO�[m] �[1m--- �[0;32mmaven-jar-plugin:3.3.0:jar�[m �[1m(default-cli)�[m @ �[36mmy-app�[0;1m ---�[m
    [�[1;34mINFO�[m]
    [�[1;34mINFO�[m] �[1m--- �[0;32mmaven-install-plugin:2.4:install�[m �[1m(default-cli)�[m @ �[36mmy-app�[0;1m ---�[m
    [�[1;34mINFO�[m] Installing /var/jenkins_home/workspace/Github Pipeline/target/my-app-1.0-SNAPSHOT.jar to /var/jenkins_home/.m2/repository/com/mycompany/app/my-app/1.0-SNAPSHOT/my-app-1.0-SNAPSHOT.jar
    [�[1;34mINFO�[m] Installing /var/jenkins_home/workspace/Github Pipeline/pom.xml to /var/jenkins_home/.m2/repository/com/mycompany/app/my-app/1.0-SNAPSHOT/my-app-1.0-SNAPSHOT.pom
    [�[1;34mINFO�[m]
    [�[1;34mINFO�[m] �[1m----------------------< �[0;36mcom.mycompany.app:my-app�[0;1m >----------------------�[m
    [�[1;34mINFO�[m] �[1mBuilding my-app 1.0-SNAPSHOT�[m
    [�[1;34mINFO�[m] �[1m--------------------------------[ jar ]---------------------------------�[m
    [�[1;34mINFO�[m]
    [�[1;34mINFO�[m] �[1m--- �[0;32mmaven-help-plugin:3.4.0:evaluate�[m �[1m(default-cli)�[m @ �[36mmy-app�[0;1m ---�[m
    [�[1;34mINFO�[m] No artifact parameter specified, using 'com.mycompany.app:my-app:jar:1.0-SNAPSHOT' as project.
    [�[1;34mINFO�[m]
    my-app
    [�[1;34mINFO�[m] �[1m------------------------------------------------------------------------�[m
    [�[1;34mINFO�[m] �[1;32mBUILD SUCCESS�[m
    [�[1;34mINFO�[m] �[1m------------------------------------------------------------------------�[m
    [�[1;34mINFO�[m] Total time: 2.177 s
    [�[1;34mINFO�[m] Finished at: 2023-12-31T16:25:52Z
    [�[1;34mINFO�[m] �[1m------------------------------------------------------------------------�[m
    �[0m�[0m+ set +x
    The following complex command extracts the value of the element
    within of your Java/Maven projects "pom.xml" file.
    ++ mvn help:evaluate -Dexpression=project.name
    ++ grep '^[^\[]'
    �[0m+ NAME='my-app
    �[0m'
  • set +x
    The following complex command behaves similarly to the previous one but
    extracts the value of the element within instead.
    ++ mvn help:evaluate -Dexpression=project.version
    ++ grep '^[^\[]'
    �[0m+ VERSION='1.0-SNAPSHOT
    �[0m'
  • set +x
    The following command runs and outputs the execution of your Java
    application (which Jenkins built using Maven) to the Jenkins UI.
  • java -jar target/my-app '�[0m-1.0-SNAPSHOT' '�[0m.jar'
    Error: Unable to access jarfile target/my-app`

This will be resolved once #786 will be reviewed and merged to master.

I am new to Jenkins and doing a Jenkins tutorial and this is still an issue for me, the regex is not getting formed correctly at the last step of delivery, can you help me resolve this? Are there any changes to be done?
The following command extracts the value of the element
within of your Java/Maven projects "pom.xml" file.
++ mvn -q -DforceStdout help:evaluate -Dexpression=project.name
�[0m+ NAME='my-app�[0m'

  • set +x
    The following command behaves similarly to the previous one but
    extracts the value of the element within instead.
    ++ mvn -q -DforceStdout help:evaluate -Dexpression=project.version
    �[0m+ VERSION='1.0-SNAPSHOT�[0m'
  • set +x
    The following command runs and outputs the execution of your Java
    application (which Jenkins built using Maven) to the Jenkins UI.
  • java -jar 'target/my-app�[0m-1.0-SNAPSHOT�[0m.jar'
    Error: Unable to access jarfile target/my-app�[0m-1.0-SNAPSHOT�[0m.jar