geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r694262 - /geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
Date Thu, 11 Sep 2008 14:11:00 GMT
Author: jdillon
Date: Thu Sep 11 07:10:58 2008
New Revision: 694262

URL: http://svn.apache.org/viewvc?rev=694262&view=rev
Log:
Update to use the artifact & scope filter when resolving artifacts

Modified:
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java?rev=694262&r1=694261&r2=694262&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
Thu Sep 11 07:10:58 2008
@@ -44,6 +44,7 @@
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
 import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
 import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -203,39 +204,19 @@
         assert application != null;
 
         ArtifactResolutionRequest request = new ArtifactResolutionRequest();
-        request.setFilter(new ScopeArtifactFilter(Artifact.SCOPE_RUNTIME));
 
-        Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
-        List<Dependency> dependencies = application.dependencies(true); // include
groups
-
-        if (!dependencies.isEmpty()) {
-            ArtifactFactory factory = artifactManager.getArtifactFactory();
-
-            log.debug("Application dependencies:");
-
-            for (Dependency dep : dependencies) {
-                Artifact artifact = factory.createArtifact(dep.getGroupId(), dep.getArtifactId(),
dep.getVersion(), null, dep.getType());
-                assert artifact != null;
-
-                log.debug(" + {}", artifact);
+        AndArtifactFilter filter = new AndArtifactFilter();
 
-                artifacts.add(artifact);
-            }
-        }
+        filter.add(new ScopeArtifactFilter(Artifact.SCOPE_RUNTIME));
 
-        request.setArtifactDependencies(artifacts);
-
-        ArtifactResolutionResult result = artifactManager.resolve(request);
-
-        List<URL> classPath = new LinkedList<URL>();
-        Set<Artifact> resolvedArtifacts = result.getArtifacts();
-
-        //
-        // FIXME: Load this list from build-generated properties or something like that
-        //
+        filter.add(new ExclusionSetFilter(new String[] {
+            //
+            // FIXME: Load this list from build-generated properties or something like that
+            //
 
-        ExclusionSetFilter filter = new ExclusionSetFilter(new String[] {
+            "aopalliance",
             "aspectjrt",
+            "geronimo-annotation_1.0_spec",
             "gshell-ansi",
             "gshell-api",
             "gshell-artifact",
@@ -265,6 +246,9 @@
             "plexus-classworlds",
             "slf4j-api",
             "slf4j-log4j12",
+            "spring-core",
+            "spring-context",
+            "spring-beans",
             "wagon-file",
             "wagon-http-lightweight",
             "wagon-http-shared",
@@ -272,26 +256,46 @@
             "xbean-reflect",
             "xpp3_min",
             "xstream",
-            "geronimo-annotation_1.0_spec",
-            "spring-core",
-            "spring-context",
-            "spring-beans",
-            "aopalliance",
-        });
+        }));
+
+        request.setFilter(filter);
+
+        Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
+        List<Dependency> dependencies = application.dependencies(true); // include
groups
+
+        if (!dependencies.isEmpty()) {
+            ArtifactFactory factory = artifactManager.getArtifactFactory();
+
+            log.debug("Application dependencies:");
+
+            for (Dependency dep : dependencies) {
+                Artifact artifact = factory.createArtifact(dep.getGroupId(), dep.getArtifactId(),
dep.getVersion(), null, dep.getType());
+                assert artifact != null;
+
+                log.debug(" + {}", artifact);
+
+                artifacts.add(artifact);
+            }
+        }
+
+        request.setArtifactDependencies(artifacts);
+
+        ArtifactResolutionResult result = artifactManager.resolve(request);
+
+        List<URL> classPath = new LinkedList<URL>();
+        Set<Artifact> resolvedArtifacts = result.getArtifacts();
 
         if (resolvedArtifacts != null && !resolvedArtifacts.isEmpty()) {
             log.debug("Application classpath:");
 
             for (Artifact artifact : resolvedArtifacts) {
-                if (filter.include(artifact)) {
-                    File file = artifact.getFile();
-                    assert file != null;
+                File file = artifact.getFile();
+                assert file != null;
 
-                    URL url = file.toURI().toURL();
-                    log.debug(" + {}", url);
+                URL url = file.toURI().toURL();
+                log.debug(" + {}", url);
 
-                    classPath.add(url);
-                }
+                classPath.add(url);
             }
         }
 



Mime
View raw message