[英]Execution order of goal when a plugin goal in attached to a lifecycle phase in maven
我试图了解Maven目标执行顺序。
所以我有一个pom,它将maven-antrun-plugin
run
目标附加到了maven生命周期构建的clean
阶段。
当运行mvn clean
我得到输出,如输出部分所示:
现在我的问题是:
1为什么执行maven-clean-plugin:2.4.1:clean (default-clean)
目标,因为我已经附加了要运行的目标,即pre-process-classes
...所以我的目标也被添加到默认目标列表中专家有或可以重写? 基本上,Maven如何决定要执行哪个目标?
2在“插件”部分中,我只有artifactId
和version
而没有groupId
。 那么maven如何找到正确的插件.. isnt groupId必需的呢?
输出量
--- maven-clean-plugin:2.4.1:clean (default-clean) @ second_third ---
Deleting D:\tmp\maven\first_second\target
--- maven-antrun-plugin:1.1:run (pre-process-classes) @ second_third ---
Executing tasks
echo] Build Dir: D:\tmp\maven\first_second\target
pom.xml
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>my.second_third_maven</groupId>
<artifactId>second_third</artifactId>
<version>1.1.0</version>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>pre-process-classes</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Build Dir: ${project.build.directory}</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
要回答第二个问题:
By default, Maven will search the groupId org.apache.maven.plugins
for prefix-to-artifactId mappings for the plugins it needs to
perform a given build.
http://maven.apache.org/guides/introduction/introduction-to-plugin-prefix-mapping.html
部分“配置Maven以搜索插件”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.