mvn not found on $JENKINS_HOME/workspace/<projectname>@tmp

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
BTH
Reply | Threaded
Open this post in threaded view
|

mvn not found on $JENKINS_HOME/workspace/<projectname>@tmp

BTH
I've locally installed maven on both Master and Slave
and correctly set path for both JAVA_HOME and M2

jenkins@jenkins-slave-02:~$ echo $M2_HOME
/opt/maven
jenkins@jenkins-slave-02:~$ echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-amd64


Once reach the stage involved mvn command, the error occurs
/jenkins/workspace/simple_any_tests_master@tmp/durable-c32a56b1/script.sh: 1: mvn: not found

I notice that this @tmp dir was empty which means no pom.xml and when looking closely by reproduce the mvn compile in @tmp dir

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.117 s
[INFO] Finished at: 2021-03-24T12:09:50+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException


I'm not sure what is the root cause of this error whereas incorrect maven path or slave setting (permission, etc.)

Any helps would be appreciated
Cheers

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAEaEQi%2BT7ggJQPR438rjgDG1BoWtWfhH_awu3mWZcXe82BTeGA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: mvn not found on $JENKINS_HOME/workspace/<projectname>@tmp

Mallarapu Ananth
Hi , 

Have tried to print the M2_HOME and JAVA_HOME in the pipeline you are trying to build . if they are empty it might be getting overwritten . try to put then as environment variables in jenkins config . 

On Wednesday, March 24, 2021 at 4:53:13 PM UTC+5:30 [hidden email] wrote:
I've locally installed maven on both Master and Slave
and correctly set path for both JAVA_HOME and M2

jenkins@jenkins-slave-02:~$ echo $M2_HOME
/opt/maven
jenkins@jenkins-slave-02:~$ echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-amd64


Once reach the stage involved mvn command, the error occurs
/jenkins/workspace/simple_any_tests_master@tmp/durable-c32a56b1/script.sh: 1: mvn: not found

I notice that this @tmp dir was empty which means no pom.xml and when looking closely by reproduce the mvn compile in @tmp dir

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.117 s
[INFO] Finished at: 2021-03-24T12:09:50+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException


I'm not sure what is the root cause of this error whereas incorrect maven path or slave setting (permission, etc.)

Any helps would be appreciated
Cheers

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/efd1fb38-db5e-45dc-8ea6-437f9668c417n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: mvn not found on $JENKINS_HOME/workspace/<projectname>@tmp

John Patrick
Personally I would switch to using maven wrapper as it have saved me
from a lot of issues like this.

But to your errors;

From your first error, check if mvn is on the path, so I would expect
to see "/opt/maven/bin" within the PATH assuming "/opt/maven" is where
maven is installed. Doesn't matter what M2_HOME or JAVA_HOME are until
mvn is on the path.

The second error implies you've not told maven what to do, as that
looks like a maven output. So it has managed to do "mvn" without any
arguments, so you need to do "mvn clean install" or "mvn verify".

For the existing Wrapper see https://github.com/takari/maven-wrapper
From the next Maven release see this wrapper
https://maven.apache.org/plugins/maven-wrapper-plugin/index.html

John

On Wed, 24 Mar 2021 at 12:00, Mallarapu Ananth
<[hidden email]> wrote:

