Maven2如何在插件之前运行一些目标?

时间:2009-07-03 07:42:16

标签: maven-2 maven-plugin

我有maven-plugin并且需要运行目标,它应该在插件之前自动运行。有可能吗?

2 个答案:

答案 0 :(得分:4)

如果您始终希望在构建期间的特定时间点执行目标,则可以将以下内容添加到pom.xml。真正有趣的部分是<phase>...</phase>标签,您可以在其中指定目标执行时的确切点。

<build>
    <plugins>
        <plugin>
            <groupId>com.foo</groupId>
            <artifactId>bar-plugin</artifactId>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>foobargoal</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

有关详细信息,请参阅Maven documentation

答案 1 :(得分:2)

您可以将其编写脚本并将其串在一起,如下所示:

mvn clean assembly:assembly

例如......

相关问题