Max
Max

Reputation: 2343

Maven2 how to run some goal before plugin?

I have maven-plagin and need to run goal, that should automatically run before plugin. It possible?

Upvotes: 0

Views: 5839

Answers (2)

Roland Schneider
Roland Schneider

Reputation: 3635

If you always want to execute a goal at a specific point during the build you can add the following to your pom.xml. The really interesting part is the <phase>...</phase> tag, where you can specify the exact point when the goal shall be executed.

<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>

For more information see the Maven documentation.

Upvotes: 4

javamonkey79
javamonkey79

Reputation: 17785

You can script it out and string it together like this:

mvn clean assembly:assembly

for example...

Upvotes: 2

Related Questions