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 d125404 commit 5eeaaaf
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,19 @@ protected void doExecute() throws MojoExecutionException, MojoFailureException {

List<ArtifactItem> theArtifactItems = getProcessedArtifactItems(
new ProcessArtifactItemsRequest(stripVersion, prependGroupId, useBaseVersion, stripClassifier));
getLog().info("Checking " + theArtifactItems.size() + " artifact items");
Map<String, Integer> copies = new HashMap<>();
for (ArtifactItem artifactItem : theArtifactItems) {
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.");
if (!prependGroupId) {
getLog().info("Checking " + theArtifactItems.size() + " artifact items");
Map<String, Integer> copies = new HashMap<>();
for (ArtifactItem artifactItem : theArtifactItems) {
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.");
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

Expand Down Expand Up @@ -108,6 +109,20 @@ 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.");
}
}

for (Artifact artifact : artifacts) {
copyArtifact(
artifact, isStripVersion(), this.prependGroupId, this.useBaseVersion, this.stripClassifier);
Expand All @@ -126,11 +141,8 @@ protected void doExecute() throws MojoExecutionException {

if (isCopyPom() && !useRepositoryLayout) {
copyPoms(getOutputDirectory(), artifacts, this.stripVersion);
copyPoms(getOutputDirectory(), skippedArtifacts, this.stripVersion, this.stripClassifier); // Artifacts
// that already
// exist may
// not yet have
// poms
copyPoms(getOutputDirectory(), skippedArtifacts, this.stripVersion, this.stripClassifier);
// Artifacts that already exist may not yet have poms
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,22 +690,6 @@ public void testCopyFileWithOverideLocalRepo() throws Exception {
assertFilesExist(list, true);
}

public void testConflictingArtifacts() throws MojoExecutionException, MojoFailureException {
List<ArtifactItem> list = new ArrayList<>(2);
ArtifactItem jdom = new ArtifactItem();
jdom.setGroupId("jdom");
jdom.setArtifactId("jdom");
jdom.setVersion("1.1.3");
list.add(jdom);
ArtifactItem lucee = new ArtifactItem();
lucee.setGroupId("org.lucee");
lucee.setArtifactId("jdom");
lucee.setVersion("1.1.3");
list.add(lucee);
mojo.setArtifactItems(list);
mojo.execute();
}

private List<Dependency> createDependencyArtifacts(List<Dependency> items) throws IOException {
stubFactory.setCreateFiles(true);
for (Dependency item : items) {
Expand Down

0 comments on commit 5eeaaaf

Please sign in to comment.