>
> Hi ,
>
> Have tried to print the M2_HOME and JAVA_HOME in the pipeline you are trying to build . if they are empty it might be getting overwritten . try to put then as environment variables in jenkins config .
>
> On Wednesday, March 24, 2021 at 4:53:13 PM UTC+5:30 [hidden email] wrote:
>>
>> I've locally installed maven on both Master and Slave
>> and correctly set path for both JAVA_HOME and M2
>>
>> jenkins@jenkins-slave-02:~$ echo $M2_HOME
>> /opt/maven
>> jenkins@jenkins-slave-02:~$ echo $JAVA_HOME
>> /usr/lib/jvm/java-1.8.0-openjdk-amd64
>>
>> Once reach the stage involved mvn command, the error occurs
>>
>> /jenkins/workspace/simple_any_tests_master@tmp/durable-c32a56b1/script.sh: 1: mvn: not found
>>
>>
>> I notice that this @tmp dir was empty which means no pom.xml and when looking closely by reproduce the mvn compile in @tmp dir
>>
>> [INFO] Scanning for projects...
>> [INFO] ------------------------------------------------------------------------
>> [INFO] BUILD FAILURE
>> [INFO] ------------------------------------------------------------------------
>> [INFO] Total time:  0.117 s
>> [INFO] Finished at: 2021-03-24T12:09:50+01:00
>> [INFO] ------------------------------------------------------------------------
>> [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
>> [ERROR]
>> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
>> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
>> [ERROR]
>> [ERROR] For more information about the errors and possible solutions, please read the following articles:
>> [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException
>>
>> I'm not sure what is the root cause of this error whereas incorrect maven path or slave setting (permission, etc.)
>>
>> Any helps would be appreciated
>> Cheers
>
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/efd1fb38-db5e-45dc-8ea6-437f9668c417n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAH9u10%3D8oFGxqJ9-0HKHVrEi9PmZ6X9UotQ7LiF9VH21Y%2BtMqA%40mail.gmail.com.
BTH
Reply | Threaded
Open this post in threaded view
|

Re: mvn not found on $JENKINS_HOME/workspace/<projectname>@tmp

BTH
Hi :)

From the previous email, I asked for help about my Jenkins Slave unable to run mvn

I'd like to share what I've founded and the solution for the problem. 
I basically set the PATH for M2_HOME and MAVEN_HOME at /etc/profile which is somehow not work with the system's permission

So, I changed to set M2_HOME and MAVEN_HOME at /etc/environment instead and then the problem was gone :D
It's not Jenkins issue not even relate LOL but it's Linux 101

Anyway, amy thanks for Mallarapu Ananth and John for the suggestion. It was helpful

Cheers

ในวันที่ พฤ. 25 มี.ค. 2021 เวลา 00:51 John Patrick <[hidden email]> เขียนว่า:
Personally I would switch to using maven wrapper as it have saved me
from a lot of issues like this.

But to your errors;

From your first error, check if mvn is on the path, so I would expect
to see "/opt/maven/bin" within the PATH assuming "/opt/maven" is where
maven is installed. Doesn't matter what M2_HOME or JAVA_HOME are until
mvn is on the path.

The second error implies you've not told maven what to do, as that
looks like a maven output. So it has managed to do "mvn" without any
arguments, so you need to do "mvn clean install" or "mvn verify".

For the existing Wrapper see https://github.com/takari/maven-wrapper
From the next Maven release see this wrapper
https://maven.apache.org/plugins/maven-wrapper-plugin/index.html

John

On Wed, 24 Mar 2021 at 12:00, Mallarapu Ananth
<[hidden email]> wrote:
>
> Hi ,
>
> Have tried to print the M2_HOME and JAVA_HOME in the pipeline you are trying to build . if they are empty it might be getting overwritten . try to put then as environment variables in jenkins config .
>
> On Wednesday, March 24, 2021 at 4:53:13 PM UTC+5:30 [hidden email] wrote:
>>
>> I've locally installed maven on both Master and Slave
>> and correctly set path for both JAVA_HOME and M2
>>
>> jenkins@jenkins-slave-02:~$ echo $M2_HOME
>> /opt/maven
>> jenkins@jenkins-slave-02:~$ echo $JAVA_HOME
>> /usr/lib/jvm/java-1.8.0-openjdk-amd64
>>
>> Once reach the stage involved mvn command, the error occurs
>>
>> /jenkins/workspace/simple_any_tests_master@tmp/durable-c32a56b1/script.sh: 1: mvn: not found
>>
>>
>> I notice that this @tmp dir was empty which means no pom.xml and when looking closely by reproduce the mvn compile in @tmp dir
>>
>> [INFO] Scanning for projects...
>> [INFO] ------------------------------------------------------------------------
>> [INFO] BUILD FAILURE
>> [INFO] ------------------------------------------------------------------------
>> [INFO] Total time:  0.117 s
>> [INFO] Finished at: 2021-03-24T12:09:50+01:00
>> [INFO] ------------------------------------------------------------------------
>> [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
>> [ERROR]
>> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
>> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
>> [ERROR]
>> [ERROR] For more information about the errors and possible solutions, please read the following articles:
>> [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException
>>
>> I'm not sure what is the root cause of this error whereas incorrect maven path or slave setting (permission, etc.)
>>
>> Any helps would be appreciated
>> Cheers
>
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/efd1fb38-db5e-45dc-8ea6-437f9668c417n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAH9u10%3D8oFGxqJ9-0HKHVrEi9PmZ6X9UotQ7LiF9VH21Y%2BtMqA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAEaEQi%2BDsd6hMP-QBbrFZ-To8480Jk6PnqQs%3D3Ky16Mnp3Mbtg%40mail.gmail.com.