简体   繁体   English

插件目标如何与Maven的构建阶段联系在一起

[英]How do plugin goals tie into build phases in maven

How do plugins add to build phases. 插件如何添加到构建阶段。

I realize that maven has a list of goals that it executes by default but when we add a plugin node to the pom.xml, 我意识到maven有一个默认情况下会执行的目标列表,但是当我们将插件节点添加到pom.xml时,

For example, as per the maven documentation if we include the following plugin 例如,根据maven文档,如果我们包含以下插件

<plugin>
   <groupId>org.codehaus.modello</groupId>
   <artifactId>modello-maven-plugin</artifactId>
   <version>1.4</version>
   <executions>
     <execution>
       <configuration>
         <models>
           <model>src/main/mdo/maven.mdo</model>
         </models>
         <version>4.0.0</version>
       </configuration>
       <goals>
         <goal>java</goal>
       </goals>
     </execution>
   </executions>
 </plugin>

Q1. Q1。 What build phase does it tie into by default ? 默认情况下,它绑定到哪个构建阶段?

Q2. Q2。 Does it get executed in addition to the 'default' goal?, for example if i have a plugin that just echos 'hello' and it gets tied to the compile phase, do i get a echo of 'hello' in addition to the compilation? 除了“默认”目标外,它还会执行吗?例如,如果我有一个仅回显“ hello”的插件,并且它与编译阶段相关,那么除了编译外,我还会得到“ hello”的回声吗? ?

Thanks Venu 谢谢Venu

You can see that in the documentation of the plugin which says the java goal is bound to generate-sources . 您可以在该插件的文档中看到说Java目标绑定到generate-sources

What you are talking about default goal does not exist. 您所说的default目标不存在。 It makes more sense in the meaning of a default binding between maven-plugin:goal and the life-cycle phase in relationship with the packaging type of a project. 在maven-plugin:goal和生命周期阶段之间的默认绑定(与项目的包装类型相关)的意义上,这更有意义。 There you have a kind of default binding which is defined in the Maven super pom which defines the goals and their execution in the life-cyclce. 那里有一种默认绑定,它在Maven超级pom中定义,该默认绑定定义了目标及其在生命周期中的执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM