This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-release-plugin.git
The following commit(s) were added to refs/heads/master by this push: new 9e88aea Use the file name as the key in sha512.properties. Add groupId to test stubs. 9e88aea is described below commit 9e88aeae179c01cad1c9e0c94b9d9b0ed5ec3f24 Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Sun Apr 7 10:04:00 2019 -0400 Use the file name as the key in sha512.properties. Add groupId to test stubs. --- .../mojos/CommonsDistributionDetachmentMojo.java | 9 +-- .../mojos/CommonsDistributionStagingMojo.java | 3 +- .../plugin/mojos/CommonsSiteCompressionMojo.java | 6 +- .../plugin/mojos/CommonsStagingCleanupMojo.java | 6 +- .../stubs/DistributionDetachmentProjectStub.java | 76 ++++++++++++---------- 5 files changed, 53 insertions(+), 47 deletions(-) diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java index 9c54c1e..48eeccf 100755 --- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java +++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java @@ -256,13 +256,6 @@ public class CommonsDistributionDetachmentMojo extends AbstractMojo { * @return the generated key */ private String getArtifactKey(final Artifact artifact) { - final StringBuilder artifactKey = new StringBuilder(); - artifactKey.append(artifact.getArtifactId()).append('-') - .append(artifact.getVersion()).append('-'); - if (artifact.hasClassifier()) { - artifactKey.append(artifact.getClassifier()).append('-'); - } - artifactKey.append(artifact.getType()); - return artifactKey.toString(); + return artifact.getFile().getName(); } } diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java index 6b7d87f..f7df5dd 100755 --- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java +++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java @@ -204,7 +204,8 @@ public class CommonsDistributionStagingMojo extends AbstractMojo { scmManager.setScmProvider("svn", new SvnExeScmProvider()); final ScmRepository repository = scmManager.makeScmRepository(distSvnStagingUrl); final ScmProvider provider = scmManager.getProviderByRepository(repository); - final SvnScmProviderRepository providerRepository = (SvnScmProviderRepository) repository.getProviderRepository(); + final SvnScmProviderRepository providerRepository = (SvnScmProviderRepository) repository + .getProviderRepository(); SharedFunctions.setAuthentication( providerRepository, distServer, diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java index 4afc774..9bb55f6 100755 --- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java +++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java @@ -157,7 +157,8 @@ public class CommonsSiteCompressionMojo extends AbstractMojo { * {@link CommonsSiteCompressionMojo#getAllSiteFiles(File, List)}. * @throws IOException when the copying of the files goes incorrectly. */ - private void writeZipFile(final File outputDirectory, final File directoryToZip, final List<File> fileList) throws IOException { + private void writeZipFile(final File outputDirectory, final File directoryToZip, final List<File> fileList) + throws IOException { try (FileOutputStream fos = new FileOutputStream(outputDirectory.getAbsolutePath() + "/site.zip"); ZipOutputStream zos = new ZipOutputStream(fos)) { for (final File file : fileList) { @@ -182,7 +183,8 @@ public class CommonsSiteCompressionMojo extends AbstractMojo { try (FileInputStream fis = new FileInputStream(file)) { // we want the zipEntry's path to be a relative path that is relative // to the directory being zipped, so chop off the rest of the path - final String zipFilePath = file.getCanonicalPath().substring(directoryToZip.getCanonicalPath().length() + 1, + final String zipFilePath = file.getCanonicalPath().substring( + directoryToZip.getCanonicalPath().length() + 1, file.getCanonicalPath().length()); final ZipEntry zipEntry = new ZipEntry(zipFilePath); zos.putNextEntry(zipEntry); diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsStagingCleanupMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsStagingCleanupMojo.java index 3da1181..c9a89ae 100644 --- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsStagingCleanupMojo.java +++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsStagingCleanupMojo.java @@ -151,7 +151,8 @@ public class CommonsStagingCleanupMojo extends AbstractMojo { scmManager.setScmProvider("svn", new SvnExeScmProvider()); final ScmRepository repository = scmManager.makeScmRepository(distSvnStagingUrl); final ScmProvider provider = scmManager.getProviderByRepository(repository); - final SvnScmProviderRepository providerRepository = (SvnScmProviderRepository) repository.getProviderRepository(); + final SvnScmProviderRepository providerRepository = (SvnScmProviderRepository) repository + .getProviderRepository(); SharedFunctions.setAuthentication( providerRepository, distServer, @@ -174,7 +175,8 @@ public class CommonsStagingCleanupMojo extends AbstractMojo { } if (!dryRun) { final ScmFileSet fileSet = new ScmFileSet(distCleanupDirectory, filesToRemove); - final RemoveScmResult removeScmResult = provider.remove(repository, fileSet, "Cleaning up staging area"); + final RemoveScmResult removeScmResult = provider.remove(repository, fileSet, + "Cleaning up staging area"); if (!removeScmResult.isSuccess()) { throw new MojoFailureException("Failed to remove files from SCM: " + removeScmResult.getProviderMessage() diff --git a/src/test/java/org/apache/commons/release/plugin/stubs/DistributionDetachmentProjectStub.java b/src/test/java/org/apache/commons/release/plugin/stubs/DistributionDetachmentProjectStub.java index 26baec0..591a9fb 100755 --- a/src/test/java/org/apache/commons/release/plugin/stubs/DistributionDetachmentProjectStub.java +++ b/src/test/java/org/apache/commons/release/plugin/stubs/DistributionDetachmentProjectStub.java @@ -23,6 +23,7 @@ import java.util.List; import org.apache.commons.release.plugin.mojos.CommonsDistributionDetachmentMojoTest; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.testing.stubs.ArtifactStub; +import org.apache.maven.plugin.testing.stubs.DefaultArtifactHandlerStub; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import org.apache.maven.project.MavenProject; @@ -46,6 +47,11 @@ public class DistributionDetachmentProjectStub extends MavenProjectStub { } @Override + public String getGroupId() { + return "org.apache.commons"; + } + + @Override public String getVersion() { return "1.4"; } @@ -62,144 +68,144 @@ public class DistributionDetachmentProjectStub extends MavenProjectStub { new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4-bin.tar.gz"), "tar.gz", + "org.apache.commons", "commons-text", - "bin", - "1.4" + "bin", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4-bin.tar.gz.asc"), "tar.gz.asc", + "org.apache.commons", "commons-text", - "bin", - "1.4" + "bin", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4-bin.zip"), "zip", + "org.apache.commons", "commons-text", - "bin", - "1.4" + "bin", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4-bin.zip.asc"), "zip.asc", + "org.apache.commons", "commons-text", - "bin", - "1.4" + "bin", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4-src.tar.gz"), "tar.gz", + "org.apache.commons", "commons-text", - "src", - "1.4" + "src", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4-src.tar.gz.asc"), "tar.gz.asc", + "org.apache.commons", "commons-text", - "src", - "1.4" + "src", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4-src.zip"), "zip", + "org.apache.commons", "commons-text", - "src", - "1.4" + "src", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4-src.zip.asc"), "zip.asc", + "org.apache.commons", "commons-text", - "src", - "1.4" + "src", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4.jar"), "jar", + "org.apache.commons", "commons-text", - "jar", - "1.4" + "jar", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4.jar.asc"), "jar.asc", + "org.apache.commons", "commons-text", - "jar", - "1.4" + "jar", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4.pom"), "pom", + "org.apache.commons", "commons-text", - "pom", - "1.4" + "pom", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4.pom.asc"), "pom.asc", + "org.apache.commons", "commons-text", - "pom", - "1.4" + "pom", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4-javadoc.jar"), "jar", + "org.apache.commons", "commons-text", - "javadoc", - "1.4" + "javadoc", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4-javadoc.jar.asc"), "jar.asc", + "org.apache.commons", "commons-text", - "javadoc", - "1.4" + "javadoc", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4-sources.jar"), "jar", + "org.apache.commons", "commons-text", - "sources", - "1.4" + "sources", "1.4" ) ); attachedArtifacts.add( new DistributionDetachmentArtifactStub( new File("src/test/resources/mojos/detach-distributions/target/commons-text-1.4-sources.jar.asc"), "jar.asc", + "org.apache.commons", "commons-text", - "sources", - "1.4" + "sources", "1.4" ) ); return attachedArtifacts; @@ -215,9 +221,11 @@ public class DistributionDetachmentProjectStub extends MavenProjectStub { private final String type; - public DistributionDetachmentArtifactStub(final File file, final String type, - final String artifactId, final String classifier, final String version) { + public DistributionDetachmentArtifactStub(final File file, final String type, final String groupId, + final String artifactId, final String classifier, final String version) { this.setArtifactId(artifactId); + this.setGroupId(groupId); + this.setArtifactHandler(new DefaultArtifactHandlerStub(type, classifier)); this.artifact = file; this.type = type; this.classifier = classifier;