Skip deployment when the project version is not consistent with the active profile.

This commit is contained in:
Manuele Simi 2019-06-11 22:43:32 -04:00
parent 2d0ad9bc35
commit 58c5232e6c
1 changed files with 319 additions and 217 deletions

102
pom.xml
View File

@ -130,6 +130,42 @@
<url>${repository.snapshots.readwrite}</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<!-- sets the only.when.is.snapshot.used property to true if SNAPSHOT was used,
to the project version otherwise -->
<id>build-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>skip.when.is.release.used</name>
<value>${project.version}</value>
<regex>^((?!.*-SNAPSHOT).)*$</regex>
<replacement>true</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>${skip.when.is.release.used}</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
@ -164,6 +200,41 @@
<url>${repository.snapshots.readwrite}</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<!-- sets the only.when.is.snapshot.used property to true if SNAPSHOT was used,
to the project version otherwise -->
<id>build-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>skip.when.is.release.used</name>
<value>${project.version}</value>
<regex>^((?!.*-SNAPSHOT).)*$</regex>
<replacement>true</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>${skip.when.is.release.used}</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
@ -233,6 +304,37 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<!-- sets the only.when.is.snapshot.used property to true if SNAPSHOT was used,
to the project version otherwise -->
<id>build-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>skip.when.is.snapshot.used</name>
<value>${project.version}</value>
<regex>.*-SNAPSHOT$</regex>
<replacement>true</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>${skip.when.is.snapshot.used}</skip>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}-${project.version}-${gcube.release.number}-${buildNumber}</finalName>
</build>