Sign artifacts during package phase in release profile

This commit is contained in:
Paul Campbell 2017-12-31 14:17:38 +00:00
parent 43c982f0dc
commit 63caf5bc05
2 changed files with 51 additions and 15 deletions

View file

@ -24,9 +24,17 @@ The POM defines the following items:
* `inceptionYear` * `inceptionYear`
* `licenses` * `licenses`
* `developers` * `developers`
* `distributionManagement`
The POM sets the following properties: The POM sets the following properties:
* `project.reporting.outputEncoding` as `UTF-8` * `project.reporting.outputEncoding` as `UTF-8`
* `java.version` as `1.8` * `java.version` as `1.8`
### Profile `release`
#### GPG Artifact Signing
Artifacts will be GPG signed during the `package` phase when the `release` profile is enabled.
#### Distribution Management
The Nexus Sonatype repositories are declared within `distributionManagement` when the `release` profile is enableds.

54
pom.xml
View file

@ -5,7 +5,7 @@
<groupId>net.kemitix</groupId> <groupId>net.kemitix</groupId>
<artifactId>kemitix-parent</artifactId> <artifactId>kemitix-parent</artifactId>
<version>5.0.2</version> <version>5.0.3</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Kemitix Parent</name> <name>Kemitix Parent</name>
@ -36,6 +36,7 @@
<properties> <properties>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
</properties> </properties>
<developers> <developers>
@ -47,17 +48,44 @@
</developer> </developer>
</developers> </developers>
<distributionManagement> <profiles>
<snapshotRepository> <profile>
<id>sonatype-nexus-snapshots</id> <id>release</id>
<name>Sonatype Nexus Snapshots</name> <build>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url> <plugins>
</snapshotRepository> <plugin>
<repository> <groupId>org.apache.maven.plugins</groupId>
<id>sonatype-nexus-staging</id> <artifactId>maven-gpg-plugin</artifactId>
<name>Nexus Release Repository</name> <version>${maven-gpg-plugin.version}</version>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> <configuration>
</repository> <passphrase>${gpg.passphrase}</passphrase>
</distributionManagement> </configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>package</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin><!-- maven-gpg-plugin -->
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<name>Nexus Release Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</profile>
</profiles><!-- release -->
</project> </project>