Skip to content
Snippets Groups Projects
Commit 6c7ead4f authored by Guillaume Delhumeau's avatar Guillaume Delhumeau
Browse files

XWIKI-11777: The PackageMojo should install XAR dependencies first.

parent c52cfd19
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
...@@ -429,7 +430,13 @@ private void importXARs(File webInfDirectory) throws MojoExecutionException ...@@ -429,7 +430,13 @@ private void importXARs(File webInfDirectory) throws MojoExecutionException
throw new MojoExecutionException("Failed to create context to import XAR files", e); throw new MojoExecutionException("Failed to create context to import XAR files", e);
} }
for (Artifact xarArtifact : xarArtifacts) { // Reverse artifact order to have dependencies first (despite the fact that it's a Set it's actually an
// ordered LinkedHashSet behind the scene)
List<Artifact> dependenciesFirstArtifacts = new ArrayList<Artifact>(xarArtifacts);
Collections.reverse(dependenciesFirstArtifacts);
// Import the xars
for (Artifact xarArtifact : dependenciesFirstArtifacts) {
getLog().info(" ... Importing XAR file: " + xarArtifact.getFile()); getLog().info(" ... Importing XAR file: " + xarArtifact.getFile());
try { try {
...@@ -467,7 +474,7 @@ private void importXARs(File webInfDirectory) throws MojoExecutionException ...@@ -467,7 +474,7 @@ private void importXARs(File webInfDirectory) throws MojoExecutionException
private Set<Artifact> resolveXARs() throws MojoExecutionException private Set<Artifact> resolveXARs() throws MojoExecutionException
{ {
Set<Artifact> xarArtifacts = new HashSet<Artifact>(); Set<Artifact> xarArtifacts = new LinkedHashSet<>();
Set<Artifact> artifacts = this.project.getArtifacts(); Set<Artifact> artifacts = this.project.getArtifacts();
if (artifacts != null) { if (artifacts != null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment