maven - Maven deploy:file 步骤:自动部署到快照或发布存储库
问题描述
我有以下部分pom.xml
<repositories>
<repository>
<id>maven-booking-snapshots</id>
<url>https://artifactory.booking.com/maven-booking-snapshots</url>
</repository>
<repository>
<id>maven-booking-releases</id>
<url>https://artifactory.booking.com/maven-booking-releases</url>
</repository>
<distributionManagement>
<snapshotRepository>
<id>maven-snapshots</id>
<name>Snapshot Repository</name>
<url>https://artifactory.com/maven-snapshots</url>
</snapshotRepository>
<repository>
<id>maven-releases</id>
<name>Release Repository</name>
<url>https://artifactory.com/maven-releases</url>
</repository>
</distributionManagement>
和
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>com.shaded.google</shadedPattern>
</relocation>
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>hidden.io.netty</shadedPattern>
</relocation>
</relocations>
<shadedArtifactAttached>false</shadedArtifactAttached>
</configuration>
</execution>
</executions>
</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>
当我运行该mvn deploy:file
文件时,该文件将始终上传到发布存储库中,并且(我认为)问题是<repository>
插件的标签指向project.distributionManagement.repository.url
. 同时,我无法指出它,project.distributionManagement.snapshotRepository
因为我希望部署目标取决于 pom 的版本。如何在部署插件的运行中实现这种灵活性?
解决方案
推荐阅读
- typescript - 带有 TypeScript 的 create-react-app 中的样式化组件 babel 插件?
- tinymce - 加载插件失败:来自 url 的 advlink
- laravel-5 - laravel 查询生成器 whereIn 获取重复数据
- drupal - Drupal 8 - 如何在提交网络表单后注销用户
- java - POST 响应 HTML 页面显示在调试器中,但不在使用 JAVAEE 的浏览器中
- intellij-idea - 在 pubspec.yaml 中导入 geoloaction 包时出错
- android - 播放 mediaFile 时权限被拒绝
- python - 在 python 3.7 中,为什么我的变量在我没有分配任何新内容的情况下被覆盖?
- mysql - 为每个用户选择一个值,即使没有 sql
- python - 使用 PyHive 和 SqlAlchemy 创建表