I have the following sections in my 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>
and
<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>
When I run the mvn deploy:file
the file is going to be uploaded always in the release repository and (I think) the problem is that the <repository>
tag of the plugin points to project.distributionManagement.repository.url
. At the same time, I cannot make it point to the project.distributionManagement.snapshotRepository
because I would like that the deployment destination depends on the version of the pom. How can I achieve such flexibility in the run of the deploy plugin?