Maven 多模块项目上传到具有覆盖分布的 Nexus 方法

问题描述

我有一个多模块 Maven 项目

project
 -submodule1
  - pom.xml
 -submodule2
  - pom.xml
...
 -submoduleN
  - pom.xml
 -pom.xml

父 pom 包含 <distributionManagement> 部分,这对于大多数子模型都是实际的。每个子模块都继承父 pom。但是我有 2 个 sumbodules,我想在其中覆盖 distributionManagement 部分。我可以用

<plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                    <configuration>
                        <altDeploymentRepository>cn-archetypes::default::https://repository.company.com/content/repositories/archetypes/</altDeploymentRepository>
                    </configuration>
                </plugin>

除了我想禁用快照部署之外,一切正常。我可以用 nexus-staging-maven-plugin=true skipStaging 实现它。

<plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                    <configuration>
                        <altDeploymentRepository>cn-archetypes::default::https://repository.company.com/content/repositories/archetypes/</altDeploymentRepository>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.8</version>
                    <extensions>true</extensions>
                    <configuration>
                        <skipStaging>true</skipStaging>
                        <serverId>cn-archetypes</serverId>
                        <nexusUrl>https://repository.company.com/</nexusUrl>
                    </configuration>
                </plugin>

但是当我这样做时,我得到了“返回代码是:400,ReasonPhrase:错误的请求。”

我尝试了 maven-deployment-plugin 和 nexus 插件的不同组合,但没有成功。有人可以建议这些部署插件的正确属性组合或其他方法来实现覆盖父分发管理部分并禁用子子模块中的暂存部署吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)