如何在 Maven 中构建 WAR 项目,在安装到本地存储库和部署到远程存储库时提供自定义名称

How to build a WAR project in Maven giving a customized name when installed to local repository and deployed to remote repositories

我知道,我可以使用 pom.xml 文件中的 build/finalName 标记为 WAR 文件指定文件名。

但这只会影响在目标目录(或使用 build/directory 的特定给定目录)中创建的包的名称。它不会影响本地存储库和远程存储库中的文件名,它们将始终包含带有版本号的名称。

有没有其他方法可以做到这一点,因为它也会影响本地存储库和远程存储库?

参考资料:how to Build project with maven without version

基本上repository中的artifact就是我们的pom.xmlgroup-idartifact-id。即使我们更改 finalName,也没有任何效果,因为我们的 pom.xml 仍然是一样的。

假设我们的pom.xml定义为some-group:foo。然后我们将 finalName 更改为 bar 我不知道如何从 repository 中获取 some-group:bar

没有任何 pom.xml 描述了关于 some-group:bar