slachiewicz opened a new issue, #818:
URL: https://github.com/apache/maven-invoker-plugin/issues/818

   A job that fails with anything other than a `RunFailureException` gets no 
`result` in its `BUILD-*.xml`. `invoker:verify` then counts it nowhere and the 
build passes; `invoker:run` reports the same job as an error.
   
   ### Reproduce
   
   With 3.10.1 or master, configure 
`<preBuildHookScript>setup</preBuildHookScript>` and add either of these ITs:
   
   - a `setup.groovy` that runs `context.userProperties.put('k', "val-${v}")` 
(the GString value later fails a `String` cast when the command line is built)
   - a directory named like the hook, for example `src/it/x/setup/`
   
   `mvn invoker:integration-test invoker:verify` prints the following and exits 
0:
   
   ```
   [INFO]   Passed: 1, Failed: 0, Errors: 0, Skipped: 0
   [INFO] BUILD SUCCESS
   ```
   
   `mvn invoker:run` on the same project prints `Errors: 2` and fails.
   
   ### Cause
   
   `runBuild` in 
[AbstractInvokerMojo.java](https://github.com/apache/maven-invoker-plugin/blob/master/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java)
 writes the build report in `finally` while the exception is still propagating. 
[JobExecutor.java](https://github.com/apache/maven-invoker-plugin/blob/master/src/main/java/org/apache/maven/plugins/invoker/JobExecutor.java)
 sets `ERROR` only afterwards, and `updateStats` in 
[InvokerSession.java](https://github.com/apache/maven-invoker-plugin/blob/master/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java)
 skips a job whose result is null.
   
   ### Expected
   
   The job is written to the report with result `error` and the failure 
message, and `invoker:verify` fails the build.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to