www.un.org/spanish/ecosoc 关于两个重要要点的说明:
Where to place plugin
A plugin
should indeed be added in most of the cases within the build
/plugins
section, however there is an important difference between placing it within plugins
against placing it within pluginManagement
/plugins
.
这种误解是:often,原因是在Maven没有援引皮条,或者更难击::
- Plugins under
build
/plugins
are directly part of the default Maven build, if they specify an execution
or if they configure something for the default build (see below)
Plugins under build
/pluginManagement
/plugins
are not necessarely part of the default Maven build, that is, is a management, it s an hint to maven: it you happen to use this plugin, then please use the version, the configuration, the executions I specify here, in this management.
www.un.org/spanish/ecosoc 但是,happen to use means? 手段:如果在<代码>build/<>>>>>>上出现同一条块,则适用这一管理(只有这样才会有效);or,如果Maven缺席援引该金,则也适用。
www.un.org/spanish/ecosoc 但是,在违约时如何援引一种假想? 它是 后的主要理念的一部分:公约的组合。 通过公约,如果你具体指明某种<代码> 包装代码>(default jar
,但可以打上war
,例如,你希望援引某些假想。 援引maven-jar-plugin/code>;建立war <>/code>,build
/<><>>/code>pluginManage<<>/code>上指明了一种对Maven建筑有约束力的原始.,那么也将使用这一代谢。
Ordering
Concerning the ordering of sections within the pom.xml
file, a further clarification is required: it s indeed irrelevant in most of the cases, however the order of plugin
element wihtin the build
/plugins
section may be important. Since Maven 3.0.3 (MNG-2258
), different plugin executions attached to the same Maven phase will be invoked in their order of declaration in the pom.xml
file. That is, ordering is important in this case, since it may affect the behavior of the build.
Additionally, also order of dependency
declarations may affect your build towards Dependency Mediation, that is, the first declared dependency wins in case of conflict against a transitive dependency. So, once again, ordering is important in certain cases.
最后,但并非最不重要的是,尽管对<代码>>pom.xml文档的其他部分而言,订单并不重要,但好的习惯是遵循官方网站 rel=“noreferer>。 • 《公约》第22条:
<project>
<modelVersion/>
<parent/>
<groupId/>
<artifactId/>
<version/>
<packaging/>
<properties/>
<dependencyManagement/>
<dependencies/>
<build/>
<reporting/>
<profiles/>
</project>
https://github.com/Ekryd/sortpom”rel=“noretinger”>sortpom-maven-plugin
也可自动适用这一标准令,仅在有关<条码>上援引以下内容:
mvn com.github.ekryd.sortpom:sortpom-maven-plugin:2.5.0:sort
-Dsort.keepBlankLines -Dsort.predefinedSortOrder=recommended_2008_06
www.un.org/spanish/ecosoc 供进一步阅读<>。