#16 - Added Maven Central distribution

Introduced properties for GPG plugin and forward them to the execution of the release build. Public release versions now trigger the "central" profile being used which will enable the Nexus repository distribution.

Renamed GitCommands.checkout(…) to update(…). Made sure that project release build execution now also authenticates with Artifactory beforehand.
This commit is contained in:
Oliver Gierke
2016-03-31 18:45:46 +02:00
parent cc257acee7
commit e62c76b167
6 changed files with 34 additions and 3 deletions

View File

@@ -8,4 +8,11 @@ git.password=
maven.mavenHome=
# Deployment
deployment.repository-prefix=
deployment.password=
deployment.api-key=
# GPG
deployment.gpg.keyname=
deployment.gpg.password=
# deployment.gpg.executable=/usr/local/bin/gpg2

View File

@@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.data.release.deployment.DeploymentInformation;
import org.springframework.data.release.deployment.DeploymentProperties;
import org.springframework.data.release.deployment.DeploymentProperties.Gpg;
import org.springframework.data.release.io.Workspace;
import org.springframework.data.release.model.ArtifactVersion;
import org.springframework.data.release.model.ModuleIteration;
@@ -247,7 +248,7 @@ class MavenBuildSystem implements BuildSystem {
List<String> arguments = new ArrayList<>();
arguments.add("clean");
arguments.add("deploy");
arguments.add("-Pci,release");
arguments.add("-Pci,release".concat(module.getIteration().isPublic() ? ",central" : ""));
arguments.add("-DskipTests");
@@ -258,6 +259,15 @@ class MavenBuildSystem implements BuildSystem {
arguments.add("-Dartifactory.build-name=\"".concat(information.getBuildName()).concat("\""));
arguments.add("-Dartifactory.build-number=".concat(information.getBuildNumber()));
if (module.getIteration().isPublic()) {
Gpg gpg = properties.getGpg();
arguments.add("-Dgpg.executable=".concat(gpg.getExecutable()));
arguments.add("-Dgpg.keyname=".concat(gpg.getKeyname()));
arguments.add("-Dgpg.password=".concat(gpg.getPassword()));
}
mvn.execute(module.getProject(), arguments);
return information;

View File

@@ -95,6 +95,8 @@ public class ReleaseCommands implements CommandMarker {
if (projectName != null) {
deployment.verifyAuthentication();
Project project = Projects.byName(projectName);
ModuleIteration module = iteration.getModule(project);

View File

@@ -57,6 +57,8 @@ public class DeploymentProperties {
private String repositoryPrefix = "";
private Gpg gpg;
public String getStagingRepository() {
return repositoryPrefix.concat(stagingRepository);
}
@@ -105,4 +107,9 @@ public class DeploymentProperties {
return URI.create(uri.concat(VERIFICATION_RESOURCE));
}
}
@Data
public static class Gpg {
private String keyname, password, executable;
}
}

View File

@@ -57,7 +57,7 @@ public class GitCommands implements CommandMarker {
}
@CliCommand("git update")
public void checkout(@CliOption(key = { "", "train" }, mandatory = true) String trainName)
public void update(@CliOption(key = { "", "train" }, mandatory = true) String trainName)
throws Exception, InterruptedException {
git.update(ReleaseTrains.getTrainByName(trainName));
}

View File

@@ -7,4 +7,9 @@ maven.plugins.versions=org.codehaus.mojo:versions-maven-plugin:2.2
deployment.server.uri=https://repo.spring.io
deployment.staging-repository=libs-staging-local
deployment.username=buildmaster
#deployment.password <- local
#deployment.password <- local
# GPG setup
deployment.gpg.executable=/usr/local/bin/gpg2
# deployment.gpg.keyname
# deployment.gpg.password