Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

maven

jar

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>
...
like image 793
Joce Avatar asked Oct 21 '22 03:10

Joce


1 Answers

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>
like image 115
saurav Avatar answered Oct 24 '22 05:10

saurav