Maven-如何重命名jar名称的输出分类器? [英] Maven - How to rename the output classifier of a jar name?
问题描述
我正在尝试重命名WAR项目中jar文件名的默认输出分类器.
I'm trying to rename the default output classifer of a jar filename that is part of a WAR project.
默认情况下,它会生成以下输出jar $ {project.artifactId}-{project.version} -classifier(在我的示例中,它将生成mywebapp-0.0.1-SNAPSHOT-client).
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).
我想创建以下输出jar: $ {project.artifactId} -classifier-$ {project.version}(在我的示例中为mywebapp-client-0.0.1-SNAPSHOT).
I would like to create instead the following output jar: ${project.artifactId}-classifier-${project.version} (in my example mywebapp-client-0.0.1-SNAPSHOT).
怎么可能?
...
<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>
...
推荐答案
您几乎正确地完成了所有操作,只需从配置内部删除classifier标签,然后尝试.
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>
这篇关于Maven-如何重命名jar名称的输出分类器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!