2

根据文档deploy:deploy-file当您直接指定 pom 文件时应该可以工作;在这种情况下,文档说您不需要“groupId、artifactId、版本和打包参数......因为部署文件目标将从给定的 POM 中获取这些信息”。

但是,当我运行以下命令时:

mvn deploy:deploy-file -DpomFile=webapp-6.0.2.pom -Dfile=webapp-6.0.2.jar -DrepositoryId=internal -Durl=dav:http://server:9091/archiva/repository/internal -Dpackaging=jar -DgeneratePom=false

我收到此错误:

[INFO] Building Maven Default Project
[INFO]    task-segment: [deploy:deploy-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [deploy:deploy-file]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Missing group, artifact, version, or packaging information

使用mvn -e -X不会揭示任何额外的见解。我正在使用 Maven 2.0.9 和 maven-deploy-plugin 2.3 版。

文档是错误的还是我遗漏了什么?

4

1 回答 1

0

tl;dr:部署文件 mojo 不从父项目继承版本号,因此它必须直接在 pom 中或指定为-Dversion=...参数。

根据您如何看待它,这可能是一个错误或文档中的缺失。部署插件的来源有:

Parent parent = model.getParent();

if ( this.groupId == null )
{
    if ( parent != null && parent.getGroupId() != null )
    {
        this.groupId = parent.getGroupId();
    }
    if ( model.getGroupId() != null )
    {
        this.groupId = model.getGroupId();
    }
}
if ( this.artifactId == null && model.getArtifactId() != null )
{
    this.artifactId = model.getArtifactId();
}
if ( this.version == null && model.getVersion() != null )
{
    this.version = model.getVersion();
}
if ( this.packaging == null && model.getPackaging() != null )
{
    this.packaging = model.getPackaging();
}

这意味着插件仅尝试groupId从父级继承,而不是版本号。在我的特殊情况下,我的 pom 丢失了version,我希望它是从父级继承的,就像大多数其他 maven 一样。

于 2014-06-06T16:15:30.323 回答