如何强制 maven WAR 插件将版本号排除在依赖文件名之外?

How can I force maven WAR plugin to leave the version number out of dependency file names?

我遇到了此处描述的相同问题:How can I force maven to leave the version number out of dependency file names? 但使用 WAR 插件。环顾四周,但没有找到任何解决方案。

您可以定义file name mappings with the maven-war-plugin. This is done with the outputFileNameMapping插件配置:

<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
        <outputFileNameMapping>@{artifactId}@.@{extension}@</outputFileNameMapping>
    </configuration>
</plugin>

使用此配置,WEB-INF/lib 中的每个依赖项的版本都将被删除。