Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 67297 invoked from network); 24 May 2008 09:11:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 May 2008 09:11:40 -0000 Received: (qmail 47088 invoked by uid 500); 24 May 2008 09:11:41 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 47026 invoked by uid 500); 24 May 2008 09:11:41 -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 47012 invoked by uid 99); 24 May 2008 09:11:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 May 2008 02:11:41 -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; Sat, 24 May 2008 09:10:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 411E72388A05; Sat, 24 May 2008 02:11:16 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r659778 - /geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java Date: Sat, 24 May 2008 09:11:16 -0000 To: scm@geronimo.apache.org From: jdillon@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080524091116.411E72388A05@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jdillon Date: Sat May 24 02:11:15 2008 New Revision: 659778 URL: http://svn.apache.org/viewvc?rev=659778&view=rev Log: Add -T flag Modified: geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java Modified: geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java?rev=659778&r1=659777&r2=659778&view=diff ============================================================================== --- geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java (original) +++ geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java Sat May 24 02:11:15 2008 @@ -31,6 +31,7 @@ import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; import java.util.Collections; +import java.util.Set; /** * Resolve repository artifacts. @@ -45,51 +46,60 @@ private ArtifactManager artifactManager; // - // TODO: Consider using :::: notation instead of this? + // TODO: Consider using :::: notation instead of, or in addtion this? // - @Option(name="-g", aliases={"--groupId"}, argumentRequired=true, metaVar="GROUP-ID", required=true, description="Specify the artifact's groupId") + @Option(name="-g", aliases={"--groupId"}, argumentRequired=true, metaVar="GROUP-ID", required=true, description="Specify the groupId") private String groupId; - @Option(name="-a", aliases={"--artifactId"}, argumentRequired=true, metaVar="ARTIFACT-ID", required=true, description="Specify the artifact's artifactId") + @Option(name="-a", aliases={"--artifactId"}, argumentRequired=true, metaVar="ARTIFACT-ID", required=true, description="Specify the artifactId") private String artifactId; - @Option(name="-v", aliases={"--version"}, argumentRequired=true, metaVar="VERSION", required=true, description="Specify the artifact's version") + @Option(name="-v", aliases={"--version"}, argumentRequired=true, metaVar="VERSION", required=true, description="Specify the version") private String version; - @Option(name="-t", aliases={"--type"}, argumentRequired=true, metaVar="TYPE", description="Specify the artifact's type") + @Option(name="-t", aliases={"--type"}, argumentRequired=true, metaVar="TYPE", description="Specify the type") private String type = "jar"; @Option(name="-s", aliases={"--scope"}, argumentRequired=true, metaVar="SCOPE", description="Specify the resolution scope") private String scope; + @Option(name="-T", aliases={"--transitive"}, description="Resolve transitive dependencies") + private boolean transitive; + protected Object doExecute() throws Exception { assert artifactManager != null; ArtifactFactory factory = artifactManager.getArtifactFactory(); - ArtifactResolutionRequest request = new ArtifactResolutionRequest(); + Artifact artifact = factory.createArtifact(groupId, artifactId, version, scope, type); - // - // TODO: Add support for --transitive - // + ArtifactResolutionRequest request = new ArtifactResolutionRequest(); // // TODO: Update the AM API to use this as originating when artifact == null and artifact dependencies != null // - - Artifact originating = factory.createArtifact("dummy", "dummy", "dummy", null, "jar"); - request.setArtifact(originating); - if (scope != null) { - request.setFilter(new ScopeArtifactFilter(scope)); + if (transitive) { + io.info("Resolving artifact (transitively): {}", artifact); + + Artifact originating = factory.createArtifact("dummy", "dummy", "dummy", null, "jar"); + request.setArtifact(originating); + request.setArtifactDependencies(Collections.singleton(artifact)); } + else { + io.info("Resolving artifact: {}", artifact); - Artifact artifact = factory.createArtifact(groupId, artifactId, version, scope, type); + request.setArtifact(artifact); + Set deps = Collections.emptySet(); + request.setArtifactDependencies(deps); + } - io.info("Resolving artifact: {}", artifact); - - request.setArtifactDependencies(Collections.singleton(artifact)); + if (scope != null) { + io.debug("Using scope: {}", scope); + + request.setFilter(new ScopeArtifactFilter(scope)); + } ArtifactResolutionResult result = artifactManager.resolve(request);