From 17ea02238bbf01043a5a9300d1c9cef0bf109fd2 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Fri, 15 Nov 2024 09:23:28 -0500 Subject: [PATCH] wip --- .../fromDependencies/CopyDependenciesMojo.java | 15 +++++++-------- .../fromConfiguration/TestCopyMojo.java | 1 - 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java index edfae0d64..e895dc3f9 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java +++ b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java @@ -99,7 +99,7 @@ public class CopyDependenciesMojo extends AbstractFromDependenciesMojo { /** * Main entry into mojo. Gets the list of dependencies and iterates through calling copyArtifact. * - * @throws MojoExecutionException with a message if an error occurs. + * @throws MojoExecutionException with a message if an error occurs * @see #getDependencySets(boolean, boolean) * @see #copyArtifact(Artifact, boolean, boolean, boolean, boolean) */ @@ -109,17 +109,16 @@ protected void doExecute() throws MojoExecutionException { Set artifacts = dss.getResolvedDependencies(); if (!useRepositoryLayout) { - getLog().info("Checking " + artifacts.size() + " artifact items"); Map copies = new HashMap<>(); for (Artifact artifactItem : artifacts) { - getLog().info("Found " + artifactItem.getArtifactId()); int numCopies = copies.getOrDefault(artifactItem.getArtifactId(), 0); copies.put(artifactItem.getArtifactId(), numCopies + 1); } for (Map.Entry entry : copies.entrySet()) { - getLog().info("File with the name " + entry.getKey() + "; " + entry.getValue() + " copies"); if (entry.getValue() > 1) { - getLog().warn("Multiple files with the name " + entry.getKey() + "; unpacking is incomplete."); + getLog().warn("Multiple files with the name " + entry.getKey() + " in the dependency tree."); + getLog().warn( + "Not all jars will be available. Consider using prependGroupId, useSubDirectoryPerArtifact, or useRepositoryLayout."); } } @@ -205,7 +204,7 @@ protected void copyArtifact( * @param artifact representing the object to be copied. * @param removeVersion specifies if the version should be removed from the file name when copying. * @param prependGroupId specifies if the groupId should be prepend to the file while copying. - * @param theUseBaseVersion specifies if the baseVersion of the artifact should be used instead of the version. + * @param useBaseVersion specifies if the baseVersion of the artifact should be used instead of the version. * @param removeClassifier specifies if the classifier should be removed from the file name when copying. * @throws MojoExecutionException with a message if an error occurs. * @see CopyUtil#copyArtifactFile(Artifact, File) @@ -215,12 +214,12 @@ protected void copyArtifact( Artifact artifact, boolean removeVersion, boolean prependGroupId, - boolean theUseBaseVersion, + boolean useBaseVersion, boolean removeClassifier) throws MojoExecutionException { String destFileName = DependencyUtil.getFormattedFileName( - artifact, removeVersion, prependGroupId, theUseBaseVersion, removeClassifier); + artifact, removeVersion, prependGroupId, useBaseVersion, removeClassifier); File destDir = DependencyUtil.getFormattedOutputDirectory( useSubDirectoryPerScope, diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java index e4b2a68ef..8823cf5e4 100644 --- a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java +++ b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java @@ -30,7 +30,6 @@ import org.apache.maven.model.Dependency; import org.apache.maven.plugin.LegacySupport; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase; import org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub; import org.apache.maven.plugins.dependency.utils.DependencyUtil;