-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Reported on: CloudBees Jenkins Enterprise 1.580.2.1 + Maven Integration plugin 2.8
Reproduced on: Jenkins 1.629 + Maven Integration plugin 2.12
When building a maven project from a pre/post build step in a maven job or building it on the main build step the environment settings are different
To reproduce it we configure (see [^config.xml]) a maven job which clones any maven project (like https://github.com/aheritier/projectA) in a subdirectory (like projectA). Support bundle attached for reference (see [^support_2015-09-15_11.35.14.zip])
We configure the main build and a pre/post build step of the maven project (projectA/pom.xml) to display the environment settings with "org.apache.maven.plugins:maven-help-plugin:2.2:system"
What do we observe:
- pre-build and post build environment settings are equals ( [^pre-build-step-system-properties.log] == [^post-build-step-system-properties.log] and [^pre-build-step-envvar.log] == [^post-build-step-envvar.log])
- environment variables differences
- $PWD is targeting the $WORKSPACE in pre/post builds ( [^pre-build-step-envvar.log] , [^post-build-step-envvar.log] ) but it is targeting the directory from which jenkins is launch in the main build step ( [^build-step-envvar.log] )
- $PATH is different in pre/post builds ( [^pre-build-step-envvar.log] , [^post-build-step-envvar.log] ) than in the main build step ( [^build-step-envvar.log] )
- $MAVEN_CMD_LINE_ARGS, $MAVEN_TERMINATE_CMD, $MAVEN_PROJECTBASEDIR are defined in pre/post builds ( [^pre-build-step-envvar.log] , [^post-build-step-envvar.log] ) and not in the main build step ( [^build-step-envvar.log] )
- System properties
- in the main build step ( [^build-step-system-properties.log] ) all environment variables are injected as system properties (it's not the case for [^pre-build-step-system-properties.log] and [^post-build-step-system-properties.log] )
- user.dir is targeting the workspace directory in pre/post builds ( [^pre-build-step-envvar.log] , [^post-build-step-envvar.log] ) but is targeting the maven multi module root directory in the main build step ( [^build-step-system-properties.log] )
- Various system properties related to maven are different in the pre/post build steps compared to the main build step because pre/post build steps calling maven directly
$ diff -u pre-build-step-system-properties.log.1 build-step-system-properties.log.1 --- pre-build-step-system-properties.log.1 2015-09-15 14:16:52.000000000 +0200 +++ build-step-system-properties.log.1 2015-09-15 14:17:03.000000000 +0200 @@ -1,5 +1,4 @@ awt.toolkit=sun.lwawt.macosx.LWCToolkit -classworlds.conf=/Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3.3/bin/m2.conf file.encoding.pkg=sun.io file.encoding=UTF-8 file.separator=/ @@ -9,7 +8,7 @@ http.nonProxyHosts=local|*.local|169.254/16|*.169.254/16 java.awt.graphicsenv=sun.awt.CGraphicsEnvironment java.awt.printerjob=sun.lwawt.macosx.CPrinterJob -java.class.path=/Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3.3/boot/plexus-classworlds-2.5.2.jar +java.class.path=/Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/plugins/maven-plugin/WEB-INF/lib/maven32-agent-1.7.jar:/Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3.3/conf/logging java.class.version=51.0 java.endorsed.dirs=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre/lib/endorsed java.ext.dirs=/Users/arnaud/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java @@ -34,7 +33,9 @@ java.vm.version=24.80-b11 line.separator= maven.home=/Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3.3 -maven.multiModuleProjectDirectory=/Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/jobs/test/workspace +maven3.interceptor.common=/Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.7.jar +maven3.interceptor=/Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/plugins/maven-plugin/WEB-INF/lib/maven32-interceptor-1.7.jar +org.slf4j.simpleLogger.defaultLogLevel=info os.arch=x86_64 os.name=Mac OS X os.version=10.10.5 @@ -45,15 +46,16 @@ sun.boot.library.path=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre/lib sun.cpu.endian=little sun.cpu.isalist= +sun.font.fontmanager=sun.font.CFontManager sun.io.unicode.encoding=UnicodeBig -sun.java.command=org.codehaus.plexus.classworlds.launcher.Launcher -f projectA/pom.xml org.apache.maven.plugins:maven-help-plugin:2.2:system +sun.java.command=jenkins.maven3.agent.Maven32Main /Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/tools/hudson.tasks.Maven_MavenInstallation/maven-3.3.3 /Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/war/WEB-INF/lib/remoting-2.52.jar /Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/plugins/maven-plugin/WEB-INF/lib/maven32-interceptor-1.7.jar /Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.7.jar 50630 sun.java.launcher=SUN_STANDARD sun.jnu.encoding=UTF-8 sun.management.compiler=HotSpot 64-Bit Tiered Compilers sun.os.patch.level=unknown user.country.format=FR user.country=US -user.dir=/Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/jobs/test/workspace +user.dir=/Users/arnaud/CloudBees/Support/cases/29325/1-cloudbees-support (3)/jenkins-home/jobs/test/workspace/projectA user.home=/Users/arnaud user.language=en user.name=arnaud
All these differences should be the same if we compare a maven build done by a freestyle job and one done by a maven job