首页 / JAVA / java-如何映射maven插件别名
java-如何映射maven插件别名
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java-如何映射maven插件别名,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2762字,纯文字阅读大概需要4分钟。
内容图文
![java-如何映射maven插件别名](/upload/InfoBanner/zyjiaocheng/682/cf97ef4b1fce4ea094f20f358720df59.jpg)
我想了解什么是mvn clean:clean实际上是做什么的.
mvn -B help:describe -Dcmd=clean
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building sample-one 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-help-plugin:2.2:describe (default-cli) @ sample-one ---
[INFO] 'clean' is a lifecycle with the following phases:
* pre-clean: Not defined
* clean: org.apache.maven.plugins:maven-clean-plugin:2.5:clean
* post-clean: Not defined
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.689 s
[INFO] Finished at: 2015-12-10T10:20:16-08:00
[INFO] Final Memory: 9M/245M
[INFO] ------------------------------------------------------------------------
在我看来,mvn clean:clean与执行mvn org.apache.maven.plugins:maven-clean-plugin:2.5:clean相同.因此,我假设mvn clean:clean中的第一个clean只是org.apache.maven.plugins:maven-clean-plugin:2.5的别名.同样,mvn maven-surefire-plugin:2.12.4:test与mvn surefire:test相同.
因此,以某种方式,maven-surefire-plugin:2.12.4似乎引用surefire和org.apache.maven.plugins:maven-clean-plugin:2.5进行清洁.
当我看有效绒球时,我看到以下内容
Maven-surefire-插件
2.12.4
默认测试
测试
测试
Maven清洁插件
2.5
默认清理
清洁
清洁
如您所见,pom似乎没有定义别名.所以以下是我的问题
>我对插件别名的理解正确吗
>如果我对别名的理解是正确的-a)如何以及在何处定义别名? b)有没有办法列出所有别名.
解决方法:
从有关plugins development的Maven官方文档中:
Shortening the Command Line
There are several ways to reduce the amount of required typing:
- If you need to run the latest version of a plugin installed in your local repository, you can omit its version number. So just use
mvn sample.plugin:hello-maven-plugin:sayhi
to run your plugin.- You can assign a shortened prefix to your plugin, such as
mvn hello:sayhi
. This is done automatically if you follow the convention of using${prefix}-maven-plugin
(ormaven-${prefix}-plugin
if the plugin is part of the Apache Maven project). You may also assign one through additional configuration – for more information see 07001.Finally, you can also add your plugin’s groupId to the list of groupIds searched by default. To do this, you need to add the following to your
${user.home}/.m2/settings.xml
file:
<pluginGroups>
<pluginGroup>sample.plugin</pluginGroup>
</pluginGroups>
At this point, you can run the mojo with
mvn hello:sayhi
.
因此,别名不是在pom文件中定义的,而是maven内置机制的一部分.有关官方文档Plugin Prefix Resolution,也提供了更多详细信息.
内容总结
以上是互联网集市为您收集整理的java-如何映射maven插件别名全部内容,希望文章能够帮你解决java-如何映射maven插件别名所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。