【发布时间】:2014-09-12 11:44:45
【问题描述】:
我编写了一个 maven 插件,它分析一些文件,如果在该文件中找到一些预定义的模式,则会抛出错误。
现在的问题是我想将这个 maven 插件与 maven 发布插件挂钩,这样如果用户通过给出命令 mvn release:prepare 来发布项目,那么只有我的插件会出现在图片中。
但我无法将我的插件与 mvn release 插件连接起来。
我试过了:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<configuration>
<preparationGoals>check-pattern</preparationGoals>
</configuration>
</plugin>
但它会抱怨:
Unknown lifecycle phase "check-pattern".
You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>.
Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy.
如果我以这种方式给予:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<configuration>
<plugin-group-id>com.plugin.snapshot</plugin-group-id>
<plugin-artifact-id>snapshot-maven-plugin</plugin-artifact-id>
<plugin-version>0.0.1</plugin-version>
<goal> check-pattern </goal>
<preparationGoals>check-pattern</preparationGoals>
</configuration>
</plugin>
然后它不会抱怨,但 aldo 不会运行我的 maven 插件。
有什么方法可以让我的插件与 maven 发布插件连接起来吗?
【问题讨论】:
-
您必须像任何其他 r maven 插件一样在构建生命周期中定义执行。或者你有没有试过在准备目标中做
your-maven-plugin:check-pattern? -
谢谢,我得到了解决方案,实际上我没有检查 maven 建议:{您必须指定有效的生命周期阶段或格式为
: 或 : [: ]: .}
标签: java maven plugins maven-plugin