diff --git a/aether-demo-maven-plugin/pom.xml b/aether-demo-maven-plugin/pom.xml
index 85a620968188f013adc7b7f0783d05d715dd3fbf..46b4cdf5d91ff34840afd6bf9c086f60ed143165 100644
--- a/aether-demo-maven-plugin/pom.xml
+++ b/aether-demo-maven-plugin/pom.xml
@@ -30,7 +30,7 @@
2010
- 3.1.0
+ 3.1.0-alpha-1
@@ -43,6 +43,7 @@
org.apache.maven
maven-plugin-api
${mavenVersion}
+ provided
org.apache.maven
diff --git a/aether-demo-maven-plugin/src/main/java/org/eclipse/aether/examples/maven/ResolveArtifactMojo.java b/aether-demo-maven-plugin/src/main/java/org/eclipse/aether/examples/maven/ResolveArtifactMojo.java
index bd6d2c8145c8959b61685cc2ca212426c170ecda..1039bc1e31f987f1fa073d2324d38c54cad23dde 100644
--- a/aether-demo-maven-plugin/src/main/java/org/eclipse/aether/examples/maven/ResolveArtifactMojo.java
+++ b/aether-demo-maven-plugin/src/main/java/org/eclipse/aether/examples/maven/ResolveArtifactMojo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 Sonatype, Inc.
+ * Copyright (c) 2010, 2013 Sonatype, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,6 +25,8 @@ 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
diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/FindAvailableVersions.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/FindAvailableVersions.java
index 772445a78c8f16f70cc0bae5c28d401b1050533d..be309b04b14f806ce8483d3b3b31462d66095f8a 100644
--- a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/FindAvailableVersions.java
+++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/FindAvailableVersions.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 Sonatype, Inc.
+ * Copyright (c) 2010, 2013 Sonatype, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,7 +38,7 @@ public class FindAvailableVersions
RepositorySystemSession session = Booter.newRepositorySystemSession( system );
- Artifact artifact = new DefaultArtifact( "org.sonatype.aether:aether-util:[0,)" );
+ Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-util:[0,)" );
RemoteRepository repo = Booter.newCentralRepository();
diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/FindNewestVersion.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/FindNewestVersion.java
index fa7b38ffeaddd3ef72b23ee8a51652214b60ebfa..e0392324c972c18934977735e0d0d257db6b0bfc 100644
--- a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/FindNewestVersion.java
+++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/FindNewestVersion.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 Sonatype, Inc.
+ * Copyright (c) 2010, 2013 Sonatype, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -36,7 +36,7 @@ public class FindNewestVersion
RepositorySystemSession session = Booter.newRepositorySystemSession( system );
- Artifact artifact = new DefaultArtifact( "org.sonatype.aether:aether-util:[0,)" );
+ Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-util:[0,)" );
RemoteRepository repo = Booter.newCentralRepository();
diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/GetDependencyTree.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/GetDependencyTree.java
index 8c883485fc107433d4b13bfadc76b6efd277bf6d..026589560bddddc78284d52a20e219453ff27536 100644
--- a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/GetDependencyTree.java
+++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/GetDependencyTree.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 Sonatype, Inc.
+ * Copyright (c) 2010, 2013 Sonatype, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -37,7 +37,7 @@ public class GetDependencyTree
RepositorySystemSession session = Booter.newRepositorySystemSession( system );
- Artifact artifact = new DefaultArtifact( "org.apache.maven:maven-aether-provider:3.0.2" );
+ Artifact artifact = new DefaultArtifact( "org.apache.maven:maven-aether-provider:3.1.0" );
RemoteRepository repo = Booter.newCentralRepository();
diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/GetDirectDependencies.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/GetDirectDependencies.java
index 3fafb7ea040256f5b7374bf0201ca61848466809..bb70025556d3f35ac32cad5bb488bda880ec6a1b 100644
--- a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/GetDirectDependencies.java
+++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/GetDirectDependencies.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 Sonatype, Inc.
+ * Copyright (c) 2010, 2013 Sonatype, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -36,7 +36,7 @@ public class GetDirectDependencies
RepositorySystemSession session = Booter.newRepositorySystemSession( system );
- Artifact artifact = new DefaultArtifact( "org.sonatype.aether:aether-impl:1.13" );
+ Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-impl:0.9.0.M3" );
RemoteRepository repo = Booter.newCentralRepository();
diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/ResolveArtifact.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/ResolveArtifact.java
index bcc8aa14bf50c162df75e3369d1f2ed71fc0417b..655678d0c7313cb26f67a3d1bae82e469711de0e 100644
--- a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/ResolveArtifact.java
+++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/ResolveArtifact.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 Sonatype, Inc.
+ * Copyright (c) 2010, 2013 Sonatype, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,7 +35,7 @@ public class ResolveArtifact
RepositorySystemSession session = Booter.newRepositorySystemSession( system );
- Artifact artifact = new DefaultArtifact( "org.sonatype.aether:aether-util:1.13" );
+ Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-util:0.9.0.M3" );
RemoteRepository repo = Booter.newCentralRepository();
diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/ResolveTransitiveDependencies.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/ResolveTransitiveDependencies.java
index 9cf7cc84fab6a63c289ec879a6c1ddcb7a785377..fbf9489db690e02854c1313fcf877aa35fbef05b 100644
--- a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/ResolveTransitiveDependencies.java
+++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/ResolveTransitiveDependencies.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 Sonatype, Inc.
+ * Copyright (c) 2010, 2013 Sonatype, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -42,7 +42,7 @@ public class ResolveTransitiveDependencies
RepositorySystemSession session = Booter.newRepositorySystemSession( system );
- Artifact artifact = new DefaultArtifact( "org.sonatype.aether:aether-impl:1.13" );
+ Artifact artifact = new DefaultArtifact( "org.eclipse.aether:aether-impl:0.9.0.M3" );
RemoteRepository repo = Booter.newCentralRepository();
diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/ConsoleDependencyGraphDumper.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/ConsoleDependencyGraphDumper.java
index 59867a363a887ed2edd1702b95f64d3afbe6b55b..254b200ce5a93f0bd1c48d5c937e9f594e6e61d8 100644
--- a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/ConsoleDependencyGraphDumper.java
+++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/ConsoleDependencyGraphDumper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Sonatype, Inc.
+ * Copyright (c) 2010, 2013 Sonatype, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,9 @@
package org.eclipse.aether.examples.util;
import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.graph.DependencyVisitor;
@@ -24,7 +27,7 @@ public class ConsoleDependencyGraphDumper
private PrintStream out;
- private String currentIndent = "";
+ private List childInfos = new ArrayList();
public ConsoleDependencyGraphDumper()
{
@@ -38,22 +41,61 @@ public class ConsoleDependencyGraphDumper
public boolean visitEnter( DependencyNode node )
{
- out.println( currentIndent + node );
- if ( currentIndent.length() <= 0 )
+ out.println( formatIndentation() + formatNode( node ) );
+ childInfos.add( new ChildInfo( node.getChildren().size() ) );
+ return true;
+ }
+
+ private String formatIndentation()
+ {
+ StringBuilder buffer = new StringBuilder( 128 );
+ for ( Iterator it = childInfos.iterator(); it.hasNext(); )
+ {
+ buffer.append( it.next().formatIndentation( !it.hasNext() ) );
+ }
+ return buffer.toString();
+ }
+
+ private String formatNode( DependencyNode node )
+ {
+ return String.valueOf( node );
+ }
+
+ public boolean visitLeave( DependencyNode node )
+ {
+ if ( !childInfos.isEmpty() )
{
- currentIndent = "+- ";
+ childInfos.remove( childInfos.size() - 1 );
}
- else
+ if ( !childInfos.isEmpty() )
{
- currentIndent = "| " + currentIndent;
+ childInfos.get( childInfos.size() - 1 ).index++;
}
return true;
}
- public boolean visitLeave( DependencyNode node )
+ private static class ChildInfo
{
- currentIndent = currentIndent.substring( 3, currentIndent.length() );
- return true;
+
+ 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 ? " " : "| ";
+ }
+
}
}
diff --git a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/ConsoleTransferListener.java b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/ConsoleTransferListener.java
index f162975c66608c2431f1e6648450cc2bcb838d14..b89329c3cd1a4b96bc0b12e109b2fcb6f56605cd 100644
--- a/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/ConsoleTransferListener.java
+++ b/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/util/ConsoleTransferListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Sonatype, Inc.
+ * Copyright (c) 2010, 2013 Sonatype, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,6 +18,7 @@ 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;
@@ -123,8 +124,9 @@ public class ConsoleTransferListener
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 = ( contentLength / 1024.0 ) / ( duration / 1000.0 );
+ double kbPerSec = ( bytes / 1024.0 ) / ( duration / 1000.0 );
throughput = " at " + format.format( kbPerSec ) + " KB/sec";
}
@@ -138,7 +140,10 @@ public class ConsoleTransferListener
{
transferCompleted( event );
- event.getException().printStackTrace( out );
+ if ( !( event.getException() instanceof MetadataNotFoundException ) )
+ {
+ event.getException().printStackTrace( out );
+ }
}
private void transferCompleted( TransferEvent event )