javamavenmaven-jar-plugin

How to stop/prevent maven default goal execution


I have a parent pom which is serving required version number variables of my other components & more importantly "maven-jar-plugin"(version 3.0.2). That same pom is having default profile which will make its multi-module child build a jar. Now the problem is that Multi-module child is throwing this below exception

You have to use a classifier to attach supplemental artifacts to the project instead of replacing them

I found that this is because of maven-jar-plugin default binding inherent to the jar packaging but I am doing a war packaging so after war packaging the default-jar execution starts and throwing the above one. Any solution to stop the default will help me thanks in advance.

pom(Master pom)
  + pom(Multi-Module child)
     +-- pom (war child pom, but after the war, it starts building default jar) 
       +-- pom2
       +-- pom3 

Solution

  • Include in your war-pom

        <build>
            ....
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            ....
        </build>