- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
AbstractMavenMojo 的执行方法声明它抛出两个异常:MojoExecutionException 和 MojoFailureException。抛出任一结果都会导致构建停止,并且日志在每种情况下都会显示几乎相同的消息。
MojoExecutionException 的消息是:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] [exception text]
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
MojoFailureException 的消息是:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] [exception text]
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
什么时候应该抛出哪个异常以及为什么?
最佳答案
如果问题导致无法继续构建,您似乎应该抛出 MojoExecutionException
,否则使用 MojoFailureException
。
您可以控制运行 maven 时处理 MojoFailureExpections
的行为。
以下链接详细说明了差异:https://books.sonatype.com/mvnref-book/reference/writing-plugins-sect-custom-plugin.html#writing-plugins-sect-failure
链接损坏?谷歌搜索 sonatype writing-plugins-sect-custom-plugin writing-plugins-sect-failure
关于maven-2 - 何时在 Maven 中使用 MojoExecutionException 与 MojoFailureException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1033154/
以下是我在 pom 中构建 Maven 项目时包含的目标。 4.0.0 com.mynewproject.portlet abc-myfacts-portlet w
我遇到了这个问题,当我使用 Maven 部署我的应用程序时,请提出一些解决方案。 错误日志, [INFO] BUILD FAILURE [INFO] -------------------------
我目前正在为我的项目原型(prototype)使用此设置: mvn archetype:generate "-DarchetypeGroupId=com.sap.cloud.s4hana.arche
我正在学习 Spring 教程,但一直停留在 creating RestController App 11.4 它只是没有运行。 [INFO] ----------------------------
我正在尝试使用 Maven 构建 Android 项目。我正在尝试配置,但我无法弄清楚问题的根源是什么。 [ERROR] Failed to execute goal com.simpligility
当我执行命令./mvnw -Pprod,swagger,webpack clean package -X [ERROR] Failed to execute goal org.apache.maven
我正在使用 this tutorial 学习 spring security 和 AngularJS 。本教程的第一部分指定了对 pom.xml 的非常具体的更改。但是当我添加这些 pom.xml 更
我正在尝试从源代码构建GeoServer。尝试从“geoserver/src”运行 Maven 命令时出现以下错误。 [ERROR] Failed to execute goal pl.project
我正在研究 Apache Spark 并尝试在 Java 程序中运行 Spark,但我遇到了一些问题。 我使用 Maven 构建程序并创建了一个新的 Maven 项目。这是 pom.xml spa
AbstractMavenMojo 的执行方法声明它抛出两个异常:MojoExecutionException 和 MojoFailureException。抛出任一结果都会导致构建停止,并且日志在每
我在使用maven从源代码编译hadoop时遇到了一些问题。这是错误,任何人都可以帮助我吗?谢谢。 [ERROR] Failed to execute goal org.apache.hadoop:h
我从命令行运行 Maven-Project 时遇到问题我在 cmd 中使用此命令来运行名为 mainClass 的类 mvn -e exec:java -Dexec.mainClass="com
在我的Khatami项目 我正在使用 maven 来管理编译并将结果打包到一个可运行的 Artifact 中:顶层的可执行 shell 脚本,bin/ 包含可执行 jar 及其依赖的 jar。请看我的
我尝试通过运行 atlas-cli pi 命令来编译我的自定义 jira 插件。当我使用存储库时它起作用了 http://repo1.maven.org/maven2/ .现在改为http://sea
这个问题几乎与MojoExecutionException when generate sources cxf-xjc-plugin:3.3.0 java11重复。但有两个异常(exception):
当为 Google App Engine 运行 Maven 构建时,我收到构建错误: org.apache.maven.plugin.MojoExecutionException: The DataN
我是一名优秀的程序员,十分优秀!