in src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java [143:184]
protected void doExecute() throws MojoExecutionException {
DependencyStatusSets dss = getDependencySets(this.failOnMissingClassifierArtifact, addParentPoms);
Set<Artifact> artifacts = dss.getResolvedDependencies();
if (!useRepositoryLayout) {
Map<String, Integer> copies = new HashMap<>();
for (Artifact artifactItem : artifacts) {
String destFileName = DependencyUtil.getFormattedFileName(
artifactItem, stripVersion, prependGroupId, useBaseVersion, stripClassifier);
int numCopies = copies.getOrDefault(destFileName, 0);
copies.put(destFileName, numCopies + 1);
}
for (Map.Entry<String, Integer> entry : copies.entrySet()) {
if (entry.getValue() > 1) {
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.");
}
}
for (Artifact artifact : artifacts) {
copyArtifact(
artifact, isStripVersion(), this.prependGroupId, this.useBaseVersion, this.stripClassifier);
}
} else {
ProjectBuildingRequest buildingRequest = getRepositoryManager()
.setLocalRepositoryBasedir(session.getProjectBuildingRequest(), outputDirectory);
artifacts.forEach(artifact -> installArtifact(artifact, buildingRequest));
}
Set<Artifact> skippedArtifacts = dss.getSkippedDependencies();
for (Artifact artifact : skippedArtifacts) {
getLog().info(artifact.getId() + " already exists in destination.");
}
if (isCopyPom() && !useRepositoryLayout) {
copyPoms(getOutputDirectory(), artifacts, this.stripVersion);
copyPoms(getOutputDirectory(), skippedArtifacts, this.stripVersion, this.stripClassifier);
// Artifacts that already exist may not yet have poms
}
}