0
votes

My maven command execute fine in windows jenkins server but When i try to execute in linux machine,build got failed

I have tried Shell command build as below :

mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:copy -Dartifact=com.uhg.optum.acc:cores-binaries:%PLATFORM_CORE_VERSION% -DoutputDirectory=. -Dmdep.useBaseVersion=true

Console Output :

[EnvInject] - Loading node environment variables. Building remotely on BuildSwarm-6d98547c91e1-apsrp4109.uhc.com (docker-maven-slave) in workspace /home/jenkins/workspace/2.3.0 Deployment Artifacts (QualityMeasures-Platform) [2.3.0 Deployment Artifacts (QualityMeasures-Platform)] $ /bin/sh -xe /tmp/hudson3262693666907249961.sh + mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:copy -Dartifact=com.uhg.optum.acc:cores-binaries:%PLATFORM_CORE_VERSION% -DoutputDirectory=. -Dmdep.useBaseVersion=true /tmp/hudson3262693666907249961.sh: line 2: mvn: command not found Build step 'Execute shell' marked build as failure Archiving artifacts Finished: FAILURE

Please help me

1
has the environment variable %PLATFORM_CORE_VERSION% been set? If run the command echo $PLATFORM_CORE_VERSION does it return something?ozOli

1 Answers

2
votes

Seems like your shell script has failed since it can't find maven on this node. Check if you can see the maven installation directory defined on Manage Jenkins -> System Information as M2_HOME environment variable. You can also check at your terminal using env command.

Also %PLATFORM_CORE_VERSION% is used to dereference the environment variable under windows, use $PLATFORM_CORE_VERSION under Unix machines (as long as it configured)