Restore the gathering of artifacts on resolve
authorNicolas Lalevée <nicolas.lalevee@hibnet.org>
Sun, 1 Jul 2018 12:50:34 +0000 (14:50 +0200)
committerNicolas Lalevée <nicolas.lalevee@hibnet.org>
Sun, 1 Jul 2018 12:50:34 +0000 (14:50 +0200)
org.apache.ivyde.eclipse/src/java/org/apache/ivyde/internal/eclipse/resolve/IvyResolver.java

index 7dddf15..ba6bfc8 100644 (file)
@@ -260,21 +260,23 @@ public class IvyResolver {
 
         ResolveResult result = new ResolveResult(report);
 
-        Map<Artifact, ArtifactDownloadReport> workspaceArtifacts = IvyContext.getContext()
-                .get(WorkspaceResolver.IVYDE_WORKSPACE_ARTIFACT_REPORTS);
+        ArtifactDownloadReport[] artifactReports = report.getArtifactsReports(null, false);
+
+        Map<Artifact, ArtifactDownloadReport> workspaceArtifacts = IvyContext
+                .getContext().get(WorkspaceResolver.IVYDE_WORKSPACE_ARTIFACT_REPORTS);
         if (workspaceArtifacts != null) {
-            // some artifacts were 'forced' by the dependency declaration, whereas they should be
-            // changed to the eclipse project reference
-            for (ArtifactDownloadReport artifactReport : report.getArtifactsReports(null, false)) {
-                ArtifactDownloadReport eclipseArtifactReport = workspaceArtifacts.get(artifactReport.getArtifact());
-                if (eclipseArtifactReport == null) {
-                    result.addArtifactReport(artifactReport);
-                } else {
-                    // let's change
-                    result.addArtifactReport(eclipseArtifactReport);
+            // some artifact were 'forced' by the dependency declaration, whereas they should be
+            // switch by the eclipse project reference
+            for (int i = 0; i < artifactReports.length; i++) {
+                ArtifactDownloadReport eclipseArtifactReport = (ArtifactDownloadReport) workspaceArtifacts
+                        .get(artifactReports[i].getArtifact());
+                if (eclipseArtifactReport != null) {
+                    // let's switch.
+                    artifactReports[i] = eclipseArtifactReport;
                 }
             }
         }
+        result.addArtifactReports(artifactReports);
 
         collectArtifactsByDependency(report, result);