Maven:如何使用发布插件部署两个工件?
Maven: how can I deploy two artifacts with the release plugin?
我的项目生成两个 jar:original-artifact-name.jar
和 artifact-name.jar
(我有 shade 插件设置)。
我想使用 mvn release:prepare
和 mvn release:perform
,不仅可以部署简单的 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>
如果要部署其他文件,可以在 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>
</executions>
</plugin>
我的项目生成两个 jar:original-artifact-name.jar
和 artifact-name.jar
(我有 shade 插件设置)。
我想使用 mvn release:prepare
和 mvn release:perform
,不仅可以部署简单的 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>
如果要部署其他文件,可以在 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>
</executions>
</plugin>