Add profile to release project to Maven Centran repository

This commit is contained in:
etorres
2016-01-04 17:27:18 +01:00
parent 25b8ad9ea6
commit c4db79fdd6
7 changed files with 101 additions and 94 deletions
+4 -1
View File
@@ -6,10 +6,13 @@ Utilities to facilitate Java applications development.
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/grycap/coreutils/blob/master/LICENSE)
[![Build Status](https://api.travis-ci.org/grycap/coreutils.svg)](https://travis-ci.org/grycap/coreutils/builds)
[![Coverage Status](https://coveralls.io/repos/grycap/coreutils/badge.svg?branch=master&service=github)](https://coveralls.io/github/grycap/coreutils?branch=master)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/es.upv.grycap.coreutils/coreutils/badge.svg)](https://maven-badges.herokuapp.com/maven-central/es.upv.grycap.coreutils/coreutils)
## Environment variables
``GRYCAP_TESTS_PRINT_OUTPUT`` set value to ``true`` to print tests output.
``grycap.tests.print.out`` set value to ``true`` to print tests output.
``grycap.deploy.release`` set value to ``true`` to release the project to the Maven Central repository.
## Installation
@@ -115,6 +115,7 @@ public enum CoreutilsContext {
/**
* Gets a client from the registry.
* @param <T> - specific type of client
* @param type - the expected type of client
* @return An instance that matches the specified type, or <tt>null</tt> if no instance with the specified properties is
* found in the registry.
@@ -126,6 +127,7 @@ public enum CoreutilsContext {
/**
* Gets a client from the registry. Callers can optionally specify a classifier.
* @param <T> - specific type of client
* @param type - the expected type of client
* @param classifier - (optional) only clients matching the classifier will be selected
* @return An instance that matches the specified type and classifier, or <tt>null</tt> if no instance with the specified
@@ -138,7 +140,8 @@ public enum CoreutilsContext {
/**
* Gets a client from the registry. In case that no instance with the specified properties is found in the registry, the
* optional supplier will be used to create a new instance that will be registered.
* optional supplier will be used to create a new instance that will be registered.
* @param <T> - specific type of client
* @param type - the expected type of client
* @param supplier - (optional) client factory
* @return An instance that matches the specified type, or a new instance created with the supplier if no instance with
@@ -152,6 +155,7 @@ public enum CoreutilsContext {
/**
* Gets a client from the registry. Callers can optionally specify a classifier. In case that no instance with the specified
* properties is found in the registry, the optional supplier will be used to create a new instance that will be registered.
* @param <T> - specific type of client
* @param type - the expected type of client
* @param classifier - (optional) only clients matching the classifier will be selected
* @param supplier - (optional) client factory
@@ -165,6 +169,7 @@ public enum CoreutilsContext {
/**
* Registers a new shutdown listener for the specified type.
* @param <T> - specific type of shutdown listener
* @param listener - the listener that will be registered
* @param type - the type of the shutdown listener
*/
@@ -174,6 +179,7 @@ public enum CoreutilsContext {
/**
* Registers a new shutdown listener for the specified type with an optional classifier.
* @param <T> - specific type of shutdown listener
* @param listener - the listener that will be registered
* @param type - the type of the shutdown listener
* @param classifier - (optional) add this classifier to the registry
@@ -186,6 +192,7 @@ public enum CoreutilsContext {
/**
* Unregister a shutdown listener.
* @param <T> - specific type of shutdown listener
* @param type - the type of the shutdown listener
*/
public <T extends ShutdownListener> void removeShutdownListener(final Class<T> type) {
@@ -194,6 +201,7 @@ public enum CoreutilsContext {
/**
* Unregister a shutdown listener.
* @param <T> - specific type of shutdown listener
* @param type - the type of the shutdown listener
* @param classifier - (optional) classifier
*/
@@ -52,6 +52,7 @@ public class ShutdownHook {
/**
* Creates an instance of this class and registers it with the JVM.
* @param waitTerminationTimeout - will wait this time on JVM shutdown before raising a timeout exception
*/
public ShutdownHook(final long waitTerminationTimeout) {
final long waitTerminationTimeout2 = WAIT_TERMINATION_TIMEOUT_RANGE.contains(waitTerminationTimeout) ? waitTerminationTimeout
@@ -32,7 +32,7 @@ public interface ShutdownListener {
/**
* Gets the status of the listener. Implementations should check that the value returned by this method is <tt>true</tt> before entering the stop sequence.
* @return
* @return the current status of this listener
*/
boolean isRunning();
@@ -86,6 +86,7 @@ public class TaskRunner implements ShutdownListener {
/**
* Submits a new task for execution to the pool of threads managed by this class.
* @param <T> - specific type of supplier
* @param supplier - a function returning the value to be used to complete the returned {@link CompletableFuture}
* @return a {@link CompletableFuture} that the caller can use to track the execution of the task and to register a callback function.
*/
+81 -90
View File
@@ -227,34 +227,82 @@ that you distribute must include a readable copy of the "NOTICE" text file.
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>silent</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>sign-release-artifacts</id>
<activation>
<property>
<name>grycap.deploy.release</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<!-- Generate project's sources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Generate API documentation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Sign the generated components -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Configure release deployment to the OSSRH Nexus server with the Nexus Staging Maven plugin -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<pluginManagement>
<plugins>
<!-- Prevent Eclipse from executing unnecessary plugins during development -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>${m2e.lifecycle-mapping.version}</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>enforce</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugins>
<!-- Maven Compiler Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -354,17 +402,7 @@ that you distribute must include a readable copy of the "NOTICE" text file.
<quiet>true</quiet>
</configuration>
</plugin>
<!-- TODO -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
</plugin>
<!-- Configure plugins used in the deployment phase -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
@@ -380,6 +418,11 @@ that you distribute must include a readable copy of the "NOTICE" text file.
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.6</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
@@ -393,59 +436,7 @@ that you distribute must include a readable copy of the "NOTICE" text file.
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>4.0.0</version>
</plugin>
<!-- Generate project's sources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Generate API documentation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Sign the generated components -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Configure release deployment to the OSSRH Nexus server with the Nexus Staging Maven plugin -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.6</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugin>
</plugins>
</build>
+4 -1
View File
@@ -33,6 +33,9 @@
# http://central.sonatype.org/pages/apache-maven.html
# http://central.sonatype.org/pages/ossrh-guide.html
#
# Note that if autoReleaseAfterClose value is set to true in your POM file,
# then the project will be also released to the Maven Central Repository.
#
# Recommended use: 1) change to the root directory of your project; and
# 2) execute this script.
###
@@ -42,7 +45,7 @@ read -p "Confirm deployment of current Maven project to OSSRH (yes/no)? "
if [ "$REPLY" == "yes" ] ; then
ssh-add ~/.ssh/id_rsa
ssh-add -l
mvn clean deploy | tee target/ossrh-deploy.log
mvn -Dgrycap.deploy.release=true clean deploy | tee ossrh-deploy.log
ssh-add -D
else
echo "Exit without deploy"