Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 10869 invoked from network); 11 Sep 2008 14:11:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Sep 2008 14:11:24 -0000 Received: (qmail 73245 invoked by uid 500); 11 Sep 2008 14:11:21 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 73106 invoked by uid 500); 11 Sep 2008 14:11:20 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 73097 invoked by uid 99); 11 Sep 2008 14:11:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Sep 2008 07:11:20 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Sep 2008 14:10:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DAB012388A31; Thu, 11 Sep 2008 07:11:00 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: scm@geronimo.apache.org From: jdillon@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080911141100.DAB012388A31@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 artifacts = new LinkedHashSet(); - List 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 classPath = new LinkedList(); - Set 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 artifacts = new LinkedHashSet(); + List 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 classPath = new LinkedList(); + Set 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); } }