add two common profiles: common-release-checks, common-snapshot-checks

This commit is contained in:
Roberto Cirillo 2022-02-25 16:01:15 +01:00
parent ae1f5edd64
commit d23a597fc6
1 changed files with 74 additions and 641 deletions

715
pom.xml
View File

@ -115,66 +115,57 @@
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile>
<id>common-snapshot-checks</id>
<profile> <activation>
<id>gcube-default</id> <property>
<activation> <name>!Release</name>
<!-- This profile will automatically be active for all builds unless another profile in the POM is activated --> </property>
<activeByDefault>true</activeByDefault> </activation>
</activation> <build>
<properties> <plugins>
<java_version>1.8</java_version> <plugin>
<maven.compiler.source>${java_version}</maven.compiler.source> <groupId>org.codehaus.mojo</groupId>
<maven.compiler.target>${java_version}</maven.compiler.target> <artifactId>build-helper-maven-plugin</artifactId>
</properties> <version>${plugin.build.helper.version}</version>
<!-- Repositories for dependency resolution --> <executions>
<repositories> <execution>
<repository> <!-- sets the skip.when.is.release.used property to true if SNAPSHOT is NOT used,
<id>gcube-snapshots</id> to the project version otherwise -->
<name>gCube Snapshots</name> <id>build-helper-regex-is-snapshot-used</id>
<url>${repository.snapshots.url}</url> <phase>validate</phase>
<snapshots> <goals>
<enabled>true</enabled> <goal>regex-property</goal>
</snapshots> </goals>
<releases> <configuration>
<enabled>false</enabled> <name>skip.when.is.release.used</name>
</releases> <value>${project.version}</value>
</repository> <regex>^((?!-SNAPSHOT).)*$</regex>
<repository> <replacement>true</replacement>
<id>gcube-releases</id> <failIfNoMatch>false</failIfNoMatch>
<name>gCube Releases</name> </configuration>
<url>${repository.releases.url}</url> </execution>
<snapshots> </executions>
<enabled>false</enabled> </plugin>
</snapshots> <plugin>
<releases> <groupId>org.apache.maven.plugins</groupId>
<enabled>true</enabled> <artifactId>maven-deploy-plugin</artifactId>
</releases> <version>${plugin.deploy.version}</version>
</repository> <configuration>
<repository> <skip>${skip.when.is.release.used}</skip>
<id>gcube-externals</id> </configuration>
<name>gCube Externals</name> </plugin>
<url>${repository.externals.readonly}</url> </plugins>
<snapshots> </build>
<enabled>false</enabled> </profile>
</snapshots> <profile>
<releases> <id>common-release-checks</id>
<enabled>true</enabled> <activation>
</releases> <property>
</repository> <name>Release</name>
</repositories> </property>
</activation>
<!-- Repositories for deployments --> <build>
<distributionManagement>
<repository>
<id>gcube-snapshots</id>
<name>gCube Snapshots</name>
<url>${repository.snapshots.url}</url>
</repository>
</distributionManagement>
<build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
@ -182,7 +173,7 @@
<version>${plugin.build.helper.version}</version> <version>${plugin.build.helper.version}</version>
<executions> <executions>
<execution> <execution>
<!-- sets the skip.when.is.release.used property to true if SNAPSHOT is NOT used, <!-- sets the skip.when.is.snapshot.used property to true if SNAPSHOT was used,
to the project version otherwise --> to the project version otherwise -->
<id>build-helper-regex-is-snapshot-used</id> <id>build-helper-regex-is-snapshot-used</id>
<phase>validate</phase> <phase>validate</phase>
@ -190,52 +181,32 @@
<goal>regex-property</goal> <goal>regex-property</goal>
</goals> </goals>
<configuration> <configuration>
<name>skip.when.is.release.used</name> <name>skip.when.is.snapshot.used</name>
<value>${project.version}</value> <value>${project.version}</value>
<regex>^((?!-SNAPSHOT).)*$</regex> <regex>.*-SNAPSHOT$</regex>
<replacement>true</replacement> <replacement>true</replacement>
<failIfNoMatch>false</failIfNoMatch> <failIfNoMatch>false</failIfNoMatch>
</configuration> </configuration>
</execution> </execution>
<execution>
<!--fails if SNAPSHOT was used-->
<id>fail-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>fail.when.is.snapshot.used</name>
<value>${project.version}</value>
<regex>^((?!.*-SNAPSHOT).)*$</regex>
<failIfNoMatch>true</failIfNoMatch>
</configuration>
</execution>
</executions> </executions>
</plugin> </plugin>
<plugin> </plugins>
<groupId>org.apache.maven.plugins</groupId> </build>
<artifactId>maven-deploy-plugin</artifactId> </profile>
<version>${plugin.deploy.version}</version>
<configuration>
<skip>${skip.when.is.release.used}</skip>
</configuration>
</plugin>
<!-- following plugins added just for test they were configured globally -->
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<defaults>
<name>tag</name>
</defaults>
<source>
def fileContents = new File("${project.basedir}/CHANGELOG.md").getText('UTF-8')
matcher = (fileContents =~ /(?s).\[v$project.version\].*?/)
if (!matcher.find()) {
throw new IllegalArgumentException("Tag [v$project.version] not found in ${project.basedir}/CHANGELOG.md")
}
assert matcher[0][1]: "Tag [v$project.version] not found in ${project.basedir}/CHANGELOG.md"
</source>
</configuration>
</execution>
</executions>
</plugin> </plugins>
</build>
</profile>
<profile> <profile>
<id>gcube-developer</id> <id>gcube-developer</id>
<activation> <activation>
@ -295,70 +266,8 @@
<url>${repository.snapshots.url}</url> <url>${repository.snapshots.url}</url>
</repository> </repository>
</distributionManagement> </distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${plugin.build.helper.version}</version>
<executions>
<execution>
<!-- sets the skip.when.is.release.used property to true if SNAPSHOT is NOT 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>${plugin.deploy.version}</version>
<configuration>
<skip>${skip.when.is.release.used}</skip>
</configuration>
</plugin>
<!-- following plugins added just for test they were configured globally -->
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<defaults>
<name>tag</name>
</defaults>
<source>
def fileContents = new File("${project.basedir}/CHANGELOG.md").getText('UTF-8')
matcher = (fileContents =~ /(?s).\[v$project.version\].*?/)
if (!matcher.find()) {
throw new IllegalArgumentException("Tag [v$project.version] not found in ${project.basedir}/CHANGELOG.md")
}
assert matcher[0][1]: "Tag [v$project.version] not found in ${project.basedir}/CHANGELOG.md"
</source>
</configuration>
</execution>
</executions>
</plugin> </plugins>
</build>
</profile> </profile>
<!-- Just a profile activation test for jdk > 8 --> <!-- profile activated with jdk > 8 -->
<profile> <profile>
<id>gcube-developer-next</id> <id>gcube-developer-next</id>
<activation> <activation>
@ -374,7 +283,7 @@
<maven.compiler.target>${java_version}</maven.compiler.target> <maven.compiler.target>${java_version}</maven.compiler.target>
</properties> </properties>
<!-- Repositories for dependency resolution --> <!-- Repositories for dependency resolution -->
<repositories> <repositories>
<repository> <repository>
<id>gcube-snapshots</id> <id>gcube-snapshots</id>
@ -410,7 +319,6 @@
</releases> </releases>
</repository> </repository>
</repositories> </repositories>
<!-- Repositories for deployments --> <!-- Repositories for deployments -->
<distributionManagement> <distributionManagement>
<repository> <repository>
@ -419,99 +327,9 @@
<url>${repository.snapshots.url}</url> <url>${repository.snapshots.url}</url>
</repository> </repository>
</distributionManagement> </distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${plugin.build.helper.version}</version>
<executions>
<execution>
<!-- sets the skip.when.is.release.used property to true if SNAPSHOT is NOT 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>${plugin.deploy.version}</version>
<configuration>
<skip>${skip.when.is.release.used}</skip>
</configuration>
</plugin>
<!-- following plugins added just for test they were configured globally -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${plugin.enforcer.version}</version>
<executions>
<execution>
<id>enforce</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>[${maven.version},)</version>
<message>Check for Maven version &gt;=${maven.version} failed. Update your Maven
install.
</message>
</requireMavenVersion>
<requireJavaVersion>
<version>[11,)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<defaults>
<name>tag</name>
</defaults>
<source>
def fileContents = new File("${project.basedir}/CHANGELOG.md").getText('UTF-8')
matcher = (fileContents =~ /(?s).\[v$project.version\].*?/)
if (!matcher.find()) {
throw new IllegalArgumentException("Tag [v$project.version] not found in ${project.basedir}/CHANGELOG.md")
}
assert matcher[0][1]: "Tag [v$project.version] not found in ${project.basedir}/CHANGELOG.md"
</source>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile> </profile>
<!-- end test --> <!-- end test -->
<!-- Just a profile activation test for jdk 11 --> <!-- The following profile prevent build with jdk minor than 8 -->
<profile> <profile>
<id>gcube-developer-old</id> <id>gcube-developer-old</id>
<activation> <activation>
@ -566,102 +384,10 @@
<url>${repository.snapshots.url}</url> <url>${repository.snapshots.url}</url>
</repository> </repository>
</distributionManagement> </distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${plugin.build.helper.version}</version>
<executions>
<execution>
<!-- sets the skip.when.is.release.used property to true if SNAPSHOT is NOT 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>${plugin.deploy.version}</version>
<configuration>
<skip>${skip.when.is.release.used}</skip>
</configuration>
</plugin>
<!-- following plugins added just for test they were configured globally -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${plugin.enforcer.version}</version>
<executions>
<execution>
<id>enforce</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>[${maven.version},)</version>
<message>Check for Maven version &gt;=${maven.version} failed. Update your Maven
install.
</message>
</requireMavenVersion>
<requireJavaVersion>
<version>[1.8,)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<defaults>
<name>tag</name>
</defaults>
<source>
def fileContents = new File("${project.basedir}/CHANGELOG.md").getText('UTF-8')
matcher = (fileContents =~ /(?s).\[v$project.version\].*?/)
if (!matcher.find()) {
throw new IllegalArgumentException("Tag [v$project.version] not found in ${project.basedir}/CHANGELOG.md")
}
assert matcher[0][1]: "Tag [v$project.version] not found in ${project.basedir}/CHANGELOG.md"
</source>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile> </profile>
<!-- end test --> <!-- end test -->
<profile> <profile>
<id>jenkins-releases</id> <id>jenkins-releases</id>
<activation> <activation>
<jdk>[1.8,9)</jdk> <jdk>[1.8,9)</jdk>
<property> <property>
@ -710,60 +436,7 @@
</distributionManagement> </distributionManagement>
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${plugin.build.helper.version}</version>
<executions>
<execution>
<!-- sets the skip.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>
<execution>
<!--fails if SNAPSHOT was used-->
<id>fail-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>fail.when.is.snapshot.used</name>
<value>${project.version}</value>
<regex>^((?!.*-SNAPSHOT).)*$</regex>
<failIfNoMatch>true</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${plugin.deploy.version}</version>
<executions>
<execution>
<id>fail-if-snapshot-used</id>
<phase>deploy</phase>
<configuration>
<skip>${skip.when.is.snapshot.used}</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>io.github.olivierlemasle.maven</groupId> <groupId>io.github.olivierlemasle.maven</groupId>
<artifactId>plaintext-maven-plugin</artifactId> <artifactId>plaintext-maven-plugin</artifactId>
@ -793,9 +466,7 @@
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
<finalName>${project.artifactId}-${project.version}</finalName> <finalName>${project.artifactId}-${project.version}</finalName>
</build> </build>
</profile> </profile>
<profile> <profile>
@ -851,57 +522,6 @@
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${plugin.build.helper.version}</version>
<executions>
<execution>
<!-- sets the skip.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>
<execution>
<!--fails if SNAPSHOT was used-->
<id>fail-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>fail.when.is.snapshot.used</name>
<value>${project.version}</value>
<regex>^((?!.*-SNAPSHOT).)*$</regex>
<failIfNoMatch>true</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${plugin.deploy.version}</version>
<executions>
<execution>
<id>fail-if-snapshot-used</id>
<phase>deploy</phase>
<configuration>
<skip>${skip.when.is.snapshot.used}</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>io.github.olivierlemasle.maven</groupId> <groupId>io.github.olivierlemasle.maven</groupId>
<artifactId>plaintext-maven-plugin</artifactId> <artifactId>plaintext-maven-plugin</artifactId>
@ -931,9 +551,7 @@
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
<finalName>${project.artifactId}-${project.version}</finalName> <finalName>${project.artifactId}-${project.version}</finalName>
</build> </build>
</profile> </profile>
<profile> <profile>
@ -1011,43 +629,6 @@
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${plugin.build.helper.version}</version>
<executions>
<execution>
<!-- sets the skip.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>
<execution>
<!--fails if SNAPSHOT was used-->
<id>fail-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>fail.when.is.snapshot.used</name>
<value>${project.version}</value>
<regex>^((?!.*-SNAPSHOT).)*$</regex>
<failIfNoMatch>true</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>io.github.olivierlemasle.maven</groupId> <groupId>io.github.olivierlemasle.maven</groupId>
<artifactId>plaintext-maven-plugin</artifactId> <artifactId>plaintext-maven-plugin</artifactId>
@ -1076,48 +657,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${plugin.deploy.version}</version>
<executions>
<execution>
<id>fail-if-snapshot-used</id>
<phase>deploy</phase>
<configuration>
<skip>${skip.when.is.snapshot.used}</skip>
</configuration>
</execution>
</executions>
</plugin>
<!-- following plugins added just for test they were configured globally -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${plugin.enforcer.version}</version>
<executions>
<execution>
<id>enforce</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>[${maven.version},)</version>
<message>Check for Maven version &gt;=${maven.version} failed. Update your Maven
install.
</message>
</requireMavenVersion>
<requireJavaVersion>
<version>[1.8,)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
<finalName>${project.artifactId}-${project.version}</finalName> <finalName>${project.artifactId}-${project.version}</finalName>
</build> </build>
@ -1197,43 +736,6 @@
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${plugin.build.helper.version}</version>
<executions>
<execution>
<!-- sets the skip.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>
<execution>
<!--fails if SNAPSHOT was used-->
<id>fail-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>fail.when.is.snapshot.used</name>
<value>${project.version}</value>
<regex>^((?!.*-SNAPSHOT).)*$</regex>
<failIfNoMatch>true</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>io.github.olivierlemasle.maven</groupId> <groupId>io.github.olivierlemasle.maven</groupId>
<artifactId>plaintext-maven-plugin</artifactId> <artifactId>plaintext-maven-plugin</artifactId>
@ -1262,20 +764,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${plugin.deploy.version}</version>
<executions>
<execution>
<id>fail-if-snapshot-used</id>
<phase>deploy</phase>
<configuration>
<skip>${skip.when.is.snapshot.used}</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
<finalName>${project.artifactId}-${project.version}</finalName> <finalName>${project.artifactId}-${project.version}</finalName>
</build> </build>
@ -1367,43 +855,6 @@
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${plugin.build.helper.version}</version>
<executions>
<execution>
<!-- sets the skip.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>
<execution>
<!--fails if SNAPSHOT was used-->
<id>fail-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>fail.when.is.snapshot.used</name>
<value>${project.version}</value>
<regex>^((?!.*-SNAPSHOT).)*$</regex>
<failIfNoMatch>true</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>io.github.olivierlemasle.maven</groupId> <groupId>io.github.olivierlemasle.maven</groupId>
<artifactId>plaintext-maven-plugin</artifactId> <artifactId>plaintext-maven-plugin</artifactId>
@ -1432,25 +883,10 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${plugin.deploy.version}</version>
<executions>
<execution>
<id>fail-if-snapshot-used</id>
<phase>deploy</phase>
<configuration>
<skip>${skip.when.is.snapshot.used}</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
<finalName>${project.artifactId}-${project.version}</finalName> <finalName>${project.artifactId}-${project.version}</finalName>
</build> </build>
</profile> </profile>
<profile> <profile>
<id>dry-run</id> <id>dry-run</id>
<activation> <activation>
@ -1476,10 +912,7 @@
</build> </build>
</profile> </profile>
</profiles> </profiles>
<build> <build>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin> <plugin>