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
<[email protected]> 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 [email protected] 
> 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 [email protected].
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAH9u10%3D8oFGxqJ9-0HKHVrEi9PmZ6X9UotQ7LiF9VH21Y%2BtMqA%40mail.gmail.com.

Reply via email to