Maven上传文件至Nexus仓库,无需groupId和artifactId。

huangapple go评论63阅读模式
英文:

maven upload file to Nexus repo without groupId and artifactId

问题

我有一个 zip 文件和一个 Nexus 仓库,我想知道是否可以创建一个目标,将 zip 文件上传到仓库的根文件夹,而不需要 groupId 和 artifactId。

我的构件是由 pom.xml 构建的。

英文:

I have a zip file and a Nexus repo and I would like to know if it is possible to create a goal to upload the zip file in the repot root folder, without groupId and artifactId

my artifact is build by a pom.xml

答案1

得分: 4

这取决于您在Nexus 3实例中声明的存储库类型。

对于Maven存储库,您需要一个GAV(group/artifactID/Version)。
NEXUS-5170 说明了即使没有GAV,GUI仍然提供了“添加构件”,但那是一个错误)

在您的情况下,作为一种解决方法,您可以创建一个“default/root”组,专门用于托管这些类型的构件:一个组来托管它们所有。然后,您可以使用 deploy:deploy-file,它需要 正如您所见,需要一个GAV

但是,如果您的构件是通过pom.xml构建的(该文件指定了GAV),那么简单的 mvn deploy 就足够了(目标是 deploy:deploy)。

英文:

It depends on the type of repository declared in your Nexus 3 instance.

For a Maven one, you need a GAV (group/artifactID/Version).
(NEXUS-5170 is illustrates that, even without a GAV, the GUI still proposes 'Add Artifact', but that is a bug)

In your case, as a workaround, you would create one "default/root" group dedicated to host those kind of artifacts: one group to host them all.
You can then use deploy:deploy-file, which, as you have seen, requires a GAV.

But if your artifact is built by a pom.xml (which does specify the GAV), a simple mvn deploy is enough (target deploy:deploy)

huangapple
  • 本文由 发表于 2020年8月20日 19:04:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/63503687.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定