maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject [47/48] maven-resolver git commit: finish some renaming
Date Fri, 26 May 2017 21:16:23 GMT
finish some renaming

Project: http://git-wip-us.apache.org/repos/asf/maven-resolver/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-resolver/commit/cfc0c604
Tree: http://git-wip-us.apache.org/repos/asf/maven-resolver/tree/cfc0c604
Diff: http://git-wip-us.apache.org/repos/asf/maven-resolver/diff/cfc0c604

Branch: refs/heads/demos
Commit: cfc0c6049e6471ff4e7935ac0d1d3d668bb8abd7
Parents: ce0e6f3
Author: Hervé Boutemy <hboutemy@apache.org>
Authored: Sat Sep 17 16:38:30 2016 +0200
Committer: Hervé Boutemy <hboutemy@apache.org>
Committed: Sat Sep 17 16:38:30 2016 +0200

----------------------------------------------------------------------
 .../examples/maven/ResolveArtifactMojo.java     |   4 +-
 maven-resolver-demo-snippets/pom.xml            |   2 +-
 .../maven/resolver/examples/AllAetherDemos.java |  42 ------
 .../resolver/examples/AllResolverDemos.java     |  42 ++++++
 .../resolver/examples/InstallArtifacts.java     |   2 +-
 .../maven/resolver/examples/aether/Aether.java  | 131 -------------------
 .../resolver/examples/aether/AetherDemo.java    |  78 -----------
 .../resolver/examples/aether/AetherResult.java  |  56 --------
 .../examples/guice/DemoAetherModule.java        |  74 -----------
 .../examples/guice/DemoResolverModule.java      |  74 +++++++++++
 .../guice/GuiceRepositorySystemFactory.java     |   2 +-
 .../manual/ManualRepositorySystemFactory.java   |   4 +-
 .../plexus/PlexusRepositorySystemFactory.java   |   4 +-
 .../resolver/examples/resolver/Resolver.java    | 131 +++++++++++++++++++
 .../examples/resolver/ResolverDemo.java         |  78 +++++++++++
 .../examples/resolver/ResolverResult.java       |  56 ++++++++
 16 files changed, 390 insertions(+), 390 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-maven-plugin/src/main/java/org/apache/maven/resolver/examples/maven/ResolveArtifactMojo.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-maven-plugin/src/main/java/org/apache/maven/resolver/examples/maven/ResolveArtifactMojo.java
