You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2016/09/15 21:19:32 UTC
[1/3] maven-resolver git commit: MNG-6007 renamed package to Maven
Artifact Resolver
Repository: maven-resolver
Updated Branches:
refs/heads/demo f2792b968 -> 089cab626
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/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
new file mode 100644
index 0000000..ce14d5a
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/manual/ManualRepositorySystemFactory.java
@@ -0,0 +1,62 @@
+package org.apache.maven.resolver.examples.manual;
+
+/*
+ * 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 org.apache.maven.repository.internal.MavenRepositorySystemUtils;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
+import org.eclipse.aether.impl.DefaultServiceLocator;
+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;
+
+/**
+ * A factory for repository system instances that employs Aether's built-in service locator infrastructure to wire up
+ * the system's components.
+ */
+public class ManualRepositorySystemFactory
+{
+
+ public static RepositorySystem newRepositorySystem()
+ {
+ /*
+ * Aether's components implement org.eclipse.aether.spi.locator.Service to ease manual wiring and using the
+ * prepopulated DefaultServiceLocator, we only need to register the repository connector and transporter
+ * factories.
+ */
+ DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
+ locator.addService( RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class );
+ locator.addService( TransporterFactory.class, FileTransporterFactory.class );
+ locator.addService( TransporterFactory.class, HttpTransporterFactory.class );
+
+ locator.setErrorHandler( new DefaultServiceLocator.ErrorHandler()
+ {
+ @Override
+ public void serviceCreationFailed( Class<?> type, Class<?> impl, Throwable exception )
+ {
+ exception.printStackTrace();
+ }
+ } );
+
+ return locator.getService( RepositorySystem.class );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/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
new file mode 100644
index 0000000..e197624
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/plexus/PlexusRepositorySystemFactory.java
@@ -0,0 +1,53 @@
+package org.apache.maven.resolver.examples.plexus;
+
+/*
+ * 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 org.codehaus.plexus.ContainerConfiguration;
+import org.codehaus.plexus.DefaultContainerConfiguration;
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.PlexusConstants;
+import org.eclipse.aether.RepositorySystem;
+
+/**
+ * A factory for repository system instances that employs Plexus to wire up the system's components.
+ */
+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.
+ */
+ try
+ {
+ ContainerConfiguration config = new DefaultContainerConfiguration();
+ config.setAutoWiring( true );
+ config.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
+ return new DefaultPlexusContainer( config ).lookup( RepositorySystem.class );
+ }
+ catch ( Exception e )
+ {
+ throw new IllegalStateException( "dependency injection failed", e );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/sisu/SisuRepositorySystemFactory.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/sisu/SisuRepositorySystemFactory.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/sisu/SisuRepositorySystemFactory.java
new file mode 100644
index 0000000..4373dab
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/sisu/SisuRepositorySystemFactory.java
@@ -0,0 +1,58 @@
+package org.apache.maven.resolver.examples.sisu;
+
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+
+import org.apache.maven.model.building.DefaultModelBuilderFactory;
+import org.apache.maven.model.building.ModelBuilder;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.sisu.launch.Main;
+
+/**
+ * A factory for repository system instances that employs Eclipse Sisu to wire up the system's components.
+ */
+@Named
+public class SisuRepositorySystemFactory
+{
+
+ @Inject
+ private RepositorySystem repositorySystem;
+
+ public static RepositorySystem newRepositorySystem()
+ {
+ return Main.boot( SisuRepositorySystemFactory.class ).repositorySystem;
+ }
+
+ @Named
+ private static class ModelBuilderProvider
+ implements Provider<ModelBuilder>
+ {
+
+ public ModelBuilder get()
+ {
+ return new DefaultModelBuilderFactory().newInstance();
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/Booter.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/Booter.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/Booter.java
new file mode 100644
index 0000000..62db10e
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/Booter.java
@@ -0,0 +1,73 @@
+package org.apache.maven.resolver.examples.util;
+
+/*
+ * 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.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * A helper to boot the repository system and a repository system session.
+ */
+public class Booter
+{
+
+ public static RepositorySystem newRepositorySystem()
+ {
+ return org.apache.maven.resolver.examples.manual.ManualRepositorySystemFactory.newRepositorySystem();
+ // return org.eclipse.aether.examples.guice.GuiceRepositorySystemFactory.newRepositorySystem();
+ // return org.eclipse.aether.examples.sisu.SisuRepositorySystemFactory.newRepositorySystem();
+ // return org.eclipse.aether.examples.plexus.PlexusRepositorySystemFactory.newRepositorySystem();
+ }
+
+ public static DefaultRepositorySystemSession newRepositorySystemSession( RepositorySystem system )
+ {
+ DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
+
+ LocalRepository localRepo = new LocalRepository( "target/local-repo" );
+ session.setLocalRepositoryManager( system.newLocalRepositoryManager( session, localRepo ) );
+
+ session.setTransferListener( new ConsoleTransferListener() );
+ session.setRepositoryListener( new ConsoleRepositoryListener() );
+
+ // uncomment to generate dirty trees
+ // session.setDependencyGraphTransformer( null );
+
+ return session;
+ }
+
+ public static List<RemoteRepository> newRepositories( RepositorySystem system, RepositorySystemSession session )
+ {
+ return new ArrayList<RemoteRepository>( Arrays.asList( newCentralRepository() ) );
+ }
+
+ private static RemoteRepository newCentralRepository()
+ {
+ return new RemoteRepository.Builder( "central", "default", "https://repo.maven.apache.org/maven2/" ).build();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleDependencyGraphDumper.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleDependencyGraphDumper.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleDependencyGraphDumper.java
new file mode 100644
index 0000000..ff0926e
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleDependencyGraphDumper.java
@@ -0,0 +1,157 @@
+package org.apache.maven.resolver.examples.util;
+
+/*
+ * 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.PrintStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.graph.DependencyVisitor;
+import org.eclipse.aether.util.artifact.ArtifactIdUtils;
+import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
+import org.eclipse.aether.util.graph.transformer.ConflictResolver;
+
+/**
+ * A dependency visitor that dumps the graph to the console.
+ */
+public class ConsoleDependencyGraphDumper
+ implements DependencyVisitor
+{
+
+ private PrintStream out;
+
+ private List<ChildInfo> childInfos = new ArrayList<ChildInfo>();
+
+ public ConsoleDependencyGraphDumper()
+ {
+ this( null );
+ }
+
+ public ConsoleDependencyGraphDumper( PrintStream out )
+ {
+ this.out = ( out != null ) ? out : System.out;
+ }
+
+ public boolean visitEnter( DependencyNode node )
+ {
+ out.println( formatIndentation() + formatNode( node ) );
+ childInfos.add( new ChildInfo( node.getChildren().size() ) );
+ return true;
+ }
+
+ private String formatIndentation()
+ {
+ StringBuilder buffer = new StringBuilder( 128 );
+ for ( Iterator<ChildInfo> it = childInfos.iterator(); it.hasNext(); )
+ {
+ buffer.append( it.next().formatIndentation( !it.hasNext() ) );
+ }
+ return buffer.toString();
+ }
+
+ private String formatNode( DependencyNode node )
+ {
+ StringBuilder buffer = new StringBuilder( 128 );
+ Artifact a = node.getArtifact();
+ Dependency d = node.getDependency();
+ buffer.append( a );
+ if ( d != null && d.getScope().length() > 0 )
+ {
+ buffer.append( " [" ).append( d.getScope() );
+ if ( d.isOptional() )
+ {
+ buffer.append( ", optional" );
+ }
+ buffer.append( "]" );
+ }
+ {
+ String premanaged = DependencyManagerUtils.getPremanagedVersion( node );
+ if ( premanaged != null && !premanaged.equals( a.getBaseVersion() ) )
+ {
+ buffer.append( " (version managed from " ).append( premanaged ).append( ")" );
+ }
+ }
+ {
+ String premanaged = DependencyManagerUtils.getPremanagedScope( node );
+ if ( premanaged != null && !premanaged.equals( d.getScope() ) )
+ {
+ buffer.append( " (scope managed from " ).append( premanaged ).append( ")" );
+ }
+ }
+ DependencyNode winner = (DependencyNode) node.getData().get( ConflictResolver.NODE_DATA_WINNER );
+ if ( winner != null && !ArtifactIdUtils.equalsId( a, winner.getArtifact() ) )
+ {
+ Artifact w = winner.getArtifact();
+ buffer.append( " (conflicts with " );
+ if ( ArtifactIdUtils.toVersionlessId( a ).equals( ArtifactIdUtils.toVersionlessId( w ) ) )
+ {
+ buffer.append( w.getVersion() );
+ }
+ else
+ {
+ buffer.append( w );
+ }
+ buffer.append( ")" );
+ }
+ return buffer.toString();
+ }
+
+ public boolean visitLeave( DependencyNode node )
+ {
+ if ( !childInfos.isEmpty() )
+ {
+ childInfos.remove( childInfos.size() - 1 );
+ }
+ if ( !childInfos.isEmpty() )
+ {
+ childInfos.get( childInfos.size() - 1 ).index++;
+ }
+ return true;
+ }
+
+ private static class ChildInfo
+ {
+
+ final int count;
+
+ int index;
+
+ public ChildInfo( int count )
+ {
+ this.count = count;
+ }
+
+ public String formatIndentation( boolean end )
+ {
+ boolean last = index + 1 >= count;
+ if ( end )
+ {
+ return last ? "\\- " : "+- ";
+ }
+ return last ? " " : "| ";
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleRepositoryListener.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleRepositoryListener.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleRepositoryListener.java
new file mode 100644
index 0000000..e1ffccf
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleRepositoryListener.java
@@ -0,0 +1,132 @@
+package org.apache.maven.resolver.examples.util;
+
+/*
+ * 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.PrintStream;
+
+import org.eclipse.aether.AbstractRepositoryListener;
+import org.eclipse.aether.RepositoryEvent;
+
+/**
+ * A simplistic repository listener that logs events to the console.
+ */
+public class ConsoleRepositoryListener
+ extends AbstractRepositoryListener
+{
+
+ private PrintStream out;
+
+ public ConsoleRepositoryListener()
+ {
+ this( null );
+ }
+
+ public ConsoleRepositoryListener( PrintStream out )
+ {
+ this.out = ( out != null ) ? out : System.out;
+ }
+
+ public void artifactDeployed( RepositoryEvent event )
+ {
+ out.println( "Deployed " + event.getArtifact() + " to " + event.getRepository() );
+ }
+
+ public void artifactDeploying( RepositoryEvent event )
+ {
+ out.println( "Deploying " + event.getArtifact() + " to " + event.getRepository() );
+ }
+
+ public void artifactDescriptorInvalid( RepositoryEvent event )
+ {
+ out.println( "Invalid artifact descriptor for " + event.getArtifact() + ": "
+ + event.getException().getMessage() );
+ }
+
+ public void artifactDescriptorMissing( RepositoryEvent event )
+ {
+ out.println( "Missing artifact descriptor for " + event.getArtifact() );
+ }
+
+ public void artifactInstalled( RepositoryEvent event )
+ {
+ out.println( "Installed " + event.getArtifact() + " to " + event.getFile() );
+ }
+
+ public void artifactInstalling( RepositoryEvent event )
+ {
+ out.println( "Installing " + event.getArtifact() + " to " + event.getFile() );
+ }
+
+ public void artifactResolved( RepositoryEvent event )
+ {
+ out.println( "Resolved artifact " + event.getArtifact() + " from " + event.getRepository() );
+ }
+
+ public void artifactDownloading( RepositoryEvent event )
+ {
+ out.println( "Downloading artifact " + event.getArtifact() + " from " + event.getRepository() );
+ }
+
+ public void artifactDownloaded( RepositoryEvent event )
+ {
+ out.println( "Downloaded artifact " + event.getArtifact() + " from " + event.getRepository() );
+ }
+
+ public void artifactResolving( RepositoryEvent event )
+ {
+ out.println( "Resolving artifact " + event.getArtifact() );
+ }
+
+ public void metadataDeployed( RepositoryEvent event )
+ {
+ out.println( "Deployed " + event.getMetadata() + " to " + event.getRepository() );
+ }
+
+ public void metadataDeploying( RepositoryEvent event )
+ {
+ out.println( "Deploying " + event.getMetadata() + " to " + event.getRepository() );
+ }
+
+ public void metadataInstalled( RepositoryEvent event )
+ {
+ out.println( "Installed " + event.getMetadata() + " to " + event.getFile() );
+ }
+
+ public void metadataInstalling( RepositoryEvent event )
+ {
+ out.println( "Installing " + event.getMetadata() + " to " + event.getFile() );
+ }
+
+ public void metadataInvalid( RepositoryEvent event )
+ {
+ out.println( "Invalid metadata " + event.getMetadata() );
+ }
+
+ public void metadataResolved( RepositoryEvent event )
+ {
+ out.println( "Resolved metadata " + event.getMetadata() + " from " + event.getRepository() );
+ }
+
+ public void metadataResolving( RepositoryEvent event )
+ {
+ out.println( "Resolving metadata " + event.getMetadata() + " from " + event.getRepository() );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleTransferListener.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleTransferListener.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleTransferListener.java
new file mode 100644
index 0000000..3b3c959
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleTransferListener.java
@@ -0,0 +1,178 @@
+package org.apache.maven.resolver.examples.util;
+
+/*
+ * 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.PrintStream;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.eclipse.aether.transfer.AbstractTransferListener;
+import org.eclipse.aether.transfer.MetadataNotFoundException;
+import org.eclipse.aether.transfer.TransferEvent;
+import org.eclipse.aether.transfer.TransferResource;
+
+/**
+ * A simplistic transfer listener that logs uploads/downloads to the console.
+ */
+public class ConsoleTransferListener
+ extends AbstractTransferListener
+{
+
+ private PrintStream out;
+
+ private Map<TransferResource, Long> downloads = new ConcurrentHashMap<TransferResource, Long>();
+
+ private int lastLength;
+
+ public ConsoleTransferListener()
+ {
+ this( null );
+ }
+
+ public ConsoleTransferListener( PrintStream out )
+ {
+ this.out = ( out != null ) ? out : System.out;
+ }
+
+ @Override
+ public void transferInitiated( TransferEvent event )
+ {
+ String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";
+
+ out.println( message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName() );
+ }
+
+ @Override
+ public void transferProgressed( TransferEvent event )
+ {
+ TransferResource resource = event.getResource();
+ downloads.put( resource, Long.valueOf( event.getTransferredBytes() ) );
+
+ StringBuilder buffer = new StringBuilder( 64 );
+
+ for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() )
+ {
+ long total = entry.getKey().getContentLength();
+ long complete = entry.getValue().longValue();
+
+ buffer.append( getStatus( complete, total ) ).append( " " );
+ }
+
+ int pad = lastLength - buffer.length();
+ lastLength = buffer.length();
+ pad( buffer, pad );
+ buffer.append( '\r' );
+
+ out.print( buffer );
+ }
+
+ private String getStatus( long complete, long total )
+ {
+ if ( total >= 1024 )
+ {
+ return toKB( complete ) + "/" + toKB( total ) + " KB ";
+ }
+ else if ( total >= 0 )
+ {
+ return complete + "/" + total + " B ";
+ }
+ else if ( complete >= 1024 )
+ {
+ return toKB( complete ) + " KB ";
+ }
+ else
+ {
+ return complete + " B ";
+ }
+ }
+
+ private void pad( StringBuilder buffer, int spaces )
+ {
+ String block = " ";
+ while ( spaces > 0 )
+ {
+ int n = Math.min( spaces, block.length() );
+ buffer.append( block, 0, n );
+ spaces -= n;
+ }
+ }
+
+ @Override
+ public void transferSucceeded( TransferEvent event )
+ {
+ transferCompleted( event );
+
+ TransferResource resource = event.getResource();
+ long contentLength = event.getTransferredBytes();
+ if ( contentLength >= 0 )
+ {
+ String type = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
+ String len = contentLength >= 1024 ? toKB( contentLength ) + " KB" : contentLength + " B";
+
+ String throughput = "";
+ long duration = System.currentTimeMillis() - resource.getTransferStartTime();
+ if ( duration > 0 )
+ {
+ long bytes = contentLength - resource.getResumeOffset();
+ DecimalFormat format = new DecimalFormat( "0.0", new DecimalFormatSymbols( Locale.ENGLISH ) );
+ double kbPerSec = ( bytes / 1024.0 ) / ( duration / 1000.0 );
+ throughput = " at " + format.format( kbPerSec ) + " KB/sec";
+ }
+
+ out.println( type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
+ + throughput + ")" );
+ }
+ }
+
+ @Override
+ public void transferFailed( TransferEvent event )
+ {
+ transferCompleted( event );
+
+ if ( !( event.getException() instanceof MetadataNotFoundException ) )
+ {
+ event.getException().printStackTrace( out );
+ }
+ }
+
+ private void transferCompleted( TransferEvent event )
+ {
+ downloads.remove( event.getResource() );
+
+ StringBuilder buffer = new StringBuilder( 64 );
+ pad( buffer, lastLength );
+ buffer.append( '\r' );
+ out.print( buffer );
+ }
+
+ public void transferCorrupted( TransferEvent event )
+ {
+ event.getException().printStackTrace( out );
+ }
+
+ protected long toKB( long bytes )
+ {
+ return ( bytes + 1023 ) / 1024;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/site/site.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/site/site.xml b/maven-resolver-demo-snippets/src/site/site.xml
new file mode 100644
index 0000000..3a16bf9
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/site/site.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+ <body>
+ <menu name="Overview">
+ <item name="Introduction" href="index.html"/>
+ <item name="JavaDocs" href="apidocs/index.html"/>
+ <item name="Source Xref" href="xref/index.html"/>
+ <!--item name="FAQ" href="faq.html"/-->
+ </menu>
+
+ <menu ref="parent"/>
+ <menu ref="reports"/>
+ </body>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0db86a1..cb7ac22 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,32 +29,32 @@
<version>27</version>
</parent>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether-demos</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-demos</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
- <name>Aether Demos</name>
+ <name>Maven Artifact Resolver Demos</name>
<description>
- The parent for the Aether demos.
+ The parent for the Maven Artifact Resolver demos.
</description>
- <url>http://maven.apache.org/aether-demos/</url>
+ <url>https://maven.apache.org/resolver-demos/</url>
<inceptionYear>2010</inceptionYear>
<scm>
- <connection>scm:git:https://git-wip-us.apache.org/repos/asf/maven-aether.git</connection>
- <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/maven-aether.git</developerConnection>
- <url>https://github.com/apache/maven-aether/tree/${project.scm.tag}</url>
+ <connection>scm:git:https://git-wip-us.apache.org/repos/asf/maven-resolver.git</connection>
+ <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/maven-resolver.git</developerConnection>
+ <url>https://github.com/apache/maven-resolver/tree/${project.scm.tag}</url>
<tag>demo</tag>
</scm>
- <!--issueManagement>
+ <issueManagement>
<system>jira</system>
- <url>https://issues.apache.org/jira/browse/</url>
+ <url>https://issues.apache.org/jira/browse/MRESOLVER</url>
</issueManagement>
<ciManagement>
<system>Jenkins</system>
- <url>https://builds.apache.org/job/</url>
- </ciManagement-->
+ <url>https://builds.apache.org/job/maven-resolver-demos</url>
+ </ciManagement>
<distributionManagement>
<site>
<id>apache.website</id>
@@ -63,12 +63,12 @@
</distributionManagement>
<modules>
- <module>aether-demo-snippets</module>
- <module>aether-demo-maven-plugin</module>
+ <module>maven-resolver-demo-snippets</module>
+ <module>maven-resolver-demo-maven-plugin</module>
</modules>
<properties>
- <maven.site.path>aether-archives/aether-demos-LATEST</maven.site.path>
+ <maven.site.path>resolver-archives/resolver-demos-LATEST</maven.site.path>
<checkstyle.violation.ignore>LineLength,MagicNumber,AvoidNestedBlocks</checkstyle.violation.ignore>
</properties>
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/src/site/site.xml
----------------------------------------------------------------------
diff --git a/src/site/site.xml b/src/site/site.xml
index 63dc357..6462dee 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -21,13 +21,7 @@ under the License.
<project xmlns="http://maven.apache.org/DECORATION/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 http://maven.apache.org/xsd/decoration-1.1.0.xsd"
- name="Aether Demos">
-
- <custom>
- <fluidoSkin>
- <profile>sandbox</profile>
- </fluidoSkin>
- </custom>
+ name="Maven Artifact Resolver Demos">
<body>
<menu name="Overview">
[2/3] maven-resolver git commit: MNG-6007 renamed package to Maven
Artifact Resolver
Posted by hb...@apache.org.
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/ConsoleDependencyGraphDumper.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/ConsoleDependencyGraphDumper.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/ConsoleDependencyGraphDumper.java
deleted file mode 100644
index 21e5c72..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/ConsoleDependencyGraphDumper.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.apache.maven.aether.examples.util;
-
-/*
- * 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.PrintStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.graph.DependencyVisitor;
-import org.eclipse.aether.util.artifact.ArtifactIdUtils;
-import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
-import org.eclipse.aether.util.graph.transformer.ConflictResolver;
-
-/**
- * A dependency visitor that dumps the graph to the console.
- */
-public class ConsoleDependencyGraphDumper
- implements DependencyVisitor
-{
-
- private PrintStream out;
-
- private List<ChildInfo> childInfos = new ArrayList<ChildInfo>();
-
- public ConsoleDependencyGraphDumper()
- {
- this( null );
- }
-
- public ConsoleDependencyGraphDumper( PrintStream out )
- {
- this.out = ( out != null ) ? out : System.out;
- }
-
- public boolean visitEnter( DependencyNode node )
- {
- out.println( formatIndentation() + formatNode( node ) );
- childInfos.add( new ChildInfo( node.getChildren().size() ) );
- return true;
- }
-
- private String formatIndentation()
- {
- StringBuilder buffer = new StringBuilder( 128 );
- for ( Iterator<ChildInfo> it = childInfos.iterator(); it.hasNext(); )
- {
- buffer.append( it.next().formatIndentation( !it.hasNext() ) );
- }
- return buffer.toString();
- }
-
- private String formatNode( DependencyNode node )
- {
- StringBuilder buffer = new StringBuilder( 128 );
- Artifact a = node.getArtifact();
- Dependency d = node.getDependency();
- buffer.append( a );
- if ( d != null && d.getScope().length() > 0 )
- {
- buffer.append( " [" ).append( d.getScope() );
- if ( d.isOptional() )
- {
- buffer.append( ", optional" );
- }
- buffer.append( "]" );
- }
- {
- String premanaged = DependencyManagerUtils.getPremanagedVersion( node );
- if ( premanaged != null && !premanaged.equals( a.getBaseVersion() ) )
- {
- buffer.append( " (version managed from " ).append( premanaged ).append( ")" );
- }
- }
- {
- String premanaged = DependencyManagerUtils.getPremanagedScope( node );
- if ( premanaged != null && !premanaged.equals( d.getScope() ) )
- {
- buffer.append( " (scope managed from " ).append( premanaged ).append( ")" );
- }
- }
- DependencyNode winner = (DependencyNode) node.getData().get( ConflictResolver.NODE_DATA_WINNER );
- if ( winner != null && !ArtifactIdUtils.equalsId( a, winner.getArtifact() ) )
- {
- Artifact w = winner.getArtifact();
- buffer.append( " (conflicts with " );
- if ( ArtifactIdUtils.toVersionlessId( a ).equals( ArtifactIdUtils.toVersionlessId( w ) ) )
- {
- buffer.append( w.getVersion() );
- }
- else
- {
- buffer.append( w );
- }
- buffer.append( ")" );
- }
- return buffer.toString();
- }
-
- public boolean visitLeave( DependencyNode node )
- {
- if ( !childInfos.isEmpty() )
- {
- childInfos.remove( childInfos.size() - 1 );
- }
- if ( !childInfos.isEmpty() )
- {
- childInfos.get( childInfos.size() - 1 ).index++;
- }
- return true;
- }
-
- private static class ChildInfo
- {
-
- final int count;
-
- int index;
-
- public ChildInfo( int count )
- {
- this.count = count;
- }
-
- public String formatIndentation( boolean end )
- {
- boolean last = index + 1 >= count;
- if ( end )
- {
- return last ? "\\- " : "+- ";
- }
- return last ? " " : "| ";
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/ConsoleRepositoryListener.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/ConsoleRepositoryListener.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/ConsoleRepositoryListener.java
deleted file mode 100644
index f7797dd..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/ConsoleRepositoryListener.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.apache.maven.aether.examples.util;
-
-/*
- * 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.PrintStream;
-
-import org.eclipse.aether.AbstractRepositoryListener;
-import org.eclipse.aether.RepositoryEvent;
-
-/**
- * A simplistic repository listener that logs events to the console.
- */
-public class ConsoleRepositoryListener
- extends AbstractRepositoryListener
-{
-
- private PrintStream out;
-
- public ConsoleRepositoryListener()
- {
- this( null );
- }
-
- public ConsoleRepositoryListener( PrintStream out )
- {
- this.out = ( out != null ) ? out : System.out;
- }
-
- public void artifactDeployed( RepositoryEvent event )
- {
- out.println( "Deployed " + event.getArtifact() + " to " + event.getRepository() );
- }
-
- public void artifactDeploying( RepositoryEvent event )
- {
- out.println( "Deploying " + event.getArtifact() + " to " + event.getRepository() );
- }
-
- public void artifactDescriptorInvalid( RepositoryEvent event )
- {
- out.println( "Invalid artifact descriptor for " + event.getArtifact() + ": "
- + event.getException().getMessage() );
- }
-
- public void artifactDescriptorMissing( RepositoryEvent event )
- {
- out.println( "Missing artifact descriptor for " + event.getArtifact() );
- }
-
- public void artifactInstalled( RepositoryEvent event )
- {
- out.println( "Installed " + event.getArtifact() + " to " + event.getFile() );
- }
-
- public void artifactInstalling( RepositoryEvent event )
- {
- out.println( "Installing " + event.getArtifact() + " to " + event.getFile() );
- }
-
- public void artifactResolved( RepositoryEvent event )
- {
- out.println( "Resolved artifact " + event.getArtifact() + " from " + event.getRepository() );
- }
-
- public void artifactDownloading( RepositoryEvent event )
- {
- out.println( "Downloading artifact " + event.getArtifact() + " from " + event.getRepository() );
- }
-
- public void artifactDownloaded( RepositoryEvent event )
- {
- out.println( "Downloaded artifact " + event.getArtifact() + " from " + event.getRepository() );
- }
-
- public void artifactResolving( RepositoryEvent event )
- {
- out.println( "Resolving artifact " + event.getArtifact() );
- }
-
- public void metadataDeployed( RepositoryEvent event )
- {
- out.println( "Deployed " + event.getMetadata() + " to " + event.getRepository() );
- }
-
- public void metadataDeploying( RepositoryEvent event )
- {
- out.println( "Deploying " + event.getMetadata() + " to " + event.getRepository() );
- }
-
- public void metadataInstalled( RepositoryEvent event )
- {
- out.println( "Installed " + event.getMetadata() + " to " + event.getFile() );
- }
-
- public void metadataInstalling( RepositoryEvent event )
- {
- out.println( "Installing " + event.getMetadata() + " to " + event.getFile() );
- }
-
- public void metadataInvalid( RepositoryEvent event )
- {
- out.println( "Invalid metadata " + event.getMetadata() );
- }
-
- public void metadataResolved( RepositoryEvent event )
- {
- out.println( "Resolved metadata " + event.getMetadata() + " from " + event.getRepository() );
- }
-
- public void metadataResolving( RepositoryEvent event )
- {
- out.println( "Resolving metadata " + event.getMetadata() + " from " + event.getRepository() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/ConsoleTransferListener.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/ConsoleTransferListener.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/ConsoleTransferListener.java
deleted file mode 100644
index 96ff6b3..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/ConsoleTransferListener.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package org.apache.maven.aether.examples.util;
-
-/*
- * 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.PrintStream;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
-import java.util.Locale;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.eclipse.aether.transfer.AbstractTransferListener;
-import org.eclipse.aether.transfer.MetadataNotFoundException;
-import org.eclipse.aether.transfer.TransferEvent;
-import org.eclipse.aether.transfer.TransferResource;
-
-/**
- * A simplistic transfer listener that logs uploads/downloads to the console.
- */
-public class ConsoleTransferListener
- extends AbstractTransferListener
-{
-
- private PrintStream out;
-
- private Map<TransferResource, Long> downloads = new ConcurrentHashMap<TransferResource, Long>();
-
- private int lastLength;
-
- public ConsoleTransferListener()
- {
- this( null );
- }
-
- public ConsoleTransferListener( PrintStream out )
- {
- this.out = ( out != null ) ? out : System.out;
- }
-
- @Override
- public void transferInitiated( TransferEvent event )
- {
- String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";
-
- out.println( message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName() );
- }
-
- @Override
- public void transferProgressed( TransferEvent event )
- {
- TransferResource resource = event.getResource();
- downloads.put( resource, Long.valueOf( event.getTransferredBytes() ) );
-
- StringBuilder buffer = new StringBuilder( 64 );
-
- for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() )
- {
- long total = entry.getKey().getContentLength();
- long complete = entry.getValue().longValue();
-
- buffer.append( getStatus( complete, total ) ).append( " " );
- }
-
- int pad = lastLength - buffer.length();
- lastLength = buffer.length();
- pad( buffer, pad );
- buffer.append( '\r' );
-
- out.print( buffer );
- }
-
- private String getStatus( long complete, long total )
- {
- if ( total >= 1024 )
- {
- return toKB( complete ) + "/" + toKB( total ) + " KB ";
- }
- else if ( total >= 0 )
- {
- return complete + "/" + total + " B ";
- }
- else if ( complete >= 1024 )
- {
- return toKB( complete ) + " KB ";
- }
- else
- {
- return complete + " B ";
- }
- }
-
- private void pad( StringBuilder buffer, int spaces )
- {
- String block = " ";
- while ( spaces > 0 )
- {
- int n = Math.min( spaces, block.length() );
- buffer.append( block, 0, n );
- spaces -= n;
- }
- }
-
- @Override
- public void transferSucceeded( TransferEvent event )
- {
- transferCompleted( event );
-
- TransferResource resource = event.getResource();
- long contentLength = event.getTransferredBytes();
- if ( contentLength >= 0 )
- {
- String type = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
- String len = contentLength >= 1024 ? toKB( contentLength ) + " KB" : contentLength + " B";
-
- String throughput = "";
- long duration = System.currentTimeMillis() - resource.getTransferStartTime();
- if ( duration > 0 )
- {
- long bytes = contentLength - resource.getResumeOffset();
- DecimalFormat format = new DecimalFormat( "0.0", new DecimalFormatSymbols( Locale.ENGLISH ) );
- double kbPerSec = ( bytes / 1024.0 ) / ( duration / 1000.0 );
- throughput = " at " + format.format( kbPerSec ) + " KB/sec";
- }
-
- out.println( type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
- + throughput + ")" );
- }
- }
-
- @Override
- public void transferFailed( TransferEvent event )
- {
- transferCompleted( event );
-
- if ( !( event.getException() instanceof MetadataNotFoundException ) )
- {
- event.getException().printStackTrace( out );
- }
- }
-
- private void transferCompleted( TransferEvent event )
- {
- downloads.remove( event.getResource() );
-
- StringBuilder buffer = new StringBuilder( 64 );
- pad( buffer, lastLength );
- buffer.append( '\r' );
- out.print( buffer );
- }
-
- public void transferCorrupted( TransferEvent event )
- {
- event.getException().printStackTrace( out );
- }
-
- protected long toKB( long bytes )
- {
- return ( bytes + 1023 ) / 1024;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/site/site.xml
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/site/site.xml b/aether-demo-snippets/src/site/site.xml
deleted file mode 100644
index 3a16bf9..0000000
--- a/aether-demo-snippets/src/site/site.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-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.
--->
-
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
- <body>
- <menu name="Overview">
- <item name="Introduction" href="index.html"/>
- <item name="JavaDocs" href="apidocs/index.html"/>
- <item name="Source Xref" href="xref/index.html"/>
- <!--item name="FAQ" href="faq.html"/-->
- </menu>
-
- <menu ref="parent"/>
- <menu ref="reports"/>
- </body>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-maven-plugin/pom.xml b/maven-resolver-demo-maven-plugin/pom.xml
new file mode 100644
index 0000000..59a7b13
--- /dev/null
+++ b/maven-resolver-demo-maven-plugin/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-demos</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>maven-resolver-demo-maven-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+
+ <name>Maven Artifact Resolver Demo Maven Plugin</name>
+ <description>
+ A simple Maven plugin using Maven Artifact Resolver.
+ </description>
+ <inceptionYear>2010</inceptionYear>
+
+ <prerequisites>
+ <maven>3.1.0-alpha-1</maven>
+ </prerequisites>
+
+ <properties>
+ <mavenVersion>3.1.0</mavenVersion>
+ <aetherVersion>0.9.0.M2</aetherVersion>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${mavenVersion}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.sisu</groupId>
+ <artifactId>org.eclipse.sisu.plexus</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-api</artifactId>
+ <version>${aetherVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-util</artifactId>
+ <version>${aetherVersion}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>run-its</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.5</version>
+ <configuration>
+ <debug>false</debug>
+ <projectsDirectory>src/it</projectsDirectory>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ <preBuildHookScript>setup</preBuildHookScript>
+ <postBuildHookScript>verify</postBuildHookScript>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <goals>
+ <goal>clean</goal>
+ <goal>validate</goal>
+ </goals>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-maven-plugin/src/it/resolve-artifact/pom.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-maven-plugin/src/it/resolve-artifact/pom.xml b/maven-resolver-demo-maven-plugin/src/it/resolve-artifact/pom.xml
new file mode 100644
index 0000000..4426589
--- /dev/null
+++ b/maven-resolver-demo-maven-plugin/src/it/resolve-artifact/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.resolver.demo.its.ra</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>resolve-artifact</goal>
+ </goals>
+ <configuration>
+ <artifactCoords>junit:junit:3.8.2</artifactCoords>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-maven-plugin/src/it/settings.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-maven-plugin/src/it/settings.xml b/maven-resolver-demo-maven-plugin/src/it/settings.xml
new file mode 100644
index 0000000..dd86293
--- /dev/null
+++ b/maven-resolver-demo-maven-plugin/src/it/settings.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<settings>
+ <profiles>
+ <profile>
+ <id>it-repo</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+</settings>
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/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
new file mode 100644
index 0000000..db024a2
--- /dev/null
+++ b/maven-resolver-demo-maven-plugin/src/main/java/org/apache/maven/resolver/examples/maven/ResolveArtifactMojo.java
@@ -0,0 +1,108 @@
+package org.apache.maven.resolver.examples.maven;
+
+/*
+ * 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.List;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+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.repository.RemoteRepository;
+import org.eclipse.aether.resolution.ArtifactRequest;
+import org.eclipse.aether.resolution.ArtifactResolutionException;
+import org.eclipse.aether.resolution.ArtifactResult;
+
+/**
+ * Resolves a single artifact (not including its transitive dependencies).
+ *
+ * @goal resolve-artifact
+ */
+public class ResolveArtifactMojo
+ extends AbstractMojo
+{
+
+ /**
+ * The entry point to Aether, i.e. the component doing all the work.
+ *
+ * @component
+ */
+ private RepositorySystem repoSystem;
+
+ /**
+ * The current repository/network configuration of Maven.
+ *
+ * @parameter default-value="${repositorySystemSession}"
+ * @readonly
+ */
+ private RepositorySystemSession repoSession;
+
+ /**
+ * The project's remote repositories to use for the resolution.
+ *
+ * @parameter default-value="${project.remoteProjectRepositories}"
+ * @readonly
+ */
+ private List<RemoteRepository> remoteRepos;
+
+ /**
+ * The {@code <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>} of the artifact to resolve.
+ *
+ * @parameter property="aether.artifactCoords"
+ */
+ private String artifactCoords;
+
+ public void execute()
+ throws MojoExecutionException, MojoFailureException
+ {
+ Artifact artifact;
+ try
+ {
+ artifact = new DefaultArtifact( artifactCoords );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ throw new MojoFailureException( e.getMessage(), e );
+ }
+
+ ArtifactRequest request = new ArtifactRequest();
+ request.setArtifact( artifact );
+ request.setRepositories( remoteRepos );
+
+ getLog().info( "Resolving artifact " + artifact + " from " + remoteRepos );
+
+ ArtifactResult result;
+ try
+ {
+ result = repoSystem.resolveArtifact( repoSession, request );
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new MojoExecutionException( e.getMessage(), e );
+ }
+
+ getLog().info( "Resolved artifact " + artifact + " to " + result.getArtifact().getFile() + " from "
+ + result.getRepository() );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-maven-plugin/src/site/site.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-maven-plugin/src/site/site.xml b/maven-resolver-demo-maven-plugin/src/site/site.xml
new file mode 100644
index 0000000..3a16bf9
--- /dev/null
+++ b/maven-resolver-demo-maven-plugin/src/site/site.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+ <body>
+ <menu name="Overview">
+ <item name="Introduction" href="index.html"/>
+ <item name="JavaDocs" href="apidocs/index.html"/>
+ <item name="Source Xref" href="xref/index.html"/>
+ <!--item name="FAQ" href="faq.html"/-->
+ </menu>
+
+ <menu ref="parent"/>
+ <menu ref="reports"/>
+ </body>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/pom.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/pom.xml b/maven-resolver-demo-snippets/pom.xml
new file mode 100644
index 0000000..8232998
--- /dev/null
+++ b/maven-resolver-demo-snippets/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-demos</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>maven-resolver-demo-snippets</artifactId>
+
+ <name>Maven ArtifactResolver Demo Snippets</name>
+ <description>
+ A module to demonstrate the usage of Maven Artifact Resolver by means of various runnable code snippets.
+ </description>
+
+ <properties>
+ <aetherVersion>1.0.0.v20140518</aetherVersion>
+ <mavenVersion>3.1.0</mavenVersion>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-api</artifactId>
+ <version>${aetherVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-spi</artifactId>
+ <version>${aetherVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-util</artifactId>
+ <version>${aetherVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-impl</artifactId>
+ <version>${aetherVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-connector-basic</artifactId>
+ <version>${aetherVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-transport-file</artifactId>
+ <version>${aetherVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-transport-http</artifactId>
+ <version>${aetherVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-aether-provider</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.sisu</groupId>
+ <artifactId>org.eclipse.sisu.plexus</artifactId>
+ <version>0.1.1</version>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.sonatype.sisu</groupId>
+ <artifactId>sisu-guice</artifactId>
+ <version>3.1.6</version>
+ <classifier>no_aop</classifier>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>aopalliance</groupId>
+ <artifactId>aopalliance</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>jsr305</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/data/demo.jar
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/data/demo.jar b/maven-resolver-demo-snippets/src/main/data/demo.jar
new file mode 100644
index 0000000..5fcb2f7
Binary files /dev/null and b/maven-resolver-demo-snippets/src/main/data/demo.jar differ
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/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
new file mode 100644
index 0000000..8f25ac7
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/AllAetherDemos.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 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/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/DeployArtifacts.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/DeployArtifacts.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/DeployArtifacts.java
new file mode 100644
index 0000000..63a59d2
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/DeployArtifacts.java
@@ -0,0 +1,66 @@
+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.
+ */
+
+import java.io.File;
+
+import org.apache.maven.resolver.examples.util.Booter;
+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.deployment.DeployRequest;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.util.artifact.SubArtifact;
+
+/**
+ * Deploys a JAR and its POM to a remote repository.
+ */
+public class DeployArtifacts
+{
+
+ public static void main( String[] args )
+ throws Exception
+ {
+ System.out.println( "------------------------------------------------------------" );
+ System.out.println( DeployArtifacts.class.getSimpleName() );
+
+ RepositorySystem system = Booter.newRepositorySystem();
+
+ RepositorySystemSession session = Booter.newRepositorySystemSession( system );
+
+ Artifact jarArtifact = new DefaultArtifact( "test", "org.apache.maven.aether.examples", "", "jar", "0.1-SNAPSHOT" );
+ jarArtifact = jarArtifact.setFile( new File( "src/main/data/demo.jar" ) );
+
+ Artifact pomArtifact = new SubArtifact( jarArtifact, "", "pom" );
+ pomArtifact = pomArtifact.setFile( new File( "pom.xml" ) );
+
+ RemoteRepository distRepo =
+ new RemoteRepository.Builder( "org.apache.maven.aether.examples", "default",
+ new File( "target/dist-repo" ).toURI().toString() ).build();
+
+ DeployRequest deployRequest = new DeployRequest();
+ deployRequest.addArtifact( jarArtifact ).addArtifact( pomArtifact );
+ deployRequest.setRepository( distRepo );
+
+ system.deploy( session, deployRequest );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/FindAvailableVersions.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/FindAvailableVersions.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/FindAvailableVersions.java
new file mode 100644
index 0000000..148b847
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/FindAvailableVersions.java
@@ -0,0 +1,62 @@
+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.
+ */
+
+import java.util.List;
+
+import org.apache.maven.resolver.examples.util.Booter;
+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.resolution.VersionRangeRequest;
+import org.eclipse.aether.resolution.VersionRangeResult;
+import org.eclipse.aether.version.Version;
+
+/**
+ * Determines all available versions of an artifact.
+ */
+public class FindAvailableVersions
+{
+
+ public static void main( String[] args )
+ throws Exception
+ {
+ System.out.println( "------------------------------------------------------------" );
+ System.out.println( FindAvailableVersions.class.getSimpleName() );
+
+ RepositorySystem system = Booter.newRepositorySystem();
+
+ RepositorySystemSession session = Booter.newRepositorySystemSession( system );
+
+ Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-util:[0,)" );
+
+ VersionRangeRequest rangeRequest = new VersionRangeRequest();
+ rangeRequest.setArtifact( artifact );
+ rangeRequest.setRepositories( Booter.newRepositories( system, session ) );
+
+ VersionRangeResult rangeResult = system.resolveVersionRange( session, rangeRequest );
+
+ List<Version> versions = rangeResult.getVersions();
+
+ System.out.println( "Available versions " + versions );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/FindNewestVersion.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/FindNewestVersion.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/FindNewestVersion.java
new file mode 100644
index 0000000..63bf3f2
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/FindNewestVersion.java
@@ -0,0 +1,61 @@
+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.
+ */
+
+import org.apache.maven.resolver.examples.util.Booter;
+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.resolution.VersionRangeRequest;
+import org.eclipse.aether.resolution.VersionRangeResult;
+import org.eclipse.aether.version.Version;
+
+/**
+ * Determines the newest version of an artifact.
+ */
+public class FindNewestVersion
+{
+
+ public static void main( String[] args )
+ throws Exception
+ {
+ System.out.println( "------------------------------------------------------------" );
+ System.out.println( FindNewestVersion.class.getSimpleName() );
+
+ RepositorySystem system = Booter.newRepositorySystem();
+
+ RepositorySystemSession session = Booter.newRepositorySystemSession( system );
+
+ Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-util:[0,)" );
+
+ VersionRangeRequest rangeRequest = new VersionRangeRequest();
+ rangeRequest.setArtifact( artifact );
+ rangeRequest.setRepositories( Booter.newRepositories( system, session ) );
+
+ VersionRangeResult rangeResult = system.resolveVersionRange( session, rangeRequest );
+
+ Version newestVersion = rangeResult.getHighestVersion();
+
+ System.out.println( "Newest version " + newestVersion + " from repository "
+ + rangeResult.getRepository( newestVersion ) );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDependencyHierarchy.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDependencyHierarchy.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDependencyHierarchy.java
new file mode 100644
index 0000000..9cf6ad0
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDependencyHierarchy.java
@@ -0,0 +1,72 @@
+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.
+ */
+
+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.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.collection.CollectRequest;
+import org.eclipse.aether.collection.CollectResult;
+import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
+import org.eclipse.aether.resolution.ArtifactDescriptorResult;
+import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
+import org.eclipse.aether.util.graph.transformer.ConflictResolver;
+
+/**
+ * Visualizes the transitive dependencies of an artifact similar to m2e's dependency hierarchy view.
+ */
+public class GetDependencyHierarchy
+{
+
+ public static void main( String[] args )
+ throws Exception
+ {
+ System.out.println( "------------------------------------------------------------" );
+ System.out.println( GetDependencyHierarchy.class.getSimpleName() );
+
+ RepositorySystem system = Booter.newRepositorySystem();
+
+ DefaultRepositorySystemSession session = Booter.newRepositorySystemSession( system );
+
+ session.setConfigProperty( ConflictResolver.CONFIG_PROP_VERBOSE, true );
+ session.setConfigProperty( DependencyManagerUtils.CONFIG_PROP_VERBOSE, true );
+
+ Artifact artifact = new DefaultArtifact( "org.apache.maven:maven-aether-provider:3.1.0" );
+
+ ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
+ descriptorRequest.setArtifact( artifact );
+ descriptorRequest.setRepositories( Booter.newRepositories( system, session ) );
+ ArtifactDescriptorResult descriptorResult = system.readArtifactDescriptor( session, descriptorRequest );
+
+ CollectRequest collectRequest = new CollectRequest();
+ collectRequest.setRootArtifact( descriptorResult.getArtifact() );
+ collectRequest.setDependencies( descriptorResult.getDependencies() );
+ collectRequest.setManagedDependencies( descriptorResult.getManagedDependencies() );
+ collectRequest.setRepositories( descriptorRequest.getRepositories() );
+
+ CollectResult collectResult = system.collectDependencies( session, collectRequest );
+
+ collectResult.getRoot().accept( new ConsoleDependencyGraphDumper() );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDependencyTree.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDependencyTree.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDependencyTree.java
new file mode 100644
index 0000000..365edff
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDependencyTree.java
@@ -0,0 +1,59 @@
+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.
+ */
+
+import org.apache.maven.resolver.examples.util.Booter;
+import org.apache.maven.resolver.examples.util.ConsoleDependencyGraphDumper;
+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.collection.CollectResult;
+import org.eclipse.aether.graph.Dependency;
+
+/**
+ * Collects the transitive dependencies of an artifact.
+ */
+public class GetDependencyTree
+{
+
+ public static void main( String[] args )
+ throws Exception
+ {
+ System.out.println( "------------------------------------------------------------" );
+ System.out.println( GetDependencyTree.class.getSimpleName() );
+
+ RepositorySystem system = Booter.newRepositorySystem();
+
+ RepositorySystemSession session = Booter.newRepositorySystemSession( system );
+
+ Artifact artifact = new DefaultArtifact( "org.apache.maven:maven-aether-provider:3.1.0" );
+
+ CollectRequest collectRequest = new CollectRequest();
+ collectRequest.setRoot( new Dependency( artifact, "" ) );
+ collectRequest.setRepositories( Booter.newRepositories( system, session ) );
+
+ CollectResult collectResult = system.collectDependencies( session, collectRequest );
+
+ collectResult.getRoot().accept( new ConsoleDependencyGraphDumper() );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDirectDependencies.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDirectDependencies.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDirectDependencies.java
new file mode 100644
index 0000000..2ce4727
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/GetDirectDependencies.java
@@ -0,0 +1,61 @@
+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.
+ */
+
+import org.apache.maven.resolver.examples.util.Booter;
+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.graph.Dependency;
+import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
+import org.eclipse.aether.resolution.ArtifactDescriptorResult;
+
+/**
+ * Determines the direct dependencies of an artifact as declared in its artifact descriptor (POM).
+ */
+public class GetDirectDependencies
+{
+
+ public static void main( String[] args )
+ throws Exception
+ {
+ System.out.println( "------------------------------------------------------------" );
+ System.out.println( GetDirectDependencies.class.getSimpleName() );
+
+ RepositorySystem system = Booter.newRepositorySystem();
+
+ RepositorySystemSession session = Booter.newRepositorySystemSession( system );
+
+ Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-impl:1.0.0.v20140518" );
+
+ ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
+ descriptorRequest.setArtifact( artifact );
+ descriptorRequest.setRepositories( Booter.newRepositories( system, session ) );
+
+ ArtifactDescriptorResult descriptorResult = system.readArtifactDescriptor( session, descriptorRequest );
+
+ for ( Dependency dependency : descriptorResult.getDependencies() )
+ {
+ System.out.println( dependency );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/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
new file mode 100644
index 0000000..c0d0506
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/InstallArtifacts.java
@@ -0,0 +1,61 @@
+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.
+ */
+
+import java.io.File;
+
+import org.apache.maven.resolver.examples.util.Booter;
+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.installation.InstallRequest;
+import org.eclipse.aether.util.artifact.SubArtifact;
+
+/**
+ * Installs a JAR and its POM to the local repository.
+ */
+public class InstallArtifacts
+{
+
+ public static void main( String[] args )
+ throws Exception
+ {
+ System.out.println( "------------------------------------------------------------" );
+ System.out.println( InstallArtifacts.class.getSimpleName() );
+
+ RepositorySystem system = Booter.newRepositorySystem();
+
+ RepositorySystemSession session = Booter.newRepositorySystemSession( system );
+
+ Artifact jarArtifact =
+ new DefaultArtifact( "test", "org.apache.maven.aether.examples", "", "jar", "0.1-SNAPSHOT" );
+ jarArtifact = jarArtifact.setFile( new File( "src/main/data/demo.jar" ) );
+
+ Artifact pomArtifact = new SubArtifact( jarArtifact, "", "pom" );
+ pomArtifact = pomArtifact.setFile( new File( "pom.xml" ) );
+
+ InstallRequest installRequest = new InstallRequest();
+ installRequest.addArtifact( jarArtifact ).addArtifact( pomArtifact );
+
+ system.install( session, installRequest );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/ResolveArtifact.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/ResolveArtifact.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/ResolveArtifact.java
new file mode 100644
index 0000000..7f56003
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/ResolveArtifact.java
@@ -0,0 +1,59 @@
+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.
+ */
+
+import org.apache.maven.resolver.examples.util.Booter;
+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.resolution.ArtifactRequest;
+import org.eclipse.aether.resolution.ArtifactResult;
+
+/**
+ * Resolves a single artifact.
+ */
+public class ResolveArtifact
+{
+
+ public static void main( String[] args )
+ throws Exception
+ {
+ System.out.println( "------------------------------------------------------------" );
+ System.out.println( ResolveArtifact.class.getSimpleName() );
+
+ RepositorySystem system = Booter.newRepositorySystem();
+
+ RepositorySystemSession session = Booter.newRepositorySystemSession( system );
+
+ Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-util:1.0.0.v20140518" );
+
+ ArtifactRequest artifactRequest = new ArtifactRequest();
+ artifactRequest.setArtifact( artifact );
+ artifactRequest.setRepositories( Booter.newRepositories( system, session ) );
+
+ ArtifactResult artifactResult = system.resolveArtifact( session, artifactRequest );
+
+ artifact = artifactResult.getArtifact();
+
+ System.out.println( artifact + " resolved to " + artifact.getFile() );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/ResolveTransitiveDependencies.java
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/ResolveTransitiveDependencies.java b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/ResolveTransitiveDependencies.java
new file mode 100644
index 0000000..111cdf6
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/ResolveTransitiveDependencies.java
@@ -0,0 +1,73 @@
+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.
+ */
+
+import java.util.List;
+
+import org.apache.maven.resolver.examples.util.Booter;
+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.graph.Dependency;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.resolution.ArtifactResult;
+import org.eclipse.aether.resolution.DependencyRequest;
+import org.eclipse.aether.util.artifact.JavaScopes;
+import org.eclipse.aether.util.filter.DependencyFilterUtils;
+
+/**
+ * Resolves the transitive (compile) dependencies of an artifact.
+ */
+public class ResolveTransitiveDependencies
+{
+
+ public static void main( String[] args )
+ throws Exception
+ {
+ System.out.println( "------------------------------------------------------------" );
+ System.out.println( ResolveTransitiveDependencies.class.getSimpleName() );
+
+ RepositorySystem system = Booter.newRepositorySystem();
+
+ RepositorySystemSession session = Booter.newRepositorySystemSession( system );
+
+ Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-impl:1.0.0.v20140518" );
+
+ DependencyFilter classpathFlter = DependencyFilterUtils.classpathFilter( JavaScopes.COMPILE );
+
+ CollectRequest collectRequest = new CollectRequest();
+ collectRequest.setRoot( new Dependency( artifact, JavaScopes.COMPILE ) );
+ collectRequest.setRepositories( Booter.newRepositories( system, session ) );
+
+ DependencyRequest dependencyRequest = new DependencyRequest( collectRequest, classpathFlter );
+
+ List<ArtifactResult> artifactResults =
+ system.resolveDependencies( session, dependencyRequest ).getArtifactResults();
+
+ for ( ArtifactResult artifactResult : artifactResults )
+ {
+ System.out.println( artifactResult.getArtifact() + " resolved to "
+ + artifactResult.getArtifact().getFile() );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/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
new file mode 100644
index 0000000..b700461
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/Aether.java
@@ -0,0 +1,131 @@
+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/089cab62/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
new file mode 100644
index 0000000..31967c2
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/AetherDemo.java
@@ -0,0 +1,78 @@
+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/089cab62/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
new file mode 100644
index 0000000..2f377aa
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/aether/AetherResult.java
@@ -0,0 +1,56 @@
+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/089cab62/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
new file mode 100644
index 0000000..59f3d61
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/DemoAetherModule.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 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/089cab62/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
new file mode 100644
index 0000000..eba5bf0
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/guice/GuiceRepositorySystemFactory.java
@@ -0,0 +1,37 @@
+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 org.eclipse.aether.RepositorySystem;
+
+import com.google.inject.Guice;
+
+/**
+ * A factory for repository system instances that employs JSR-330 via Guice to wire up the system's components.
+ */
+public class GuiceRepositorySystemFactory
+{
+
+ public static RepositorySystem newRepositorySystem()
+ {
+ return Guice.createInjector( new DemoAetherModule() ).getInstance( RepositorySystem.class );
+ }
+
+}
[3/3] maven-resolver git commit: MNG-6007 renamed package to Maven
Artifact Resolver
Posted by hb...@apache.org.
MNG-6007 renamed package to Maven Artifact Resolver
Project: http://git-wip-us.apache.org/repos/asf/maven-resolver/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-resolver/commit/089cab62
Tree: http://git-wip-us.apache.org/repos/asf/maven-resolver/tree/089cab62
Diff: http://git-wip-us.apache.org/repos/asf/maven-resolver/diff/089cab62
Branch: refs/heads/demo
Commit: 089cab626e57cd8c183e3be5f6f84af66dbce479
Parents: f2792b9
Author: Herv� Boutemy <hb...@apache.org>
Authored: Thu Sep 15 23:19:28 2016 +0200
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Thu Sep 15 23:19:28 2016 +0200
----------------------------------------------------------------------
aether-demo-maven-plugin/pom.xml | 129 --------------
.../src/it/resolve-artifact/pom.xml | 51 ------
aether-demo-maven-plugin/src/it/settings.xml | 55 ------
.../examples/maven/ResolveArtifactMojo.java | 108 -----------
aether-demo-maven-plugin/src/site/site.xml | 36 ----
aether-demo-snippets/pom.xml | 129 --------------
aether-demo-snippets/src/main/data/demo.jar | Bin 345 -> 0 bytes
.../maven/aether/examples/AllAetherDemos.java | 42 -----
.../maven/aether/examples/DeployArtifacts.java | 66 -------
.../aether/examples/FindAvailableVersions.java | 62 -------
.../aether/examples/FindNewestVersion.java | 62 -------
.../aether/examples/GetDependencyHierarchy.java | 73 --------
.../aether/examples/GetDependencyTree.java | 60 -------
.../aether/examples/GetDirectDependencies.java | 62 -------
.../maven/aether/examples/InstallArtifacts.java | 61 -------
.../maven/aether/examples/ResolveArtifact.java | 60 -------
.../examples/ResolveTransitiveDependencies.java | 73 --------
.../maven/aether/examples/aether/Aether.java | 131 --------------
.../aether/examples/aether/AetherDemo.java | 78 --------
.../aether/examples/aether/AetherResult.java | 56 ------
.../aether/examples/guice/DemoAetherModule.java | 74 --------
.../guice/GuiceRepositorySystemFactory.java | 37 ----
.../manual/ManualRepositorySystemFactory.java | 62 -------
.../plexus/PlexusRepositorySystemFactory.java | 53 ------
.../sisu/SisuRepositorySystemFactory.java | 58 ------
.../maven/aether/examples/util/Booter.java | 73 --------
.../util/ConsoleDependencyGraphDumper.java | 157 ----------------
.../util/ConsoleRepositoryListener.java | 132 --------------
.../examples/util/ConsoleTransferListener.java | 178 -------------------
aether-demo-snippets/src/site/site.xml | 36 ----
maven-resolver-demo-maven-plugin/pom.xml | 129 ++++++++++++++
.../src/it/resolve-artifact/pom.xml | 51 ++++++
.../src/it/settings.xml | 55 ++++++
.../examples/maven/ResolveArtifactMojo.java | 108 +++++++++++
.../src/site/site.xml | 36 ++++
maven-resolver-demo-snippets/pom.xml | 129 ++++++++++++++
.../src/main/data/demo.jar | Bin 0 -> 345 bytes
.../maven/resolver/examples/AllAetherDemos.java | 42 +++++
.../resolver/examples/DeployArtifacts.java | 66 +++++++
.../examples/FindAvailableVersions.java | 62 +++++++
.../resolver/examples/FindNewestVersion.java | 61 +++++++
.../examples/GetDependencyHierarchy.java | 72 ++++++++
.../resolver/examples/GetDependencyTree.java | 59 ++++++
.../examples/GetDirectDependencies.java | 61 +++++++
.../resolver/examples/InstallArtifacts.java | 61 +++++++
.../resolver/examples/ResolveArtifact.java | 59 ++++++
.../examples/ResolveTransitiveDependencies.java | 73 ++++++++
.../maven/resolver/examples/aether/Aether.java | 131 ++++++++++++++
.../resolver/examples/aether/AetherDemo.java | 78 ++++++++
.../resolver/examples/aether/AetherResult.java | 56 ++++++
.../examples/guice/DemoAetherModule.java | 74 ++++++++
.../guice/GuiceRepositorySystemFactory.java | 37 ++++
.../manual/ManualRepositorySystemFactory.java | 62 +++++++
.../plexus/PlexusRepositorySystemFactory.java | 53 ++++++
.../sisu/SisuRepositorySystemFactory.java | 58 ++++++
.../maven/resolver/examples/util/Booter.java | 73 ++++++++
.../util/ConsoleDependencyGraphDumper.java | 157 ++++++++++++++++
.../util/ConsoleRepositoryListener.java | 132 ++++++++++++++
.../examples/util/ConsoleTransferListener.java | 178 +++++++++++++++++++
maven-resolver-demo-snippets/src/site/site.xml | 36 ++++
pom.xml | 30 ++--
src/site/site.xml | 8 +-
62 files changed, 2265 insertions(+), 2276 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/aether-demo-maven-plugin/pom.xml b/aether-demo-maven-plugin/pom.xml
deleted file mode 100644
index b8a7481..0000000
--- a/aether-demo-maven-plugin/pom.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether-demos</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>aether-demo-maven-plugin</artifactId>
- <packaging>maven-plugin</packaging>
-
- <name>Aether Demo Maven Plugin</name>
- <description>
- A simple Maven plugin using Aether.
- </description>
- <inceptionYear>2010</inceptionYear>
-
- <prerequisites>
- <maven>3.1.0-alpha-1</maven>
- </prerequisites>
-
- <properties>
- <mavenVersion>3.1.0</mavenVersion>
- <aetherVersion>0.9.0.M2</aetherVersion>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>${mavenVersion}</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.sisu</groupId>
- <artifactId>org.eclipse.sisu.plexus</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-api</artifactId>
- <version>${aetherVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-util</artifactId>
- <version>${aetherVersion}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>run-its</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-invoker-plugin</artifactId>
- <version>1.5</version>
- <configuration>
- <debug>false</debug>
- <projectsDirectory>src/it</projectsDirectory>
- <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
- <pomIncludes>
- <pomInclude>*/pom.xml</pomInclude>
- </pomIncludes>
- <preBuildHookScript>setup</preBuildHookScript>
- <postBuildHookScript>verify</postBuildHookScript>
- <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
- <settingsFile>src/it/settings.xml</settingsFile>
- <goals>
- <goal>clean</goal>
- <goal>validate</goal>
- </goals>
- </configuration>
- <executions>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>install</goal>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-maven-plugin/src/it/resolve-artifact/pom.xml
----------------------------------------------------------------------
diff --git a/aether-demo-maven-plugin/src/it/resolve-artifact/pom.xml b/aether-demo-maven-plugin/src/it/resolve-artifact/pom.xml
deleted file mode 100644
index 1879d40..0000000
--- a/aether-demo-maven-plugin/src/it/resolve-artifact/pom.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.eclipse.aether.demo.its.ra</groupId>
- <artifactId>test</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>@project.groupId@</groupId>
- <artifactId>@project.artifactId@</artifactId>
- <version>@project.version@</version>
- <executions>
- <execution>
- <id>test</id>
- <phase>validate</phase>
- <goals>
- <goal>resolve-artifact</goal>
- </goals>
- <configuration>
- <artifactCoords>junit:junit:3.8.2</artifactCoords>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-maven-plugin/src/it/settings.xml
----------------------------------------------------------------------
diff --git a/aether-demo-maven-plugin/src/it/settings.xml b/aether-demo-maven-plugin/src/it/settings.xml
deleted file mode 100644
index dd86293..0000000
--- a/aether-demo-maven-plugin/src/it/settings.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<settings>
- <profiles>
- <profile>
- <id>it-repo</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <repositories>
- <repository>
- <id>local.central</id>
- <url>@localRepositoryUrl@</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>local.central</id>
- <url>@localRepositoryUrl@</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
- </profile>
- </profiles>
-</settings>
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-maven-plugin/src/main/java/org/apache/maven/aether/examples/maven/ResolveArtifactMojo.java
----------------------------------------------------------------------
diff --git a/aether-demo-maven-plugin/src/main/java/org/apache/maven/aether/examples/maven/ResolveArtifactMojo.java b/aether-demo-maven-plugin/src/main/java/org/apache/maven/aether/examples/maven/ResolveArtifactMojo.java
deleted file mode 100644
index d370866..0000000
--- a/aether-demo-maven-plugin/src/main/java/org/apache/maven/aether/examples/maven/ResolveArtifactMojo.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.apache.maven.aether.examples.maven;
-
-/*
- * 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.List;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-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.repository.RemoteRepository;
-import org.eclipse.aether.resolution.ArtifactRequest;
-import org.eclipse.aether.resolution.ArtifactResolutionException;
-import org.eclipse.aether.resolution.ArtifactResult;
-
-/**
- * Resolves a single artifact (not including its transitive dependencies).
- *
- * @goal resolve-artifact
- */
-public class ResolveArtifactMojo
- extends AbstractMojo
-{
-
- /**
- * The entry point to Aether, i.e. the component doing all the work.
- *
- * @component
- */
- private RepositorySystem repoSystem;
-
- /**
- * The current repository/network configuration of Maven.
- *
- * @parameter default-value="${repositorySystemSession}"
- * @readonly
- */
- private RepositorySystemSession repoSession;
-
- /**
- * The project's remote repositories to use for the resolution.
- *
- * @parameter default-value="${project.remoteProjectRepositories}"
- * @readonly
- */
- private List<RemoteRepository> remoteRepos;
-
- /**
- * The {@code <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>} of the artifact to resolve.
- *
- * @parameter property="aether.artifactCoords"
- */
- private String artifactCoords;
-
- public void execute()
- throws MojoExecutionException, MojoFailureException
- {
- Artifact artifact;
- try
- {
- artifact = new DefaultArtifact( artifactCoords );
- }
- catch ( IllegalArgumentException e )
- {
- throw new MojoFailureException( e.getMessage(), e );
- }
-
- ArtifactRequest request = new ArtifactRequest();
- request.setArtifact( artifact );
- request.setRepositories( remoteRepos );
-
- getLog().info( "Resolving artifact " + artifact + " from " + remoteRepos );
-
- ArtifactResult result;
- try
- {
- result = repoSystem.resolveArtifact( repoSession, request );
- }
- catch ( ArtifactResolutionException e )
- {
- throw new MojoExecutionException( e.getMessage(), e );
- }
-
- getLog().info( "Resolved artifact " + artifact + " to " + result.getArtifact().getFile() + " from "
- + result.getRepository() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-maven-plugin/src/site/site.xml
----------------------------------------------------------------------
diff --git a/aether-demo-maven-plugin/src/site/site.xml b/aether-demo-maven-plugin/src/site/site.xml
deleted file mode 100644
index 3a16bf9..0000000
--- a/aether-demo-maven-plugin/src/site/site.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-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.
--->
-
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
- <body>
- <menu name="Overview">
- <item name="Introduction" href="index.html"/>
- <item name="JavaDocs" href="apidocs/index.html"/>
- <item name="Source Xref" href="xref/index.html"/>
- <!--item name="FAQ" href="faq.html"/-->
- </menu>
-
- <menu ref="parent"/>
- <menu ref="reports"/>
- </body>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/pom.xml
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/pom.xml b/aether-demo-snippets/pom.xml
deleted file mode 100644
index 02beab4..0000000
--- a/aether-demo-snippets/pom.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether-demos</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>aether-demo-snippets</artifactId>
-
- <name>Aether Demo Snippets</name>
- <description>
- A module to demonstrate the usage of Aether by means of various runnable code snippets.
- </description>
-
- <properties>
- <aetherVersion>1.0.0.v20140518</aetherVersion>
- <mavenVersion>3.1.0</mavenVersion>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.6.2</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-api</artifactId>
- <version>${aetherVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-spi</artifactId>
- <version>${aetherVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-util</artifactId>
- <version>${aetherVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-impl</artifactId>
- <version>${aetherVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-connector-basic</artifactId>
- <version>${aetherVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-transport-file</artifactId>
- <version>${aetherVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-transport-http</artifactId>
- <version>${aetherVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-aether-provider</artifactId>
- <version>${mavenVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.sisu</groupId>
- <artifactId>org.eclipse.sisu.plexus</artifactId>
- <version>0.1.1</version>
- <optional>true</optional>
- <exclusions>
- <exclusion>
- <groupId>javax.enterprise</groupId>
- <artifactId>cdi-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.sonatype.sisu</groupId>
- <artifactId>sisu-guice</artifactId>
- <version>3.1.6</version>
- <classifier>no_aop</classifier>
- <optional>true</optional>
- <exclusions>
- <exclusion>
- <groupId>aopalliance</groupId>
- <artifactId>aopalliance</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>jsr305</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/data/demo.jar
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/data/demo.jar b/aether-demo-snippets/src/main/data/demo.jar
deleted file mode 100644
index 5fcb2f7..0000000
Binary files a/aether-demo-snippets/src/main/data/demo.jar and /dev/null differ
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/AllAetherDemos.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/AllAetherDemos.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/AllAetherDemos.java
deleted file mode 100644
index 64f5b89..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/AllAetherDemos.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.apache.maven.aether.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/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/DeployArtifacts.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/DeployArtifacts.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/DeployArtifacts.java
deleted file mode 100644
index b4c1d9a..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/DeployArtifacts.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.apache.maven.aether.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.
- */
-
-import java.io.File;
-
-import org.apache.maven.aether.examples.util.Booter;
-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.deployment.DeployRequest;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.util.artifact.SubArtifact;
-
-/**
- * Deploys a JAR and its POM to a remote repository.
- */
-public class DeployArtifacts
-{
-
- public static void main( String[] args )
- throws Exception
- {
- System.out.println( "------------------------------------------------------------" );
- System.out.println( DeployArtifacts.class.getSimpleName() );
-
- RepositorySystem system = Booter.newRepositorySystem();
-
- RepositorySystemSession session = Booter.newRepositorySystemSession( system );
-
- Artifact jarArtifact = new DefaultArtifact( "test", "org.apache.maven.aether.examples", "", "jar", "0.1-SNAPSHOT" );
- jarArtifact = jarArtifact.setFile( new File( "src/main/data/demo.jar" ) );
-
- Artifact pomArtifact = new SubArtifact( jarArtifact, "", "pom" );
- pomArtifact = pomArtifact.setFile( new File( "pom.xml" ) );
-
- RemoteRepository distRepo =
- new RemoteRepository.Builder( "org.apache.maven.aether.examples", "default",
- new File( "target/dist-repo" ).toURI().toString() ).build();
-
- DeployRequest deployRequest = new DeployRequest();
- deployRequest.addArtifact( jarArtifact ).addArtifact( pomArtifact );
- deployRequest.setRepository( distRepo );
-
- system.deploy( session, deployRequest );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/FindAvailableVersions.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/FindAvailableVersions.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/FindAvailableVersions.java
deleted file mode 100644
index 30d926c..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/FindAvailableVersions.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.apache.maven.aether.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.
- */
-
-import java.util.List;
-
-import org.apache.maven.aether.examples.util.Booter;
-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.resolution.VersionRangeRequest;
-import org.eclipse.aether.resolution.VersionRangeResult;
-import org.eclipse.aether.version.Version;
-
-/**
- * Determines all available versions of an artifact.
- */
-public class FindAvailableVersions
-{
-
- public static void main( String[] args )
- throws Exception
- {
- System.out.println( "------------------------------------------------------------" );
- System.out.println( FindAvailableVersions.class.getSimpleName() );
-
- RepositorySystem system = Booter.newRepositorySystem();
-
- RepositorySystemSession session = Booter.newRepositorySystemSession( system );
-
- Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-util:[0,)" );
-
- VersionRangeRequest rangeRequest = new VersionRangeRequest();
- rangeRequest.setArtifact( artifact );
- rangeRequest.setRepositories( Booter.newRepositories( system, session ) );
-
- VersionRangeResult rangeResult = system.resolveVersionRange( session, rangeRequest );
-
- List<Version> versions = rangeResult.getVersions();
-
- System.out.println( "Available versions " + versions );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/FindNewestVersion.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/FindNewestVersion.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/FindNewestVersion.java
deleted file mode 100644
index a4bbc83..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/FindNewestVersion.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.apache.maven.aether.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.
- */
-
-import org.apache.maven.aether.examples.util.Booter;
-
-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.resolution.VersionRangeRequest;
-import org.eclipse.aether.resolution.VersionRangeResult;
-import org.eclipse.aether.version.Version;
-
-/**
- * Determines the newest version of an artifact.
- */
-public class FindNewestVersion
-{
-
- public static void main( String[] args )
- throws Exception
- {
- System.out.println( "------------------------------------------------------------" );
- System.out.println( FindNewestVersion.class.getSimpleName() );
-
- RepositorySystem system = Booter.newRepositorySystem();
-
- RepositorySystemSession session = Booter.newRepositorySystemSession( system );
-
- Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-util:[0,)" );
-
- VersionRangeRequest rangeRequest = new VersionRangeRequest();
- rangeRequest.setArtifact( artifact );
- rangeRequest.setRepositories( Booter.newRepositories( system, session ) );
-
- VersionRangeResult rangeResult = system.resolveVersionRange( session, rangeRequest );
-
- Version newestVersion = rangeResult.getHighestVersion();
-
- System.out.println( "Newest version " + newestVersion + " from repository "
- + rangeResult.getRepository( newestVersion ) );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/GetDependencyHierarchy.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/GetDependencyHierarchy.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/GetDependencyHierarchy.java
deleted file mode 100644
index 73d1d33..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/GetDependencyHierarchy.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.apache.maven.aether.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.
- */
-
-import org.apache.maven.aether.examples.util.Booter;
-import org.apache.maven.aether.examples.util.ConsoleDependencyGraphDumper;
-
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.RepositorySystem;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.collection.CollectRequest;
-import org.eclipse.aether.collection.CollectResult;
-import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
-import org.eclipse.aether.resolution.ArtifactDescriptorResult;
-import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
-import org.eclipse.aether.util.graph.transformer.ConflictResolver;
-
-/**
- * Visualizes the transitive dependencies of an artifact similar to m2e's dependency hierarchy view.
- */
-public class GetDependencyHierarchy
-{
-
- public static void main( String[] args )
- throws Exception
- {
- System.out.println( "------------------------------------------------------------" );
- System.out.println( GetDependencyHierarchy.class.getSimpleName() );
-
- RepositorySystem system = Booter.newRepositorySystem();
-
- DefaultRepositorySystemSession session = Booter.newRepositorySystemSession( system );
-
- session.setConfigProperty( ConflictResolver.CONFIG_PROP_VERBOSE, true );
- session.setConfigProperty( DependencyManagerUtils.CONFIG_PROP_VERBOSE, true );
-
- Artifact artifact = new DefaultArtifact( "org.apache.maven:maven-aether-provider:3.1.0" );
-
- ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
- descriptorRequest.setArtifact( artifact );
- descriptorRequest.setRepositories( Booter.newRepositories( system, session ) );
- ArtifactDescriptorResult descriptorResult = system.readArtifactDescriptor( session, descriptorRequest );
-
- CollectRequest collectRequest = new CollectRequest();
- collectRequest.setRootArtifact( descriptorResult.getArtifact() );
- collectRequest.setDependencies( descriptorResult.getDependencies() );
- collectRequest.setManagedDependencies( descriptorResult.getManagedDependencies() );
- collectRequest.setRepositories( descriptorRequest.getRepositories() );
-
- CollectResult collectResult = system.collectDependencies( session, collectRequest );
-
- collectResult.getRoot().accept( new ConsoleDependencyGraphDumper() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/GetDependencyTree.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/GetDependencyTree.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/GetDependencyTree.java
deleted file mode 100644
index 82c6adc..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/GetDependencyTree.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.apache.maven.aether.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.
- */
-
-import org.apache.maven.aether.examples.util.Booter;
-import org.apache.maven.aether.examples.util.ConsoleDependencyGraphDumper;
-
-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.collection.CollectResult;
-import org.eclipse.aether.graph.Dependency;
-
-/**
- * Collects the transitive dependencies of an artifact.
- */
-public class GetDependencyTree
-{
-
- public static void main( String[] args )
- throws Exception
- {
- System.out.println( "------------------------------------------------------------" );
- System.out.println( GetDependencyTree.class.getSimpleName() );
-
- RepositorySystem system = Booter.newRepositorySystem();
-
- RepositorySystemSession session = Booter.newRepositorySystemSession( system );
-
- Artifact artifact = new DefaultArtifact( "org.apache.maven:maven-aether-provider:3.1.0" );
-
- CollectRequest collectRequest = new CollectRequest();
- collectRequest.setRoot( new Dependency( artifact, "" ) );
- collectRequest.setRepositories( Booter.newRepositories( system, session ) );
-
- CollectResult collectResult = system.collectDependencies( session, collectRequest );
-
- collectResult.getRoot().accept( new ConsoleDependencyGraphDumper() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/GetDirectDependencies.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/GetDirectDependencies.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/GetDirectDependencies.java
deleted file mode 100644
index 1fcaf9e..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/GetDirectDependencies.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.apache.maven.aether.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.
- */
-
-import org.apache.maven.aether.examples.util.Booter;
-
-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.graph.Dependency;
-import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
-import org.eclipse.aether.resolution.ArtifactDescriptorResult;
-
-/**
- * Determines the direct dependencies of an artifact as declared in its artifact descriptor (POM).
- */
-public class GetDirectDependencies
-{
-
- public static void main( String[] args )
- throws Exception
- {
- System.out.println( "------------------------------------------------------------" );
- System.out.println( GetDirectDependencies.class.getSimpleName() );
-
- RepositorySystem system = Booter.newRepositorySystem();
-
- RepositorySystemSession session = Booter.newRepositorySystemSession( system );
-
- Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-impl:1.0.0.v20140518" );
-
- ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
- descriptorRequest.setArtifact( artifact );
- descriptorRequest.setRepositories( Booter.newRepositories( system, session ) );
-
- ArtifactDescriptorResult descriptorResult = system.readArtifactDescriptor( session, descriptorRequest );
-
- for ( Dependency dependency : descriptorResult.getDependencies() )
- {
- System.out.println( dependency );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/InstallArtifacts.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/InstallArtifacts.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/InstallArtifacts.java
deleted file mode 100644
index 711c639..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/InstallArtifacts.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.apache.maven.aether.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.
- */
-
-import java.io.File;
-
-import org.apache.maven.aether.examples.util.Booter;
-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.installation.InstallRequest;
-import org.eclipse.aether.util.artifact.SubArtifact;
-
-/**
- * Installs a JAR and its POM to the local repository.
- */
-public class InstallArtifacts
-{
-
- public static void main( String[] args )
- throws Exception
- {
- System.out.println( "------------------------------------------------------------" );
- System.out.println( InstallArtifacts.class.getSimpleName() );
-
- RepositorySystem system = Booter.newRepositorySystem();
-
- RepositorySystemSession session = Booter.newRepositorySystemSession( system );
-
- Artifact jarArtifact =
- new DefaultArtifact( "test", "org.apache.maven.aether.examples", "", "jar", "0.1-SNAPSHOT" );
- jarArtifact = jarArtifact.setFile( new File( "src/main/data/demo.jar" ) );
-
- Artifact pomArtifact = new SubArtifact( jarArtifact, "", "pom" );
- pomArtifact = pomArtifact.setFile( new File( "pom.xml" ) );
-
- InstallRequest installRequest = new InstallRequest();
- installRequest.addArtifact( jarArtifact ).addArtifact( pomArtifact );
-
- system.install( session, installRequest );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/ResolveArtifact.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/ResolveArtifact.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/ResolveArtifact.java
deleted file mode 100644
index 10153de..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/ResolveArtifact.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.apache.maven.aether.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.
- */
-
-import org.apache.maven.aether.examples.util.Booter;
-
-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.resolution.ArtifactRequest;
-import org.eclipse.aether.resolution.ArtifactResult;
-
-/**
- * Resolves a single artifact.
- */
-public class ResolveArtifact
-{
-
- public static void main( String[] args )
- throws Exception
- {
- System.out.println( "------------------------------------------------------------" );
- System.out.println( ResolveArtifact.class.getSimpleName() );
-
- RepositorySystem system = Booter.newRepositorySystem();
-
- RepositorySystemSession session = Booter.newRepositorySystemSession( system );
-
- Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-util:1.0.0.v20140518" );
-
- ArtifactRequest artifactRequest = new ArtifactRequest();
- artifactRequest.setArtifact( artifact );
- artifactRequest.setRepositories( Booter.newRepositories( system, session ) );
-
- ArtifactResult artifactResult = system.resolveArtifact( session, artifactRequest );
-
- artifact = artifactResult.getArtifact();
-
- System.out.println( artifact + " resolved to " + artifact.getFile() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/ResolveTransitiveDependencies.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/ResolveTransitiveDependencies.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/ResolveTransitiveDependencies.java
deleted file mode 100644
index eec52b7..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/ResolveTransitiveDependencies.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.apache.maven.aether.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.
- */
-
-import java.util.List;
-
-import org.apache.maven.aether.examples.util.Booter;
-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.graph.Dependency;
-import org.eclipse.aether.graph.DependencyFilter;
-import org.eclipse.aether.resolution.ArtifactResult;
-import org.eclipse.aether.resolution.DependencyRequest;
-import org.eclipse.aether.util.artifact.JavaScopes;
-import org.eclipse.aether.util.filter.DependencyFilterUtils;
-
-/**
- * Resolves the transitive (compile) dependencies of an artifact.
- */
-public class ResolveTransitiveDependencies
-{
-
- public static void main( String[] args )
- throws Exception
- {
- System.out.println( "------------------------------------------------------------" );
- System.out.println( ResolveTransitiveDependencies.class.getSimpleName() );
-
- RepositorySystem system = Booter.newRepositorySystem();
-
- RepositorySystemSession session = Booter.newRepositorySystemSession( system );
-
- Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-impl:1.0.0.v20140518" );
-
- DependencyFilter classpathFlter = DependencyFilterUtils.classpathFilter( JavaScopes.COMPILE );
-
- CollectRequest collectRequest = new CollectRequest();
- collectRequest.setRoot( new Dependency( artifact, JavaScopes.COMPILE ) );
- collectRequest.setRepositories( Booter.newRepositories( system, session ) );
-
- DependencyRequest dependencyRequest = new DependencyRequest( collectRequest, classpathFlter );
-
- List<ArtifactResult> artifactResults =
- system.resolveDependencies( session, dependencyRequest ).getArtifactResults();
-
- for ( ArtifactResult artifactResult : artifactResults )
- {
- System.out.println( artifactResult.getArtifact() + " resolved to "
- + artifactResult.getArtifact().getFile() );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/aether/Aether.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/aether/Aether.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/aether/Aether.java
deleted file mode 100644
index b9370c1..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/aether/Aether.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.apache.maven.aether.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.aether.examples.util.Booter;
-import org.apache.maven.aether.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/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/aether/AetherDemo.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/aether/AetherDemo.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/aether/AetherDemo.java
deleted file mode 100644
index e726964..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/aether/AetherDemo.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.apache.maven.aether.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/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/aether/AetherResult.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/aether/AetherResult.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/aether/AetherResult.java
deleted file mode 100644
index be2be4e..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/aether/AetherResult.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.apache.maven.aether.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/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/guice/DemoAetherModule.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/guice/DemoAetherModule.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/guice/DemoAetherModule.java
deleted file mode 100644
index 243b958..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/guice/DemoAetherModule.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.apache.maven.aether.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/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/guice/GuiceRepositorySystemFactory.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/guice/GuiceRepositorySystemFactory.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/guice/GuiceRepositorySystemFactory.java
deleted file mode 100644
index 0b531d3..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/guice/GuiceRepositorySystemFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.apache.maven.aether.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 org.eclipse.aether.RepositorySystem;
-
-import com.google.inject.Guice;
-
-/**
- * A factory for repository system instances that employs JSR-330 via Guice to wire up the system's components.
- */
-public class GuiceRepositorySystemFactory
-{
-
- public static RepositorySystem newRepositorySystem()
- {
- return Guice.createInjector( new DemoAetherModule() ).getInstance( RepositorySystem.class );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/manual/ManualRepositorySystemFactory.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/manual/ManualRepositorySystemFactory.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/manual/ManualRepositorySystemFactory.java
deleted file mode 100644
index df80c4f..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/manual/ManualRepositorySystemFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.apache.maven.aether.examples.manual;
-
-/*
- * 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 org.apache.maven.repository.internal.MavenRepositorySystemUtils;
-import org.eclipse.aether.RepositorySystem;
-import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
-import org.eclipse.aether.impl.DefaultServiceLocator;
-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;
-
-/**
- * A factory for repository system instances that employs Aether's built-in service locator infrastructure to wire up
- * the system's components.
- */
-public class ManualRepositorySystemFactory
-{
-
- public static RepositorySystem newRepositorySystem()
- {
- /*
- * Aether's components implement org.eclipse.aether.spi.locator.Service to ease manual wiring and using the
- * prepopulated DefaultServiceLocator, we only need to register the repository connector and transporter
- * factories.
- */
- DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
- locator.addService( RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class );
- locator.addService( TransporterFactory.class, FileTransporterFactory.class );
- locator.addService( TransporterFactory.class, HttpTransporterFactory.class );
-
- locator.setErrorHandler( new DefaultServiceLocator.ErrorHandler()
- {
- @Override
- public void serviceCreationFailed( Class<?> type, Class<?> impl, Throwable exception )
- {
- exception.printStackTrace();
- }
- } );
-
- return locator.getService( RepositorySystem.class );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/plexus/PlexusRepositorySystemFactory.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/plexus/PlexusRepositorySystemFactory.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/plexus/PlexusRepositorySystemFactory.java
deleted file mode 100644
index 20912a2..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/plexus/PlexusRepositorySystemFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.apache.maven.aether.examples.plexus;
-
-/*
- * 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 org.codehaus.plexus.ContainerConfiguration;
-import org.codehaus.plexus.DefaultContainerConfiguration;
-import org.codehaus.plexus.DefaultPlexusContainer;
-import org.codehaus.plexus.PlexusConstants;
-import org.eclipse.aether.RepositorySystem;
-
-/**
- * A factory for repository system instances that employs Plexus to wire up the system's components.
- */
-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.
- */
- try
- {
- ContainerConfiguration config = new DefaultContainerConfiguration();
- config.setAutoWiring( true );
- config.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
- return new DefaultPlexusContainer( config ).lookup( RepositorySystem.class );
- }
- catch ( Exception e )
- {
- throw new IllegalStateException( "dependency injection failed", e );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/sisu/SisuRepositorySystemFactory.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/sisu/SisuRepositorySystemFactory.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/sisu/SisuRepositorySystemFactory.java
deleted file mode 100644
index 12c04cd..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/sisu/SisuRepositorySystemFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.apache.maven.aether.examples.sisu;
-
-/*
- * 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 javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-
-import org.apache.maven.model.building.DefaultModelBuilderFactory;
-import org.apache.maven.model.building.ModelBuilder;
-import org.eclipse.aether.RepositorySystem;
-import org.eclipse.sisu.launch.Main;
-
-/**
- * A factory for repository system instances that employs Eclipse Sisu to wire up the system's components.
- */
-@Named
-public class SisuRepositorySystemFactory
-{
-
- @Inject
- private RepositorySystem repositorySystem;
-
- public static RepositorySystem newRepositorySystem()
- {
- return Main.boot( SisuRepositorySystemFactory.class ).repositorySystem;
- }
-
- @Named
- private static class ModelBuilderProvider
- implements Provider<ModelBuilder>
- {
-
- public ModelBuilder get()
- {
- return new DefaultModelBuilderFactory().newInstance();
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/Booter.java
----------------------------------------------------------------------
diff --git a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/Booter.java b/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/Booter.java
deleted file mode 100644
index 2ee5686..0000000
--- a/aether-demo-snippets/src/main/java/org/apache/maven/aether/examples/util/Booter.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.apache.maven.aether.examples.util;
-
-/*
- * 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.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.RepositorySystem;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.repository.LocalRepository;
-import org.eclipse.aether.repository.RemoteRepository;
-
-/**
- * A helper to boot the repository system and a repository system session.
- */
-public class Booter
-{
-
- public static RepositorySystem newRepositorySystem()
- {
- return org.apache.maven.aether.examples.manual.ManualRepositorySystemFactory.newRepositorySystem();
- // return org.eclipse.aether.examples.guice.GuiceRepositorySystemFactory.newRepositorySystem();
- // return org.eclipse.aether.examples.sisu.SisuRepositorySystemFactory.newRepositorySystem();
- // return org.eclipse.aether.examples.plexus.PlexusRepositorySystemFactory.newRepositorySystem();
- }
-
- public static DefaultRepositorySystemSession newRepositorySystemSession( RepositorySystem system )
- {
- DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
-
- LocalRepository localRepo = new LocalRepository( "target/local-repo" );
- session.setLocalRepositoryManager( system.newLocalRepositoryManager( session, localRepo ) );
-
- session.setTransferListener( new ConsoleTransferListener() );
- session.setRepositoryListener( new ConsoleRepositoryListener() );
-
- // uncomment to generate dirty trees
- // session.setDependencyGraphTransformer( null );
-
- return session;
- }
-
- public static List<RemoteRepository> newRepositories( RepositorySystem system, RepositorySystemSession session )
- {
- return new ArrayList<RemoteRepository>( Arrays.asList( newCentralRepository() ) );
- }
-
- private static RemoteRepository newCentralRepository()
- {
- return new RemoteRepository.Builder( "central", "default", "https://repo.maven.apache.org/maven2/" ).build();
- }
-
-}