Maven - How to rename the output classifier of a jar name?

15,221

You almost did everything correctly , just remove the classifier tag from inside the configuration and then try.

  <configuration>
           <finalName>${project.artifactId}-client-${project.version}</finalName>
           <includes>
              <include>client/*</include>
           </includes>
  </configuration>
Share:
15,221
Joce
Author by

Joce

Updated on June 20, 2022

Comments

  • Joce
    Joce almost 2 years

    I'm trying to rename the default output classifer of a jar filename that is part of a WAR project.

    By default it generates the following output jar ${project.artifactId}-{project.version}-classifier (in my example it would result in mywebapp-0.0.1-SNAPSHOT-client).

    I would like to create instead the following output jar: ${project.artifactId}-classifier-${project.version} (in my example mywebapp-client-0.0.1-SNAPSHOT).

    How is it possible ?

    ...    
    <artifactId>mywebapp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    
    ...
    <plugins>
       <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <executions>
             <execution>
                <phase>package</phase>
                <goals>
                   <goal>jar</goal>
                </goals>
                <configuration>
                   <finalName>${project.artifactId}-client-${project.version}</finalName>
                   <classifier>client</classifier>
                   <includes>
                      <include>client/*</include>
                   </includes>
                </configuration>
             </execution>
          </executions>
       </plugin>
    </plugins>
    ...