b/maven-resolver-demo-maven-plugin/src/main/java/org/apache/maven/resolver/examples/maven/ResolveArtifactMojo.java
index db024a2..57f18d6 100644
--- a/maven-resolver-demo-maven-plugin/src/main/java/org/apache/maven/resolver/examples/maven/ResolveArtifactMojo.java
+++ b/maven-resolver-demo-maven-plugin/src/main/java/org/apache/maven/resolver/examples/maven/ResolveArtifactMojo.java
@@ -43,7 +43,7 @@ public class ResolveArtifactMojo
 {
 
     /**
-     * The entry point to Aether, i.e. the component doing all the work.
+     * The entry point to Maven Artifact Resolver, i.e. the component doing all the work.
      * 
      * @component
      */
@@ -68,7 +68,7 @@ public class ResolveArtifactMojo
     /**
      * The {@code <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>}
of the artifact to resolve.
      * 
-     * @parameter property="aether.artifactCoords"
+     * @parameter property="resolver.artifactCoords"
      */
     private String artifactCoords;
 

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/pom.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/pom.xml b/maven-resolver-demo-snippets/pom.xml
index 8232998..0a9c7e1 100644
--- a/maven-resolver-demo-snippets/pom.xml
+++ b/maven-resolver-demo-snippets/pom.xml
@@ -30,7 +30,7 @@
 
   <artifactId>maven-resolver-demo-snippets</artifactId>
 
-  <name>Maven ArtifactResolver Demo Snippets</name>
+  <name>Maven Artifact Resolver Demo Snippets</name>
   <description>
     A module to demonstrate the usage of Maven Artifact Resolver by means of various runnable
code snippets.
   </description>

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/AllAetherDemos.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/AllAetherDemos.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/AllAetherDemos.java
deleted file mode 100644
index 8f25ac7..0000000
--- a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/AllAetherDemos.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.apache.maven.resolver.examples;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *  http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Runs all demos at once.
- */
-public class AllAetherDemos
-{
-
-    public static void main( String[] args )
-        throws Exception
-    {
-        FindAvailableVersions.main( args );
-        FindNewestVersion.main( args );
-        GetDirectDependencies.main( args );
-        GetDependencyTree.main( args );
-        GetDependencyHierarchy.main( args );
-        ResolveArtifact.main( args );
-        ResolveTransitiveDependencies.main( args );
-        InstallArtifacts.main( args );
-        DeployArtifacts.main( args );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/AllResolverDemos.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/AllResolverDemos.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/AllResolverDemos.java
new file mode 100644
index 0000000..b04c603
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/AllResolverDemos.java
@@ -0,0 +1,42 @@
+package org.apache.maven.resolver.examples;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Runs all demos at once.
+ */
+public class AllResolverDemos
+{
+
+    public static void main( String[] args )
+        throws Exception
+    {
+        FindAvailableVersions.main( args );
+        FindNewestVersion.main( args );
+        GetDirectDependencies.main( args );
+        GetDependencyTree.main( args );
+        GetDependencyHierarchy.main( args );
+        ResolveArtifact.main( args );
+        ResolveTransitiveDependencies.main( args );
+        InstallArtifacts.main( args );
+        DeployArtifacts.main( args );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/InstallArtifacts.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/InstallArtifacts.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/InstallArtifacts.java
index c0d0506..fb1f02c 100644
--- a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/InstallArtifacts.java
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/InstallArtifacts.java
@@ -46,7 +46,7 @@ public class InstallArtifacts
         RepositorySystemSession session = Booter.newRepositorySystemSession( system );
 
         Artifact jarArtifact =
-            new DefaultArtifact( "test", "org.apache.maven.aether.examples", "", "jar", "0.1-SNAPSHOT"
);
+            new DefaultArtifact( "test", "org.apache.maven.resolver.examples", "", "jar",
"0.1-SNAPSHOT" );
         jarArtifact = jarArtifact.setFile( new File( "src/main/data/demo.jar" ) );
 
         Artifact pomArtifact = new SubArtifact( jarArtifact, "", "pom" );

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/Aether.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/Aether.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/Aether.java
deleted file mode 100644
index b700461..0000000
--- a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/Aether.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.apache.maven.resolver.examples.aether;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *  http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import org.apache.maven.resolver.examples.util.Booter;
-import org.apache.maven.resolver.examples.util.ConsoleDependencyGraphDumper;
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.RepositorySystem;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.collection.CollectRequest;
-import org.eclipse.aether.deployment.DeployRequest;
-import org.eclipse.aether.deployment.DeploymentException;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.installation.InstallRequest;
-import org.eclipse.aether.installation.InstallationException;
-import org.eclipse.aether.repository.Authentication;
-import org.eclipse.aether.repository.LocalRepository;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.resolution.DependencyRequest;
-import org.eclipse.aether.resolution.DependencyResolutionException;
-import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator;
-import org.eclipse.aether.util.repository.AuthenticationBuilder;
-
-/**
- */
-public class Aether
-{
-    private String remoteRepository;
-
-    private RepositorySystem repositorySystem;
-
-    private LocalRepository localRepository;
-
-    public Aether( String remoteRepository, String localRepository )
-    {
-        this.remoteRepository = remoteRepository;
-        this.repositorySystem = Booter.newRepositorySystem();
-        this.localRepository = new LocalRepository( localRepository );
-    }
-
-    private RepositorySystemSession newSession()
-    {
-        DefaultRepositorySystemSession session = Booter.newRepositorySystemSession( repositorySystem
);
-        session.setLocalRepositoryManager( repositorySystem.newLocalRepositoryManager( session,
localRepository ) );
-        return session;
-    }
-
-    public AetherResult resolve( String groupId, String artifactId, String version )
-        throws DependencyResolutionException
-    {
-        RepositorySystemSession session = newSession();
-        Dependency dependency =
-            new Dependency( new DefaultArtifact( groupId, artifactId, "", "jar", version
), "runtime" );
-        RemoteRepository central = new RemoteRepository.Builder( "central", "default", remoteRepository
).build();
-
-        CollectRequest collectRequest = new CollectRequest();
-        collectRequest.setRoot( dependency );
-        collectRequest.addRepository( central );
-
-        DependencyRequest dependencyRequest = new DependencyRequest();
-        dependencyRequest.setCollectRequest( collectRequest );
-
-        DependencyNode rootNode = repositorySystem.resolveDependencies( session, dependencyRequest
).getRoot();
-
-        StringBuilder dump = new StringBuilder();
-        displayTree( rootNode, dump );
-
-        PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
-        rootNode.accept( nlg );
-
-        return new AetherResult( rootNode, nlg.getFiles(), nlg.getClassPath() );
-    }
-
-    public void install( Artifact artifact, Artifact pom )
-        throws InstallationException
-    {
-        RepositorySystemSession session = newSession();
-
-        InstallRequest installRequest = new InstallRequest();
-        installRequest.addArtifact( artifact ).addArtifact( pom );
-
-        repositorySystem.install( session, installRequest );
-    }
-
-    public void deploy( Artifact artifact, Artifact pom, String remoteRepository )
-        throws DeploymentException
-    {
-        RepositorySystemSession session = newSession();
-
-        Authentication auth = new AuthenticationBuilder().addUsername( "admin" ).addPassword(
"admin123" ).build();
-        RemoteRepository nexus =
-            new RemoteRepository.Builder( "nexus", "default", remoteRepository ).setAuthentication(
auth ).build();
-
-        DeployRequest deployRequest = new DeployRequest();
-        deployRequest.addArtifact( artifact ).addArtifact( pom );
-        deployRequest.setRepository( nexus );
-
-        repositorySystem.deploy( session, deployRequest );
-    }
-
-    private void displayTree( DependencyNode node, StringBuilder sb )
-    {
-        ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
-        node.accept( new ConsoleDependencyGraphDumper( new PrintStream( os ) ) );
-        sb.append( os.toString() );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/AetherDemo.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/AetherDemo.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/AetherDemo.java
deleted file mode 100644
index 31967c2..0000000
--- a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/AetherDemo.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.apache.maven.resolver.examples.aether;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *  http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.util.List;
-
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.deployment.DeploymentException;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.installation.InstallationException;
-import org.eclipse.aether.resolution.DependencyResolutionException;
-import org.eclipse.aether.util.artifact.SubArtifact;
-
-/**
- */
-@SuppressWarnings( "unused" )
-public class AetherDemo
-{
-
-    public void resolve() 
-        throws DependencyResolutionException
-    {
-        Aether aether = new Aether( "http://localhost:8081/nexus/content/groups/public",
"target/aether-repo" );
-                
-        AetherResult result = aether.resolve( "com.mycompany.app", "super-app", "1.0" );
-
-        // Get the root of the resolved tree of artifacts
-        //
-        DependencyNode root = result.getRoot();
-
-        // Get the list of files for the artifacts resolved
-        //
-        List<File> artifacts = result.getResolvedFiles();
-        
-        // Get the classpath of the artifacts resolved
-        //
-        String classpath = result.getResolvedClassPath();        
-    }
-    
-    public void installAndDeploy() 
-        throws InstallationException, DeploymentException
-    {
-        Aether aether = new Aether( "http://localhost:8081/nexus/content/groups/public",
"target/aether-repo" );
-        
-        Artifact artifact = new DefaultArtifact( "com.mycompany.super", "super-core", "jar",
"0.1-SNAPSHOT" );
-        artifact = artifact.setFile( new File( "jar-from-whatever-process.jar" ) );
-        Artifact pom = new SubArtifact( artifact, null, "pom" );
-        pom = pom.setFile( new File( "pom-from-whatever-process.xml" ) );
-          
-        // Install into the local repository specified
-        //
-        aether.install( artifact, pom );
-        
-        // Deploy to a remote reposistory
-        //
-        aether.deploy( artifact, pom, "http://localhost:8081/nexus/content/repositories/snapshots/"
);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/AetherResult.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/AetherResult.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/AetherResult.java
deleted file mode 100644
index 2f377aa..0000000
--- a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/AetherResult.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.apache.maven.resolver.examples.aether;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *  http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.util.List;
-
-import org.eclipse.aether.graph.DependencyNode;
-
-/**
- */
-public class AetherResult
-{
-    private DependencyNode root;
-    private List<File> resolvedFiles;
-    private String resolvedClassPath;
-    
-    public AetherResult( DependencyNode root, List<File> resolvedFiles, String resolvedClassPath
)
-    {
-        this.root = root;
-        this.resolvedFiles = resolvedFiles;
-        this.resolvedClassPath = resolvedClassPath;
-    }
-
-    public DependencyNode getRoot()
-    {
-        return root;
-    }
-
-    public List<File> getResolvedFiles()
-    {
-        return resolvedFiles;
-    }
-
-    public String getResolvedClassPath()
-    {
-        return resolvedClassPath;
-    }
-}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/DemoAetherModule.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/DemoAetherModule.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/DemoAetherModule.java
deleted file mode 100644
index 59f3d61..0000000
--- a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/DemoAetherModule.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.apache.maven.resolver.examples.guice;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *  http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.apache.maven.repository.internal.MavenAetherModule;
-import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
-import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
-import org.eclipse.aether.spi.connector.transport.TransporterFactory;
-import org.eclipse.aether.transport.file.FileTransporterFactory;
-import org.eclipse.aether.transport.http.HttpTransporterFactory;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.name.Names;
-
-class DemoAetherModule
-    extends AbstractModule
-{
-
-    @Override
-    protected void configure()
-    {
-        install( new MavenAetherModule() );
-        // alternatively, use the Guice Multibindings extensions
-        bind( RepositoryConnectorFactory.class ).annotatedWith( Names.named( "basic" ) ).to(
BasicRepositoryConnectorFactory.class );
-        bind( TransporterFactory.class ).annotatedWith( Names.named( "file" ) ).to( FileTransporterFactory.class
);
-        bind( TransporterFactory.class ).annotatedWith( Names.named( "http" ) ).to( HttpTransporterFactory.class
);
-    }
-
-    @Provides
-    @Singleton
-    Set<RepositoryConnectorFactory> provideRepositoryConnectorFactories( @Named( "basic"
) RepositoryConnectorFactory basic )
-    {
-        Set<RepositoryConnectorFactory> factories = new HashSet<RepositoryConnectorFactory>();
-        factories.add( basic );
-        return Collections.unmodifiableSet( factories );
-    }
-
-    @Provides
-    @Singleton
-    Set<TransporterFactory> provideTransporterFactories( @Named( "file" ) TransporterFactory
file,
-                                                         @Named( "http" ) TransporterFactory
http )
-    {
-        Set<TransporterFactory> factories = new HashSet<TransporterFactory>();
-        factories.add( file );
-        factories.add( http );
-        return Collections.unmodifiableSet( factories );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/DemoResolverModule.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/DemoResolverModule.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/DemoResolverModule.java
new file mode 100644
index 0000000..fcec471
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/DemoResolverModule.java
@@ -0,0 +1,74 @@
+package org.apache.maven.resolver.examples.guice;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.repository.internal.MavenAetherModule;
+import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
+import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
+import org.eclipse.aether.spi.connector.transport.TransporterFactory;
+import org.eclipse.aether.transport.file.FileTransporterFactory;
+import org.eclipse.aether.transport.http.HttpTransporterFactory;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.name.Names;
+
+class DemoResolverModule
+    extends AbstractModule
+{
+
+    @Override
+    protected void configure()
+    {
+        install( new MavenAetherModule() );
+        // alternatively, use the Guice Multibindings extensions
+        bind( RepositoryConnectorFactory.class ).annotatedWith( Names.named( "basic" ) ).to(
BasicRepositoryConnectorFactory.class );
+        bind( TransporterFactory.class ).annotatedWith( Names.named( "file" ) ).to( FileTransporterFactory.class
);
+        bind( TransporterFactory.class ).annotatedWith( Names.named( "http" ) ).to( HttpTransporterFactory.class
);
+    }
+
+    @Provides
+    @Singleton
+    Set<RepositoryConnectorFactory> provideRepositoryConnectorFactories( @Named( "basic"
) RepositoryConnectorFactory basic )
+    {
+        Set<RepositoryConnectorFactory> factories = new HashSet<RepositoryConnectorFactory>();
+        factories.add( basic );
+        return Collections.unmodifiableSet( factories );
+    }
+
+    @Provides
+    @Singleton
+    Set<TransporterFactory> provideTransporterFactories( @Named( "file" ) TransporterFactory
file,
+                                                         @Named( "http" ) TransporterFactory
http )
+    {
+        Set<TransporterFactory> factories = new HashSet<TransporterFactory>();
+        factories.add( file );
+        factories.add( http );
+        return Collections.unmodifiableSet( factories );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/GuiceRepositorySystemFactory.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/GuiceRepositorySystemFactory.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/GuiceRepositorySystemFactory.java
index eba5bf0..3ff0db0 100644
--- a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/GuiceRepositorySystemFactory.java
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/GuiceRepositorySystemFactory.java
@@ -31,7 +31,7 @@ public class GuiceRepositorySystemFactory
 
     public static RepositorySystem newRepositorySystem()
     {
-        return Guice.createInjector( new DemoAetherModule() ).getInstance( RepositorySystem.class
);
+        return Guice.createInjector( new DemoResolverModule() ).getInstance( RepositorySystem.class
);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/manual/ManualRepositorySystemFactory.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/manual/ManualRepositorySystemFactory.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/manual/ManualRepositorySystemFactory.java
index ce14d5a..04103d6 100644
--- a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/manual/ManualRepositorySystemFactory.java
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/manual/ManualRepositorySystemFactory.java
@@ -29,8 +29,8 @@ import org.eclipse.aether.transport.file.FileTransporterFactory;
 import org.eclipse.aether.transport.http.HttpTransporterFactory;
 
 /**
- * A factory for repository system instances that employs Aether's built-in service locator
infrastructure to wire up
- * the system's components.
+ * A factory for repository system instances that employs Maven Artifact Resolver's built-in
service locator
+ * infrastructure to wire up the system's components.
  */
 public class ManualRepositorySystemFactory
 {

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/plexus/PlexusRepositorySystemFactory.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/plexus/PlexusRepositorySystemFactory.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/plexus/PlexusRepositorySystemFactory.java
index e197624..616f19c 100644
--- a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/plexus/PlexusRepositorySystemFactory.java
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/plexus/PlexusRepositorySystemFactory.java
@@ -34,8 +34,8 @@ public class PlexusRepositorySystemFactory
     public static RepositorySystem newRepositorySystem()
     {
         /*
-         * Aether's components are equipped with plexus-specific metadata to enable discovery
and wiring of components
-         * by a Plexus container so this is as easy as looking up the implementation.
+         * Maven Artifact Resolver's components are equipped with plexus-specific metadata
to enable discovery and
+         * wiring of components by a Plexus container so this is as easy as looking up the
implementation.
          */
         try
         {

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/resolver/Resolver.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/resolver/Resolver.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/resolver/Resolver.java
new file mode 100644
index 0000000..ae07a4c
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/resolver/Resolver.java
@@ -0,0 +1,131 @@
+package org.apache.maven.resolver.examples.resolver;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import org.apache.maven.resolver.examples.util.Booter;
+import org.apache.maven.resolver.examples.util.ConsoleDependencyGraphDumper;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.collection.CollectRequest;
+import org.eclipse.aether.deployment.DeployRequest;
+import org.eclipse.aether.deployment.DeploymentException;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.installation.InstallRequest;
+import org.eclipse.aether.installation.InstallationException;
+import org.eclipse.aether.repository.Authentication;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.resolution.DependencyRequest;
+import org.eclipse.aether.resolution.DependencyResolutionException;
+import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator;
+import org.eclipse.aether.util.repository.AuthenticationBuilder;
+
+/**
+ */
+public class Resolver
+{
+    private String remoteRepository;
+
+    private RepositorySystem repositorySystem;
+
+    private LocalRepository localRepository;
+
+    public Resolver( String remoteRepository, String localRepository )
+    {
+        this.remoteRepository = remoteRepository;
+        this.repositorySystem = Booter.newRepositorySystem();
+        this.localRepository = new LocalRepository( localRepository );
+    }
+
+    private RepositorySystemSession newSession()
+    {
+        DefaultRepositorySystemSession session = Booter.newRepositorySystemSession( repositorySystem
);
+        session.setLocalRepositoryManager( repositorySystem.newLocalRepositoryManager( session,
localRepository ) );
+        return session;
+    }
+
+    public ResolverResult resolve( String groupId, String artifactId, String version )
+        throws DependencyResolutionException
+    {
+        RepositorySystemSession session = newSession();
+        Dependency dependency =
+            new Dependency( new DefaultArtifact( groupId, artifactId, "", "jar", version
), "runtime" );
+        RemoteRepository central = new RemoteRepository.Builder( "central", "default", remoteRepository
).build();
+
+        CollectRequest collectRequest = new CollectRequest();
+        collectRequest.setRoot( dependency );
+        collectRequest.addRepository( central );
+
+        DependencyRequest dependencyRequest = new DependencyRequest();
+        dependencyRequest.setCollectRequest( collectRequest );
+
+        DependencyNode rootNode = repositorySystem.resolveDependencies( session, dependencyRequest
).getRoot();
+
+        StringBuilder dump = new StringBuilder();
+        displayTree( rootNode, dump );
+
+        PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
+        rootNode.accept( nlg );
+
+        return new ResolverResult( rootNode, nlg.getFiles(), nlg.getClassPath() );
+    }
+
+    public void install( Artifact artifact, Artifact pom )
+        throws InstallationException
+    {
+        RepositorySystemSession session = newSession();
+
+        InstallRequest installRequest = new InstallRequest();
+        installRequest.addArtifact( artifact ).addArtifact( pom );
+
+        repositorySystem.install( session, installRequest );
+    }
+
+    public void deploy( Artifact artifact, Artifact pom, String remoteRepository )
+        throws DeploymentException
+    {
+        RepositorySystemSession session = newSession();
+
+        Authentication auth = new AuthenticationBuilder().addUsername( "admin" ).addPassword(
"admin123" ).build();
+        RemoteRepository nexus =
+            new RemoteRepository.Builder( "nexus", "default", remoteRepository ).setAuthentication(
auth ).build();
+
+        DeployRequest deployRequest = new DeployRequest();
+        deployRequest.addArtifact( artifact ).addArtifact( pom );
+        deployRequest.setRepository( nexus );
+
+        repositorySystem.deploy( session, deployRequest );
+    }
+
+    private void displayTree( DependencyNode node, StringBuilder sb )
+    {
+        ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+        node.accept( new ConsoleDependencyGraphDumper( new PrintStream( os ) ) );
+        sb.append( os.toString() );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/resolver/ResolverDemo.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/resolver/ResolverDemo.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/resolver/ResolverDemo.java
new file mode 100644
index 0000000..670dd1d
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/resolver/ResolverDemo.java
@@ -0,0 +1,78 @@
+package org.apache.maven.resolver.examples.resolver;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.deployment.DeploymentException;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.installation.InstallationException;
+import org.eclipse.aether.resolution.DependencyResolutionException;
+import org.eclipse.aether.util.artifact.SubArtifact;
+
+/**
+ */
+@SuppressWarnings( "unused" )
+public class ResolverDemo
+{
+
+    public void resolve() 
+        throws DependencyResolutionException
+    {
+        Resolver resolver = new Resolver( "http://localhost:8081/nexus/content/groups/public",
"target/aether-repo" );
+                
+        ResolverResult result = resolver.resolve( "com.mycompany.app", "super-app", "1.0"
);
+
+        // Get the root of the resolved tree of artifacts
+        //
+        DependencyNode root = result.getRoot();
+
+        // Get the list of files for the artifacts resolved
+        //
+        List<File> artifacts = result.getResolvedFiles();
+        
+        // Get the classpath of the artifacts resolved
+        //
+        String classpath = result.getResolvedClassPath();        
+    }
+    
+    public void installAndDeploy() 
+        throws InstallationException, DeploymentException
+    {
+        Resolver resolver = new Resolver( "http://localhost:8081/nexus/content/groups/public",
"target/aether-repo" );
+        
+        Artifact artifact = new DefaultArtifact( "com.mycompany.super", "super-core", "jar",
"0.1-SNAPSHOT" );
+        artifact = artifact.setFile( new File( "jar-from-whatever-process.jar" ) );
+        Artifact pom = new SubArtifact( artifact, null, "pom" );
+        pom = pom.setFile( new File( "pom-from-whatever-process.xml" ) );
+          
+        // Install into the local repository specified
+        //
+        resolver.install( artifact, pom );
+        
+        // Deploy to a remote reposistory
+        //
+        resolver.deploy( artifact, pom, "http://localhost:8081/nexus/content/repositories/snapshots/"
);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/cfc0c604/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/resolver/ResolverResult.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/resolver/ResolverResult.java
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/resolver/ResolverResult.java
new file mode 100644
index 0000000..2978441
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/resolver/ResolverResult.java
@@ -0,0 +1,56 @@
+package org.apache.maven.resolver.examples.resolver;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.aether.graph.DependencyNode;
+
+/**
+ */
+public class ResolverResult
+{
+    private DependencyNode root;
+    private List<File> resolvedFiles;
+    private String resolvedClassPath;
+    
+    public ResolverResult( DependencyNode root, List<File> resolvedFiles, String resolvedClassPath
)
+    {
+        this.root = root;
+        this.resolvedFiles = resolvedFiles;
+        this.resolvedClassPath = resolvedClassPath;
+    }
+
+    public DependencyNode getRoot()
+    {
+        return root;
+    }
+
+    public List<File> getResolvedFiles()
+    {
+        return resolvedFiles;
+    }
+
+    public String getResolvedClassPath()
+    {
+        return resolvedClassPath;
+    }
+}


Mime
View raw message