You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/12/06 14:56:42 UTC

[GitHub] [maven] kwin opened a new pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

kwin opened a new pull request #632:
URL: https://github.com/apache/maven/pull/632


   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MNG) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line and body.
    - [x] Format the pull request title like `[MNG-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MNG-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [x] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
    - [ ] You have run the [Core IT][core-its] successfully.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   [core-its]: https://maven.apache.org/core-its/core-it-suite/
   


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] kwin edited a comment on pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

Posted by GitBox <gi...@apache.org>.
kwin edited a comment on pull request #632:
URL: https://github.com/apache/maven/pull/632#issuecomment-988618617


   I tried it out with a dummy mojo and both exceptions behave exactly the same, i.e. both emit "BUILD FAILURE". I couldn't influence the build outcome with any of the `--fail-xxx` options nor continue the build after the exception happened. I had a quick look in the commit logs and found (https://github.com/apache/maven/commit/06dc81b54e48b76ce25675f2ae52e39ac8aeb396#diff-976d393f31905911c189adc496696a5047b0aae4526ba1c5d13bf7502ce2cbca) which once treated `MojoExecutionException` separately, but that class has been removed in https://github.com/apache/maven/commit/ae1501b9f67db880ea7f16299f95f00ce04728ff


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] kwin commented on pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

Posted by GitBox <gi...@apache.org>.
kwin commented on pull request #632:
URL: https://github.com/apache/maven/pull/632#issuecomment-988624535


   Given that, I would recommend to either reestablish the different semantics or deprecate one exception class of the two. In any case right now it is highly confusing why there are two different exception classes and when to use which in mojos.


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] kwin commented on pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

Posted by GitBox <gi...@apache.org>.
kwin commented on pull request #632:
URL: https://github.com/apache/maven/pull/632#issuecomment-988594671


   @gnodet Indeed I couldn't find anything either yet. TBH I have just taken the information from https://books.sonatype.com/mvnref-book/reference/writing-plugins-sect-custom-plugin.html#writing-plugins-sect-failure which I consider a pretty reliable source. But maybe the different handling of those exceptions has vanished over time. Will do some more tests....


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] kwin commented on pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

Posted by GitBox <gi...@apache.org>.
kwin commented on pull request #632:
URL: https://github.com/apache/maven/pull/632#issuecomment-988694442


   > Overall the need of these exception is that mojo don't throw an Exception/Throwable but there is no technical reason
   
   I think the reason is to throw an exception which would allow Maven to continue (by using `--fail-never` or `--fail-at-end`, https://maven.apache.org/ref/3.8.4/maven-embedder/cli.html). Using an unchecked exception will IMHO always lead to an immediate failure and broken Maven 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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] kwin edited a comment on pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

Posted by GitBox <gi...@apache.org>.
kwin edited a comment on pull request #632:
URL: https://github.com/apache/maven/pull/632#issuecomment-988618617


   I tried it out with a dummy mojo and both exceptions behave exactly the same, i.e. both emit "BUILD FAILURE". I couldn't influence the build outcome with any of the `--fail-xxx` options nor continue the build after the exception happened. I had a quick look in the commit logs and found (https://github.com/apache/maven/commit/06dc81b54e48b76ce25675f2ae52e39ac8aeb396#diff-976d393f31905911c189adc496696a5047b0aae4526ba1c5d13bf7502ce2cbca) which once treated `MojoExecutionException` separately, but that class has been removed in https://github.com/apache/maven/commit/ae1501b9f67db880ea7f16299f95f00ce04728ff (with Maven 3), so most probably having two different exception classes is no longer useful in Maven 3...


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] gnodet commented on pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

Posted by GitBox <gi...@apache.org>.
gnodet commented on pull request #632:
URL: https://github.com/apache/maven/pull/632#issuecomment-988515507


   @kwin I think it would be interesting to add pointers to the code where those exceptions are actually handled ? I must admit I tried to find them but I haven't been able to find them in a timely manner.  For example there's no `BUILD ERROR` string in the whole codebase...


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] kwin commented on pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

Posted by GitBox <gi...@apache.org>.
kwin commented on pull request #632:
URL: https://github.com/apache/maven/pull/632#issuecomment-988638938


   Dug a bit deeper and found https://github.com/apache/maven/blob/ed370a6382ee4e431d36ae38454174b94d4f33aa/maven-core/src/main/java/org/apache/maven/DefaultMaven.java#L235-L255 for the different handling. 


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] rmannibucau commented on pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on pull request #632:
URL: https://github.com/apache/maven/pull/632#issuecomment-988696241


   @kwin not sure, `--fail-never` will ignore the exception and `--fail-at-end` will stack it to fail after other modules build so MojoXXXExceptons never bring anything in this logic (as proven by BuilderCommon impl) so think it is fine to remove this constraint. There is no real recovery exception in maven - and don't think we need one.


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] rmannibucau commented on pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on pull request #632:
URL: https://github.com/apache/maven/pull/632#issuecomment-988675286


   My understanding was that MojoExecutionException is a wrapper around another exception as primary usage whereas MojoFailureException is a root exception by itself (and previous handling tends to confirm it).
   
   Overall the need of these exception is that mojo don't throw an Exception/Throwable but there is no technical reason - in particular now, so ultimately we can just deprecate both and change mojo contract for 4.0, no?


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] kwin commented on pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

Posted by GitBox <gi...@apache.org>.
kwin commented on pull request #632:
URL: https://github.com/apache/maven/pull/632#issuecomment-988618617


   I tried it out with a dummy mojo and both exceptions behave exactly the same, i.e. both emit "BUILD FAILURE". I couldn't influence the build outcome with any of the `--fail-xxx` options nor continue the build after the exception happened. I had a quick look in the commit logs and found (https://github.com/apache/maven/commit/06dc81b54e48b76ce25675f2ae52e39ac8aeb396#diff-976d393f31905911c189adc496696a5047b0aae4526ba1c5d13bf7502ce2cbca) which once treated `MojoExecutionException` separately, but that class has been removed.


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] gnodet commented on pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

Posted by GitBox <gi...@apache.org>.
gnodet commented on pull request #632:
URL: https://github.com/apache/maven/pull/632#issuecomment-988654452


   > Dug a bit deeper and found
   > 
   > https://github.com/apache/maven/blob/ed370a6382ee4e431d36ae38454174b94d4f33aa/maven-core/src/main/java/org/apache/maven/DefaultMaven.java#L235-L255
   > 
   > for the different handling.
   
   Now, the exceptions are handled in https://github.com/apache/maven/blob/3982c195e91e3ea0f73ce9e61c6ddc57137726e9/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java
   and no case is done whether the exception is a `MojoFailureException` or `MojoExecutionException` which is coherent with your experiments.  If we confirm this, I'd change the javadoc and eventually deprecate one of the exceptions.


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] gnodet edited a comment on pull request #632: [MNG-7351] clarify differences between MojoFailureException and MojoExecutionException in javadoc

Posted by GitBox <gi...@apache.org>.
gnodet edited a comment on pull request #632:
URL: https://github.com/apache/maven/pull/632#issuecomment-988654452


   > Dug a bit deeper and found
   > 
   > https://github.com/apache/maven/blob/ed370a6382ee4e431d36ae38454174b94d4f33aa/maven-core/src/main/java/org/apache/maven/DefaultMaven.java#L235-L255
   > 
   > for the different handling.
   
   Now, the exceptions are handled in [`BuilderCommon`](https://github.com/apache/maven/blob/3982c195e91e3ea0f73ce9e61c6ddc57137726e9/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java) and no case is done whether the exception is a `MojoFailureException` or `MojoExecutionException` which is coherent with your experiments.  If we confirm this, I'd change the javadoc and eventually deprecate one of the exceptions.


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org