I use archiveClasses
and attachClasses
in settings of maven-war-plugin in order module classes to be packed in jar.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
<archiveClasses>true</archiveClasses>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
But I'd like to change this .jar name. For example, war-classes.jar instead of module-war-1.0-SNAPSHOT.jar.
How can I do it if I can?
You can use to
outputFileNameMapping
to do some filename modification (I'm not it will suit your needs).The pattern you specify in
outputFileNameMapping
will be the file name of the jar containing all your code of your war artifact (only there if you also use<archiveClasses>true</archiveClasses>
of course).But additionally, this pattern will be appended to all you dependencies (with a dash as separator) so for instance
log4j-4.16.jar
will be namedlog4j-myWebApp.jar
(assuming ${artifactId} is resolved tomyWebApp
and that you use this pattern${artifactId}.jar
)