Current work
Project: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/commit/bcca0ff9 Tree: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/tree/bcca0ff9 Diff: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/diff/bcca0ff9 Branch: refs/heads/master Commit: bcca0ff9ae13761783d406e6fbe9165d1b401144 Parents: 5d4ab8c Author: Rob Tompkins <chtom...@apache.org> Authored: Sun Jan 7 13:21:37 2018 -0500 Committer: Rob Tompkins <chtom...@apache.org> Committed: Sun Jan 7 13:21:37 2018 -0500 ---------------------------------------------------------------------- .../CommonsDistributionDetatchmentMojo.java | 15 ++++---- .../DistributionDetatchmentProjectStub.java | 38 ++++++++++++++++++++ .../release/plugin/stubs/package-info.java | 17 +++++++++ 3 files changed, 62 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/bcca0ff9/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetatchmentMojo.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetatchmentMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetatchmentMojo.java index fd75e39..746a51c 100644 --- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetatchmentMojo.java +++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetatchmentMojo.java @@ -24,11 +24,10 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import org.apache.maven.project.artifact.AttachedArtifact; +import org.apache.maven.artifact.Artifact; import java.io.File; import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.*; @@ -65,7 +64,7 @@ public class CommonsDistributionDetatchmentMojo extends AbstractMojo { * This list is supposed to hold the maven references to the aformentioned artifacts so that we * can upload them to svn after they've been detatched from the maven deployment. */ - private List<AttachedArtifact> detatchedArtifacts = new ArrayList<>(); + private List<Artifact> detatchedArtifacts = new ArrayList<>(); /** * The maven project context injection so that we can get a hold of the variables at hand. @@ -86,11 +85,11 @@ public class CommonsDistributionDetatchmentMojo extends AbstractMojo { public void execute() throws MojoExecutionException { getLog().info("Detatching Assemblies"); for (Object attachedArtifact : project.getAttachedArtifacts()) { - if (ARTIFACT_TYPES_TO_DETATCH.contains(((AttachedArtifact) attachedArtifact).getType())) { - detatchedArtifacts.add((AttachedArtifact) attachedArtifact); + if (ARTIFACT_TYPES_TO_DETATCH.contains(((Artifact) attachedArtifact).getType())) { + detatchedArtifacts.add((Artifact) attachedArtifact); } } - for(AttachedArtifact artifactToRemove : detatchedArtifacts) { + for(Artifact artifactToRemove : detatchedArtifacts) { project.getAttachedArtifacts().remove(artifactToRemove); } if (!workingDirectory.exists()) { @@ -104,7 +103,7 @@ public class CommonsDistributionDetatchmentMojo extends AbstractMojo { private void copyRemovedArtifactsToWorkingDirectory() throws MojoExecutionException { StringBuffer copiedArtifactAbsolutePath; getLog().info("Copying detatched artifacts to working directory."); - for (AttachedArtifact artifact: detatchedArtifacts) { + for (Artifact artifact: detatchedArtifacts) { File artifactFile = artifact.getFile(); copiedArtifactAbsolutePath = new StringBuffer(workingDirectory.getAbsolutePath()); copiedArtifactAbsolutePath.append("/"); @@ -116,7 +115,7 @@ public class CommonsDistributionDetatchmentMojo extends AbstractMojo { } private void sha1AndMd5SignArtifacts() throws MojoExecutionException { - for (AttachedArtifact artifact : detatchedArtifacts) { + for (Artifact artifact : detatchedArtifacts) { if (!artifact.getFile().getName().contains("asc")) { try { FileInputStream artifactFileInputStream = new FileInputStream(artifact.getFile()); http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/bcca0ff9/src/test/java/org/apache/commons/release/plugin/stubs/DistributionDetatchmentProjectStub.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/release/plugin/stubs/DistributionDetatchmentProjectStub.java b/src/test/java/org/apache/commons/release/plugin/stubs/DistributionDetatchmentProjectStub.java new file mode 100644 index 0000000..9305d02 --- /dev/null +++ b/src/test/java/org/apache/commons/release/plugin/stubs/DistributionDetatchmentProjectStub.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.release.plugin.stubs; + +import org.apache.commons.release.plugin.mojos.CommonsDistributionDetatchmentMojoTest; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.plugin.testing.stubs.MavenProjectStub; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.artifact.AttachedArtifact; + +import java.util.List; + +/** + * Stub for {@link MavenProject} for the {@link CommonsDistributionDetatchmentMojoTest}. + * + * @author chtompki + */ +public class DistributionDetatchmentProjectStub extends MavenProjectStub { + + private List<Artifact> attachedArtifacts; + + + +} http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/bcca0ff9/src/test/java/org/apache/commons/release/plugin/stubs/package-info.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/release/plugin/stubs/package-info.java b/src/test/java/org/apache/commons/release/plugin/stubs/package-info.java new file mode 100644 index 0000000..95d9137 --- /dev/null +++ b/src/test/java/org/apache/commons/release/plugin/stubs/package-info.java @@ -0,0 +1,17 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.release.plugin.stubs; \ No newline at end of file