Urs*_*pke 2 deployment maven maven-assembly-plugin maven-deploy-plugin
在我的Maven构建结束时,为此明确目的而存在的一个模块从各种其他模块收集工件,并使用Assembly插件将它们压缩到存档中.完成后,它使用Deploy插件将它们部署到Nexus.
由于历史原因,此包装模块被调用bundle,因此工件最终被调用,因此mygroup:bundle被归类为Nexus.
我宁愿让它们显示在下面mygroup:myprojectname,但我无法弄清楚如何将它们部署到该位置.我已经尝试配置Deploy插件的deploy-file目标来更改坐标,但没有成功.作为一个额外的复杂功能,项目的主代码模块已被调用myprojectname,因此该组在部署时不为空.但是,由于分类器和类型,不需要覆盖任何内容.
没有重命名模块,我能以某种方式这样做吗?
deploy插件具有所有必需的功能:
您可以在其配置中设置G/A/V坐标,并将任意数量的其他工件部署到您想要的任何坐标.但是,它不会自动部署到您的distributionManagement部分中给出的存储库URL .
为了避免重复,我最终使用GMaven插件,用它来检查项目版本(它是否结束-SNAPSHOT)并设置一个新属性,其URL直接取自相应的部分distributionManagement.
这是两个插件的配置:
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<id>choose-target-repository</id>
<phase>initialize</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
if (project.version.endsWith("-SNAPSHOT")){
project.properties.targetrepository = project.distributionManagement.snapshotRepository.url;
}
else {
project.properties.targetrepository = project.distributionManagement.repository.url;
}
</source>
</configuration>
</execution>
</executions>
Run Code Online (Sandbox Code Playgroud)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>deploy-myclassifier</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<file>
${project.build.directory}/${project.artifactId}-${project.version}-myclassifier.zip
</file>
<groupId>${project.groupId}</groupId>
<artifactId>myprojectname</artifactId>
<version>${project.version}</version>
<classifier>myclassifier</classifier>
<repositoryId>nexus</repositoryId>
<url>http://url-to-nexus</url>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2694 次 |
| 最近记录: |