我想使用不同的分类器部署两个 jar 工件,但目前失败了,因为它们都提供了自己的pom.xml. 我该如何解决这个问题,以便两个pom.xmls 都可以与其工件一起上传?
示例 - 我有com.test.company.somelib-1.0.0-cmp1.jarand com.test.company.somelib-1.0.0-cmp2.jar,哪里cmpX是分类器。两个包都包含(逻辑上)相同的代码和类(相同版本),它们只是在预处理方式上略有不同。由于我们需要维护向后兼容性,因此存在分类器注释。
长话短说,第一个工件上传正常,第二个上传失败Forbidden,因为我们的存储库不允许覆盖工件(我想保持这种方式)。
创建这两个包的管道略有不同,因此更容易将它们的构建分开。我只想将它们部署为两个具有相同名称和不同分类器的包。
感谢帮助
编辑:建议使用 Maven 配置文件。我可以看到它们会起作用,但它们并不理想。
考虑我在下图中描述的设置 - 有一个 CI 服务器(TeamCity)。
classifier信息和其他信息),然后构建其工件并将其部署到我们的 Artifactory。如果我决定添加另一个processing-build,我想要实现的设置,我需要做的就是添加另一个“分支”。如果我使用配置文件,我还需要向 pom.xml 文件添加一个新的配置文件。
如果我错了,请纠正我。配置文件似乎能够实现目标,但并不理想,至少在我的情况下。
小智 2
我强烈反对拥有 2 个(或更多)具有相同 GAV 的不同 pom 文件。
但我知道您的需求是由于遗留原因而提出的。我自己没有尝试过,但它可能有效:保留一个构建(= maven 项目),就像你现在拥有的那样。在另一个构建中,跳过正常部署并手动调用部署插件的部署文件目标,如下所示:
<build>
<plugins>
<!-- skip normal execution of deploy plugin -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<executions>
<execution>
<id>default-deploy</id>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
<!-- invoke with goal: deploy-file -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<executions>
<execution>
<id>someId</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<inherited>false</inherited>
<configuration>
<file>path-to-your-artifact-jar</file>
<generatePom>false</generatePom>
<artifactId>xxx</artifactId>
<groupId>xxx</groupId>
<version>xxx</version>
<classifier>xxx</classifier>
<packaging>xxx</packaging>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3122 次 |
| 最近记录: |