Maven插件之绑定阶段

Maven中插件的可以手动运行,通过插件名:目标名的格式。当然也可以绑定某个阶段上,这样当我们运行到这个阶段之后这个插件的某个目标就好自动运行。

代码示例:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <executions>
        <!-- 我们需要在compile阶段执行maven-resources-plugin的copy-resources目标,将 -->
        <execution>
            <id>copy-resources</id>
            <!-- 绑定到的阶段 -->
            <phase>compile</phase>
            <goals>
                <!-- 绑定的目标 -->
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                        <includes>
                            <include>*.xml</include>
                        </includes>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions></plugin>


猜你喜欢

转载自blog.51cto.com/14009535/2363108
0条评论
添加一条新回复