java - Why can't my tests see my system property when I release on Jenkins? -


i wrote unit test code prints out value of system.property named "jenkins_build". property has value when run these command locally:

mvn --batch-mode test -djenkins_build=true mvn test -dargline="-djenkins_build=true" etc. 

but no matter do, cannot property tests when run on jenkins. command line option i'm using there:

mvn -dargline="-djenkins_build=true" --batch-mode -dresume=false release:prepare release:perform 

slightly different, don't see why matter. why system.getproperty("jenkins_build") null on jenkins "true" in local environment? have using release:prepare release:perform?

i think same question, i'm not sure. difference he's trying pass arguments release plugin, i'm trying pass them surefire plugin. also, want define value in command line without having change pom.xml. there way that?

fwiw, solution linked does work.

note if not fork jvm, properties set on maven command line found; but, if fork jvm properties need copied on forked jvm's argment list.

i guessing forking aspect of build, not passing in new argline, or passing in new argline doesn't copy necessary value launched (set) property.

this might mean need set default (empty) property make argline configuration correct in both cases argument set , argument not set. that's second "example" in link (sander verhagen's example) detailing, if isn't explicit why.

as far why encountered in maven-release-plugin, keep in mind during maven-release-plugin have 1 "parent" maven process driving 2 complete nested maven builds. failure pass arguments children builds mean children run without required arguments (as argument parent activity, not 2 maven runs build release version , next snapshot version.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -