如果在 pom.xml 中没有指定插件的 phase,那么它默认在哪个 phase 执行呢
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<version>1.8.1</version>
<executions>
<execution>
<!--
没有配置 phase
<phase>process-test-resources</phase>
-->
<configuration>
<models>
<model>src/main/mdo/maven.mdo</model>
</models>
<version>4.0.0</version>
</configuration>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
</plugin>
可以通过查看插件的源码,AbstractMojo 的实现类中的 @Mojo 注解得知
// goal 的名称叫 hello,默认绑定到 package
@Mojo(name = "hello", defaultPhase = LifecyclePhase.PACKAGE)
public class Hello extends AbstractMojo {
@Parameter private String name;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
System.out.println("hello plugin's name:" + name);
}
}
参考:
https://blog.csdn.net/howeres/article/details/123288554
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
标签:插件,name,默认,maven,phase,hello From: https://www.cnblogs.com/zbmcz/p/17847401.html