Bal*_*i_R 5 java maven-plugin maven
我正在查看正在检查的pom的插件部分,并发现了这个:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-docck-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>pre-site</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
如果您观察执行部分,您会注意到它没有id标记.我的问题是Maven如何使用id标签以及缺少一个标签如何影响观察到的行为.我查看了Maven教程并且可以推断出不同执行阶段的id必须是唯一的,不一定是在继承的poms中的pom,但它没有提到它是如何被利用的.
至少对于Maven 3.0.x,未指定时,执行的ID为default- goalName.所以对于你的例子,ID就是default-check.该值default-cli还可用于配置命令行执行.
从POM本身,任何父POM(包括Maven超级POM)和settings.xml创建有效POM时,将使用执行ID.Maven合并了这些POM中具有相同ID的插件执行配置.这是一个例子.假设此插件配置位于父POM中(只有Maven超级POM位于层次结构中更高的位置.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<!-- default-jar is the ID assigned to the jar:jar execution
included automatically by Maven. This demonstrates how we
can tweak the built-in plugin executions to meet our needs.
Note we do not have to specify phase or goals, as those are
inherited. In the example we add a configuration block and
change the values of the <forceCreation> and <finalName>
elements. -->
<execution>
<id>default-jar</id>
<configuration>
<finalName>firstJar</finalName>
<forceCreation>true</forceCreation>
</configuration>
</execution>
<!-- Add an execution of the jar plugin to build a jar with the
same contents but different name. We assign an execution ID.
Because we are not inheriting config for this execution it's our
responsibility to specify phase and goals, as well as the config
we want. Executions are run in order so this one will run after
the default. -->
<execution>
<id>another-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<finalName>duplicateJar</finalName>
</configuration>
</execution>
<!-- Configure plugin behavior if we execute the jar:jar goal
directly from the command line. Don't bind this to a phase;
we don't want to run this as part of the normal lifecycle. -->
<execution>
<id>default-cli</id>
<configuration>
<finalName>cmdLineJar</finalName>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
使用上面的配置:
| 归档时间: |
|
| 查看次数: |
4576 次 |
| 最近记录: |