Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven classifier empty jars

Assume we have multimodule maven project:

parent
|-module-a-jar
|-module-b-jar
|-web-module-c-war

There is common classified specified for parent pom.xml:

<pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <classifier>${my.project.classifier}</classifier>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <classifier>${my.project.classifier}</classifier>
                </configuration>
            </plugin>           
        </plugins>
    </pluginManagement>

Assume that I build project using

mvn clean package -Dmy.project.classifier=NIGHTLY

After building web-module-c-war contains empty folders instead of jar files:

web-module-c-war
|-WEB-INF
  |-lib
    |-module-a-jar
    |-module-a-jar

Can you please advise how to fix this? Why this is happening?

If I remove classifier from maven-jar-plugin configuration it seems to be working fine.

Thanks

like image 522
tillias Avatar asked Jun 15 '26 04:06

tillias


1 Answers

why not just make this?

  1. pom web-module-c-war :

    <groupId>xxxxx</groupId>
    <artifactId>xxxx</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <classifier>${my.project.classifier}</classifier>
    
    ..
    ..
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>module-a-jar</artifactId>
        <version>${project.version}</version> 
        <classifier>${my.project.classifier}</classifier>
    </dependency> 
    
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>module-b-jar</artifactId>
        <version>${project.version}</version> 
        <classifier>${my.project.classifier}</classifier>
    </dependency> 
    
like image 186
question_maven_com Avatar answered Jun 17 '26 16:06

question_maven_com



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!