如何使用其他artifactId部署程序集? [英] How to deploy an assembly with an other artifactId?

查看:140
本文介绍了如何使用其他artifactId部署程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出一个具有单个模块(一个单独的pom.xml)的maven项目,是否可以使用maven-assembly-plugin(或另一个插件)来部署一个具有与当前pom之外的其他artifactId的zip文件?

Given a maven project with a single module (one single pom.xml) is it possible with maven-assembly-plugin (or an other plugin) to deploy a zip file with an other artifactId than the one of the current pom?

示例
myProject/pom.xml

Example
myProject/pom.xml

mvn package将产生:

  • myProject/target/myProjectActifactId-1.0.jar
  • myProject/target/something-1.0.zip

我希望mvn deploy在我的Nexus中部署两个具有不同artifactIds的文件:

And I want that mvn deploy deploys the two files with different artifactIds in my Nexus:

  • myGroupId/myProjectActifactId/1.0/myProjectActifactId-1.0.jar
  • myGroupId/something/1.0/something-1.0.zip

推荐答案

以下解决方案适用于需要在本地存储库中安装zip文件的情况. mvn clean package install:安装文件

Below solution works if you need to install zip file on the local repository. mvn clean package install:install-file

pom.xml文件如下所示

pom.xml file looks like below

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-install-plugin</artifactId>
    <version>2.5.2</version>
    <goals>
      <goal>install-file</goal>
    </goals>
    <configuration>
      <repositoryId>artifactory</repositoryId>
      <packaging>zip</packaging>
      <generatePom>true</generatePom>
      <artifactId>${project.artifactId}</artifactId>
      <groupId>${project.groupId}</groupId>
      <version>${zipfile.project.version}</version>
      <file>path-to-zip-file-created-by-assemblly </file>
    </configuration>
  </plugin>
</plugins>

如果需要将zip部署到远程存储库,则以下解决方案有效.

Below solution works if you need to deploy the zip to the remote repository.

mvn软件包deploy:deploy-file

mvn package deploy:deploy-file

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>2.6</version>
    <goals>
      <goal>deploy-file</goal>
    </goals>
    <configuration>
      <repositoryId>artifactory</repositoryId>
      <packaging>zip</packaging>
      <generatePom>true</generatePom>
      <url>${repository.url}</url>
      <artifactId>${project.artifactId}</artifactId>
      <groupId>${project.groupId}</groupId>
      <version>${zip.project.version}</version>
      <file>path-to-zip-file-created-by-assemblly</file>
    </configuration>
  </plugin>

这篇关于如何使用其他artifactId部署程序集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