安装到本地存储库并部署到远程存储库时,如何在Maven中构建WAR项目并提供自定义名称 [英] How to build a WAR project in Maven giving a customized name when installed to local repository and deployed to remote repositories

查看:110
本文介绍了安装到本地存储库并部署到远程存储库时,如何在Maven中构建WAR项目并提供自定义名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I know that, I can give a fileName for the WAR file using the build/finalName tag in the pom.xml file.

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

But this will only affect the name of the package created in the target directory (or a specifically given directory using build/directory). It will not affect to the file name in the local repository and remote repositories and they'll always contains the name with version numbers.

还有其他方法可以这样做吗,因为它也会影响本地存储库和远程存储库?

Is there any other way to do this as it will affect to the local repository and remote repositories as well?

参考文献:如何使用不带版本的maven构建项目

推荐答案

repository中的artifact基本上由我们的pom.xmlgroup-idartifact-id标识.即使我们更改finalName,也没有任何效果,因为我们的pom.xml仍然相同.

Basically the artifact in the repository is identified by our pom.xml, the group-id and artifact-id. Even we change the finalName, there is no any effect, since our pom.xml still the same.

想象一下,我们的pom.xml被定义为some-group:foo.然后我们将finalName更改为bar,我不知道如何从repository获取some-group:bar.

Imagine that our pom.xml is defined as some-group:foo. Then we change the finalName to bar I've no idea how can we get the some-group:bar from the repository.

没有任何关于some-group:bar的描述.

这篇关于安装到本地存储库并部署到远程存储库时,如何在Maven中构建WAR项目并提供自定义名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