Maven:如何使用release插件部署两个工件?

问题描述 投票:1回答:1

我的项目生成两个jar:original-artifact-name.jarartifact-name.jar(我有阴影插件设置)。我想使用mvn release:preparemvn release:perform,不仅可以部署简单的jar,也可以部署原始jar。

到目前为止,我在执行发布插件后手动调用mave deploy:file目标。如何在发布插件执行中合并此步骤?

编辑:这是我与maven-deploy-plugin的尝试:

<plugin>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>2.8.2</version>
    <executions>
    <execution>
      <id>deploy-nodeps</id>
        <goals>
          <goal>deploy-file</goal>
        </goals>
        <phase>deploy</phase>
        <configuration>
          <file>${basedir}/target/original-${project.artifactId}-${project.version}.jar</file>
          <groupId>${project.groupId}</groupId>
          <artifactId>${project.artifactId}</artifactId>
          <version>${project.version}</version>
          <classifier>nodeps</classifier>
          <url>${project.distributionManagement.repository.url}</url>
          <repositoryId>${project.distributionManagement.repository.id}</repositoryId>
        </configuration>
      </execution>
    </executions>
  </plugin>

由于某些原因,在快照存储库中部署主jar,而nodeps jar在发布存储库中。这是我的存储库设置

<repositories>
<repository>
  <id>maven-snapshots</id>
  <url>https://repo.com/maven-snapshots</url>
</repository>
<repository>
  <id>maven-releases</id>
  <url>https://repo.com/maven-releases</url>
</repository>

maven maven-release-plugin
1个回答
2
投票

如果要部署其他文件,可以在POM中配置deploy:deploy-file目标。

  <plugin>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>3.0.0-M1</version>
    <executions>
      <execution>
        <id>deploy-bo</id>
        <goals>
          <goal>deploy-file</goal>
        </goals>
        <phase>deploy</phase>
        <configuration>
          <file>${basedir}/target/bo.jar</file>
          <pomFile>${basedir}/target/somewhere/pom-bo.xml</pomFile>
          <url>${project.distributionManagementArtifactRepository.url}</url>
          <repositoryId>${project.distributionManagementArtifactRepository.id}</repositoryId>
        </configuration>
      </execution>
  </plugin>
© www.soinside.com 2019 - 2024. All rights reserved.