Details
Description
I have a project with plugin that runs python tests and it requires configuration to tell it a directory path. The POM is set up to supply the value based on a Maven property defined in the POM. When I run the following command, everything works fine:
mvn -Dfoo=/path/to/directory verify
However, when I try to use the release plugin (after creating the release.properties file) using the following command:
mvn -B -Dfoo=/path/to/directory release:prepare
The process fails because the foo property is not defined.
I have created a simple release-test reproducer to demonstrate the issue I am having. When I try to run the release:prepare (as shown above), I get:
{{...
[INFO] [INFO] — maven-surefire-plugin:2.20.1:test (default-test) @ release-test —}}
{{ [INFO] [INFO] }}
{{ [INFO] [INFO] -------------------------------------------------------}}
{{ [INFO] [INFO] T E S T S}}
{{ [INFO] [INFO] -------------------------------------------------------}}
{{ [INFO] [INFO] Running io.rhpatrick.test.ReleaseTesterTest}}
{{ [INFO] [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.075 s <<< FAILURE! - in io.rhpatrick.test.ReleaseTesterTest}}
{{ [INFO] [ERROR] TestAdd_WithPositiveNumbers_ReturnsExpectedNumber(io.rhpatrick.test.ReleaseTesterTest) Time elapsed: 0.01 s <<< ERROR!}}
{{ [INFO] java.lang.IllegalArgumentException: Java system property foo was empty}}
{{ [INFO] at io.rhpatrick.test.ReleaseTesterTest.ensurePropertySet(ReleaseTesterTest.java:15)}}
{{ [INFO] }}
{{ [INFO] [INFO] }}
{{ [INFO] [INFO] Results:}}
{{ [INFO] [INFO] }}
{{ [INFO] [ERROR] Errors: }}
{{ [INFO] [ERROR] ReleaseTesterTest.ensurePropertySet:15 IllegalArgument Java system property fo...}}
{{ [INFO] [INFO] }}
{{ [INFO] [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0}}
{{ [INFO] [INFO] }}
{{ [INFO] [INFO] ------------------------------------------------------------------------}}
{{ [INFO] [INFO] BUILD FAILURE}}
{{ [INFO] [INFO] ------------------------------------------------------------------------}}
{{ [INFO] [INFO] Total time: 2.536 s}}
{{ [INFO] [INFO] Finished at: 2021-02-27T09:59:26-06:00}}
{{ [INFO] [INFO] ------------------------------------------------------------------------}}
{{ [INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project release-test: There are test failures.}}
{{ [INFO] [ERROR] }}
{{ [INFO] [ERROR] Please refer to /Users/rpatrick/tmp/release-test/target/surefire-reports for the individual test results.}}
{{ [INFO] [ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.}}
{{ [INFO] [ERROR] -> [Help 1]}}
{{ [INFO] [ERROR] }}
{{ [INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.}}
{{ [INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.}}
{{ [INFO] [ERROR] }}
{{ [INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:}}
{{ [INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException}}
{{ [INFO] ------------------------------------------------------------------------}}
{{ [INFO] BUILD FAILURE}}
{{ [INFO] ------------------------------------------------------------------------}}
{{ [INFO] Total time: 4.588 s}}
{{ [INFO] Finished at: 2021-02-27T09:59:26-06:00}}
{{ [INFO] ------------------------------------------------------------------------}}
{{ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M1:prepare (default-cli) on project release-test: Maven execution failed, exit code: '1' -> [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/MojoExecutionException}}