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

feature/22842
Roberto Cirillo 2 years ago
parent ae1f5edd64
commit d23a597fc6

@ -115,66 +115,57 @@
</plugins>
</build>
</profile>
<profile>
<id>gcube-default</id>
<activation>
<!-- This profile will automatically be active for all builds unless another profile in the POM is activated -->
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<java_version>1.8</java_version>
<maven.compiler.source>${java_version}</maven.compiler.source>
<maven.compiler.target>${java_version}</maven.compiler.target>
</properties>
<!-- Repositories for dependency resolution -->
<repositories>
<repository>
<id>gcube-snapshots</id>
<name>gCube Snapshots</name>
<url>${repository.snapshots.url}</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>gcube-releases</id>
<name>gCube Releases</name>
<url>${repository.releases.url}</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>gcube-externals</id>
<name>gCube Externals</name>
<url>${repository.externals.readonly}</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<!-- Repositories for deployments -->
<distributionManagement>
<repository>
<id>gcube-snapshots</id>
<name>gCube Snapshots</name>
<url>${repository.snapshots.url}</url>
</repository>
</distributionManagement>
<build>
<profile>
<id>common-snapshot-checks</id>
<activation>
<property>
<name>!Release</name>
</property>
</activation>
<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>
</plugins>
</build>
</profile>
<profile>
<id>common-release-checks</id>
<activation>
<property>
<name>Release</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@ -182,7 +173,7 @@
<version>${plugin.build.helper.version}</version>
<executions>
<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 -->
<id>build-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
@ -190,52 +181,32 @@
<goal>regex-property</goal>
</goals>
<configuration>
<name>skip.when.is.release.used</name>
<name>skip.when.is.snapshot.used</name>
<value>${project.version}</value>
<regex>^((?!-SNAPSHOT).)*$</regex>
<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>
<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>
</plugins>
</build>
</profile>
<profile>
<id>gcube-developer</id>
<activation>
@ -295,70 +266,8 @@
<url>${repository.snapshots.url}</url>
</repository>
</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>
<!-- Just a profile activation test for jdk > 8 -->
<!-- profile activated with jdk > 8 -->
<profile>
<id>gcube-developer-next</id>
<activation>
@ -374,7 +283,7 @@
<maven.compiler.target>${java_version}</maven.compiler.target>
</properties>
<!-- Repositories for dependency resolution -->
<!-- Repositories for dependency resolution -->
<repositories>
<repository>
<id>gcube-snapshots</id>
@ -410,7 +319,6 @@
</releases>
</repository>
</repositories>
<!-- Repositories for deployments -->
<distributionManagement>
<repository>
@ -419,99 +327,9 @@
<url>${repository.snapshots.url}</url>
</repository>
</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>
<!-- end test -->
<!-- Just a profile activation test for jdk 11 -->
<!-- The following profile prevent build with jdk minor than 8 -->
<profile>
<id>gcube-developer-old</id>
<activation>
@ -566,102 +384,10 @@
<url>${repository.snapshots.url}</url>
</repository>
</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>
<!-- end test -->
<profile>
<id>jenkins-releases</id>
<activation>
<jdk>[1.8,9)</jdk>
<property>
@ -710,60 +436,7 @@
</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.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>
<groupId>io.github.olivierlemasle.maven</groupId>
<artifactId>plaintext-maven-plugin</artifactId>
@ -793,9 +466,7 @@
</executions>
</plugin>
</plugins>
<finalName>${project.artifactId}-${project.version}</finalName>
</build>
</profile>
<profile>
@ -851,57 +522,6 @@
<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.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>
<groupId>io.github.olivierlemasle.maven</groupId>
<artifactId>plaintext-maven-plugin</artifactId>
@ -931,9 +551,7 @@
</executions>
</plugin>
</plugins>
<finalName>${project.artifactId}-${project.version}</finalName>
</build>
</profile>
<profile>
@ -1011,43 +629,6 @@
<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.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>io.github.olivierlemasle.maven</groupId>
<artifactId>plaintext-maven-plugin</artifactId>
@ -1076,48 +657,6 @@
</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>
<!-- 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>
<finalName>${project.artifactId}-${project.version}</finalName>
</build>
@ -1197,43 +736,6 @@
<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.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>io.github.olivierlemasle.maven</groupId>
<artifactId>plaintext-maven-plugin</artifactId>
@ -1262,20 +764,6 @@
</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>
</plugins>
<finalName>${project.artifactId}-${project.version}</finalName>
</build>
@ -1367,43 +855,6 @@
<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.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>io.github.olivierlemasle.maven</groupId>
<artifactId>plaintext-maven-plugin</artifactId>
@ -1432,25 +883,10 @@
</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>
</plugins>
<finalName>${project.artifactId}-${project.version}</finalName>
</build>
</profile>
<profile>
<id>dry-run</id>
<activation>
@ -1476,10 +912,7 @@
</build>
</profile>
</profiles>
<build>
<pluginManagement>
<plugins>
<plugin>

Loading…
Cancel
Save