Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Nov 15, 2024
1 parent 5eeaaaf commit 17ea022
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*/
Expand All @@ -109,17 +109,16 @@ protected void doExecute() throws MojoExecutionException {
Set<Artifact> artifacts = dss.getResolvedDependencies();

if (!useRepositoryLayout) {
getLog().info("Checking " + artifacts.size() + " artifact items");
Map<String, Integer> 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<String, Integer> 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.");
}
}

Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 17ea022

Please sign in to comment.