Surefire does it's best to provide the forked test cases with a clean
environment. Thus it will not pass through system properties unless
explicitly told to.

Your solution is to configure the Pom to tell Surefire to pass those
properties through. Most likely this will be one of the very few cases
where you may want to use a profile in your Pom.

This is really a maven issue and not a Jenkins issue, so I would rather if
we take it up on users@m.a.o I will be happy to help there

On Wednesday, 25 April 2012, Billy Bacon wrote:

> We are running Jenkins ver. 1.447.1 and was hoping the latest upgrade
> would resolve this but the outcome is the same. The jvm arguments we
> are configuring in the Goals and options field are not making it into
> the application and unit tests when the Jenkins job executes. We are
> seeing the following in the console output:
>
> Executing Maven:  -B -f /opt/hudson/home/jobs/alex-vendor/workspace/
> pom.xml clean package -DAWS_ACCESS_KEY_ID=xxxxxxxxxxxx -
> DAWS_SECRET_KEY=xxxxxxxxxxxx -
> DJDBC_CONNECTION_STRING=jdbc:postgresql://xxxxxxxxxxxx:5432/test?
> user=xxxx&yyyy=aws -DPARAM1=5 -DPARAM2=localhost:8080 -DPARAM3=false
>
> This output looks great and I anticipated everything working but for
> whatever reason, these jvm args seem to be filtered out and never make
> it to our unit tests. We've even tried encapsulating each jvm arg in
> double quotes, but the results are the same (unit test failures).
>
> The only way we've been successful in passing these arguments is
> through the maven-surefire-plugin (via argLine element) which isn't
> adequate for us; we need to change credentials on a per job basis.
>
> Lastly, we even tried the EnvInject Plugin but unfortunately, that
> gave us no success as well.
>
> Does anyone see what we have misconfigured? Our application never sees
> the JDBC_CONNECTION_STRING jvm arg and throws an exception b/c it's
> missing when the job executes.
>
> Thanks for any help.
>
> - Billy -

Reply via email to