Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

skip the execution of maven-war-plugin

How do I skip the execution of the maven-war-plugin during a mvn command?

Based on the documentation, it seems like I should be able to do so by running something like the following, using -Dmaven.war.skip=true:

mvn verify -P integration-test -Dmaven.war.skip=true

But when I do that the maven-war-plugin still gets executed.

Also strange is that when I remove the maven-war-plugin from my pom altogether, it still gets executed. That leaves me wondering why maven-war-plugin is getting executed at all, as I don't have it mentioned anywhere in my pom.xml.

So maybe a better question is: what brings the maven-war-plugin into the project if I don't have it listed as a plugin?

like image 737
Woodchuck Avatar asked Sep 18 '25 00:09

Woodchuck


1 Answers

You must override the default war execution.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.3.2</version>
    <configuration>
        <skip>true</skip>
    </configuration>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>war</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Explanation

By default, the war goal binds to the package lifecylcle phase as stated in the documentation.

So we override the package execution in the pom with the skip configuration.

like image 143
Christophe Weis Avatar answered Sep 23 '25 14:09

Christophe Weis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!