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 2017/02/01 07:01:45 UTC
[1/9] maven git commit: [MNG-6110] Upgrade Aether to Maven Resolver
1.0.3
Repository: maven
Updated Branches:
refs/heads/master a3cdfbbbe -> 9b763cc00
[MNG-6110] Upgrade Aether to Maven Resolver 1.0.3
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/4d6c9292
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/4d6c9292
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/4d6c9292
Branch: refs/heads/master
Commit: 4d6c9292c433626fa0b9a1cf711d4d0c366e7f33
Parents: a3cdfbb
Author: Harald Wellmann <ha...@gmx.de>
Authored: Sun Nov 6 12:13:32 2016 +0100
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Wed Feb 1 07:59:52 2017 +0100
----------------------------------------------------------------------
apache-maven/pom.xml | 8 ++++----
maven-aether-provider/pom.xml | 26 ++++++++++++-------------
maven-compat/pom.xml | 24 +++++++++++++++++++----
maven-core/pom.xml | 16 ++++++++++------
maven-embedder/pom.xml | 8 ++++++++
pom.xml | 39 +++++++++++++++++++-------------------
6 files changed, 75 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/4d6c9292/apache-maven/pom.xml
----------------------------------------------------------------------
diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml
index e7d5608..6fc5a73 100644
--- a/apache-maven/pom.xml
+++ b/apache-maven/pom.xml
@@ -90,12 +90,12 @@ under the License.
<artifactId>wagon-file</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-connector-basic</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-connector-basic</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-transport-wagon</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-transport-wagon</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
http://git-wip-us.apache.org/repos/asf/maven/blob/4d6c9292/maven-aether-provider/pom.xml
----------------------------------------------------------------------
diff --git a/maven-aether-provider/pom.xml b/maven-aether-provider/pom.xml
index 0f3cb61..91d1ae7 100644
--- a/maven-aether-provider/pom.xml
+++ b/maven-aether-provider/pom.xml
@@ -31,7 +31,7 @@ under the License.
<artifactId>maven-aether-provider</artifactId>
<name>Maven Aether Provider</name>
- <description>Extensions to Aether for utilizing Maven POM and repository metadata.</description>
+ <description>Extensions to Maven Resolver for utilizing Maven POM and repository metadata.</description>
<dependencies>
<dependency>
@@ -47,20 +47,20 @@ under the License.
<artifactId>maven-repository-metadata</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-api</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-api</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-spi</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-spi</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-util</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-util</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-impl</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-impl</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
@@ -88,13 +88,13 @@ under the License.
</dependency>
<!-- Testing -->
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-connector-basic</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-connector-basic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-transport-wagon</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-transport-wagon</artifactId>
<scope>test</scope>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/maven/blob/4d6c9292/maven-compat/pom.xml
----------------------------------------------------------------------
diff --git a/maven-compat/pom.xml b/maven-compat/pom.xml
index 3a0a45c..876c11c 100644
--- a/maven-compat/pom.xml
+++ b/maven-compat/pom.xml
@@ -59,6 +59,22 @@ under the License.
<artifactId>maven-core</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-aether-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-impl</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
@@ -85,13 +101,13 @@ under the License.
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-connector-basic</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-connector-basic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-transport-wagon</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-transport-wagon</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/maven/blob/4d6c9292/maven-core/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/pom.xml b/maven-core/pom.xml
index d147dd8..ad5484a 100644
--- a/maven-core/pom.xml
+++ b/maven-core/pom.xml
@@ -73,16 +73,20 @@ under the License.
<artifactId>maven-aether-provider</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-impl</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-impl</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-api</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-api</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-util</artifactId>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-util</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
http://git-wip-us.apache.org/repos/asf/maven/blob/4d6c9292/maven-embedder/pom.xml
----------------------------------------------------------------------
diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml
index 75b92c9..30ad2ce 100644
--- a/maven-embedder/pom.xml
+++ b/maven-embedder/pom.xml
@@ -51,6 +51,14 @@ under the License.
<artifactId>maven-model-builder</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-util</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<scope>runtime</scope>
http://git-wip-us.apache.org/repos/asf/maven/blob/4d6c9292/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b61e0af..0e3b9a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,7 +65,7 @@ under the License.
<cipherVersion>1.7</cipherVersion>
<modelloVersion>1.8.3</modelloVersion>
<jxpathVersion>1.3</jxpathVersion>
- <aetherVersion>1.0.2.v20150114</aetherVersion>
+ <resolverVersion>1.0.3</resolverVersion>
<slf4jVersion>1.7.5</slf4jVersion>
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
<!-- Control the name of the distribution and information output by mvn -->
@@ -328,34 +328,34 @@ under the License.
</dependency>
<!-- Repository -->
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-api</artifactId>
- <version>${aetherVersion}</version>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-api</artifactId>
+ <version>${resolverVersion}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-spi</artifactId>
- <version>${aetherVersion}</version>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-spi</artifactId>
+ <version>${resolverVersion}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-impl</artifactId>
- <version>${aetherVersion}</version>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-impl</artifactId>
+ <version>${resolverVersion}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-util</artifactId>
- <version>${aetherVersion}</version>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-util</artifactId>
+ <version>${resolverVersion}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-connector-basic</artifactId>
- <version>${aetherVersion}</version>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-connector-basic</artifactId>
+ <version>${resolverVersion}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-transport-wagon</artifactId>
- <version>${aetherVersion}</version>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-transport-wagon</artifactId>
+ <version>${resolverVersion}</version>
</dependency>
<!-- Commons -->
<dependency>
@@ -639,6 +639,7 @@ under the License.
<notimestamp>true</notimestamp>
<quiet>true</quiet>
<links combine.children="append">
+ <!-- TODO link to Maven Resolver Javadoc -->
<link>http://download.eclipse.org/aether/aether-core/${aetherVersion}/apidocs/</link>
<link>https://codehaus-plexus.github.io/plexus-containers/plexus-container-default/apidocs/</link>
</links>
[2/9] maven git commit: [MNG-6110] renamed 'maven-aether-provider' to
'maven-resolver-provider'
Posted by hb...@apache.org.
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleTransferListener.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleTransferListener.java b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleTransferListener.java
new file mode 100644
index 0000000..cf587d8
--- /dev/null
+++ b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleTransferListener.java
@@ -0,0 +1,186 @@
+package org.apache.maven.repository.internal.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.TransferEvent;
+import org.eclipse.aether.transfer.TransferResource;
+
+public class ConsoleTransferListener
+ extends AbstractTransferListener
+{
+
+ private PrintStream out;
+
+ private Map<TransferResource, Long> downloads = new ConcurrentHashMap<>();
+
+ 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";
+
+ println( "transferInitiated", message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName() );
+ }
+
+ @Override
+ public void transferProgressed( TransferEvent event )
+ {
+ TransferResource resource = event.getResource();
+ downloads.put( resource, event.getTransferredBytes() );
+
+ StringBuilder buffer = new StringBuilder( 64 );
+
+ for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() )
+ {
+ long total = entry.getKey().getContentLength();
+ long complete = entry.getValue();
+
+ buffer.append( getStatus( complete, total ) ).append( " " );
+ }
+
+ int pad = lastLength - buffer.length();
+ lastLength = buffer.length();
+ pad( buffer, pad );
+ buffer.append( '\r' );
+
+ print( "transferProgressed", buffer.toString() );
+ }
+
+ 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 )
+ {
+ DecimalFormat format = new DecimalFormat( "0.0", new DecimalFormatSymbols( Locale.ENGLISH ) );
+ double kbPerSec = ( contentLength / 1024.0 ) / ( duration / 1000.0 );
+ throughput = " at " + format.format( kbPerSec ) + " KB/sec";
+ }
+
+ println( "transferSucceeded", type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " ("
+ + len + throughput + ")" );
+ }
+ }
+
+ @Override
+ public void transferFailed( TransferEvent event )
+ {
+ transferCompleted( event );
+
+ println( "transferFailed", event.getException().getClass() + ": " + event.getException().getMessage() );
+ }
+
+ private void transferCompleted( TransferEvent event )
+ {
+ downloads.remove( event.getResource() );
+
+ StringBuilder buffer = new StringBuilder( 64 );
+ pad( buffer, lastLength );
+ buffer.append( '\r' );
+ out.println( buffer );
+ }
+
+ @Override
+ public void transferCorrupted( TransferEvent event )
+ {
+ println( "transferCorrupted", event.getException().getClass() + ": " + event.getException().getMessage() );
+ }
+
+ protected long toKB( long bytes )
+ {
+ return ( bytes + 1023 ) / 1024;
+ }
+
+ private void println( String event, String message )
+ {
+ print( event, message );
+ out.println();
+ }
+
+ private void print( String event, String message )
+ {
+ out.print( "Aether Transfer - " + event );
+ if ( message != null )
+ {
+ out.print( ": " );
+ out.print( message );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5324/07.20.3-SNAPSHOT/maven-metadata.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5324/07.20.3-SNAPSHOT/maven-metadata.xml b/maven-resolver-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5324/07.20.3-SNAPSHOT/maven-metadata.xml
new file mode 100644
index 0000000..9f0a7fe
--- /dev/null
+++ b/maven-resolver-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5324/07.20.3-SNAPSHOT/maven-metadata.xml
@@ -0,0 +1,49 @@
+<?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.
+-->
+
+<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd"
+ modelVersion="1.1.0">
+ <groupId>org.apache.maven.its</groupId>
+ <artifactId>dep-mng5324</artifactId>
+ <version>07.20.3-SNAPSHOT</version><!-- metadata for artifact snapshot -->
+ <versioning>
+ <snapshot>
+ <timestamp>20120809.112920</timestamp>
+ <buildNumber>97</buildNumber>
+ </snapshot>
+ <lastUpdated>20120809112920</lastUpdated>
+ <snapshotVersions>
+ <snapshotVersion>
+ <classifier>classifierA</classifier>
+ <extension>jar</extension>
+ <value>07.20.3-20120809.112124-88</value>
+ <updated>20120809112124</updated>
+ </snapshotVersion>
+ <snapshotVersion>
+ <classifier>classifierB</classifier>
+ <extension>jar</extension>
+ <value>07.20.3-20120809.112920-97</value>
+ <updated>20120809112920</updated>
+ </snapshotVersion>
+ </snapshotVersions>
+ </versioning>
+</metadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5459/0.4.0-SNAPSHOT/maven-metadata.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5459/0.4.0-SNAPSHOT/maven-metadata.xml b/maven-resolver-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5459/0.4.0-SNAPSHOT/maven-metadata.xml
new file mode 100644
index 0000000..923f26f
--- /dev/null
+++ b/maven-resolver-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5459/0.4.0-SNAPSHOT/maven-metadata.xml
@@ -0,0 +1,47 @@
+<?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.
+-->
+
+<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd"
+ modelVersion="1.1.0">
+ <groupId>org.apache.maven.its</groupId>
+ <artifactId>dep-mng5459</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20130404.090532</timestamp>
+ <buildNumber>2</buildNumber>
+ </snapshot>
+ <lastUpdated>20130404093657</lastUpdated>
+ <snapshotVersions>
+ <snapshotVersion>
+ <extension>pom</extension>
+ <value>0.4.0-20130404.090532-2</value>
+ <updated>20130404090532</updated>
+ </snapshotVersion>
+ <snapshotVersion>
+ <extension>jar</extension>
+ <value>0.4.0-20130404.093655-3</value>
+ <updated>20130404093655</updated>
+ </snapshotVersion>
+ </snapshotVersions>
+ </versioning>
+</metadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0-classifier.zip
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0-classifier.zip b/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0-classifier.zip
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.jar
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.jar b/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.jar
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.pom
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.pom b/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.pom
new file mode 100644
index 0000000..f8b72af
--- /dev/null
+++ b/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.pom
@@ -0,0 +1,48 @@
+<?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>ut.simple</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <artifactId>artifact</artifactId>
+
+ <name>Simple Unit Test Artifact</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>ut.simple</groupId>
+ <artifactId>dependency</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ut.simple</groupId>
+ <artifactId>dependency</artifactId>
+ <version>1.0</version>
+ <classifier>sources</classifier>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.zip
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.zip b/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.zip
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/maven-metadata.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/maven-metadata.xml b/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/maven-metadata.xml
new file mode 100644
index 0000000..2de7ecc
--- /dev/null
+++ b/maven-resolver-provider/src/test/resources/repo/ut/simple/artifact/maven-metadata.xml
@@ -0,0 +1,34 @@
+<?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.
+-->
+
+<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd">
+ <groupId>ut.simple</groupId>
+ <artifactId>artifact</artifactId>
+ <versioning>
+ <latest>1.0</latest>
+ <release>1.0</release>
+ <versions>
+ <version>1.0</version>
+ </versions>
+ <lastUpdated>20111123122038</lastUpdated>
+ </versioning>
+</metadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0-sources.jar
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0-sources.jar b/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0-sources.jar
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.jar
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.jar b/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.jar
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.pom
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.pom b/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.pom
new file mode 100644
index 0000000..c021dfa
--- /dev/null
+++ b/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.pom
@@ -0,0 +1,31 @@
+<?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>ut.simple</groupId>
+ <artifactId>dependency</artifactId>
+ <version>1.0</version>
+
+ <name>Simple Unit Test Dependency</name>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/maven-metadata.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/maven-metadata.xml b/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/maven-metadata.xml
new file mode 100644
index 0000000..8a97c34
--- /dev/null
+++ b/maven-resolver-provider/src/test/resources/repo/ut/simple/dependency/maven-metadata.xml
@@ -0,0 +1,34 @@
+<?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.
+-->
+
+<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd">
+ <groupId>ut.simple</groupId>
+ <artifactId>dependency</artifactId>
+ <versioning>
+ <latest>1.0</latest>
+ <release>1.0</release>
+ <versions>
+ <version>1.0</version>
+ </versions>
+ <lastUpdated>20111123122038</lastUpdated>
+ </versioning>
+</metadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/ut/simple/parent/1.0/parent-1.0.pom
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/ut/simple/parent/1.0/parent-1.0.pom b/maven-resolver-provider/src/test/resources/repo/ut/simple/parent/1.0/parent-1.0.pom
new file mode 100644
index 0000000..ed64c9e
--- /dev/null
+++ b/maven-resolver-provider/src/test/resources/repo/ut/simple/parent/1.0/parent-1.0.pom
@@ -0,0 +1,43 @@
+<?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>ut.simple</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+
+ <name>Simple Unit Test Parent</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>ut.simple</groupId>
+ <artifactId>dependency</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/resources/repo/ut/simple/parent/maven-metadata.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/resources/repo/ut/simple/parent/maven-metadata.xml b/maven-resolver-provider/src/test/resources/repo/ut/simple/parent/maven-metadata.xml
new file mode 100644
index 0000000..7199d52
--- /dev/null
+++ b/maven-resolver-provider/src/test/resources/repo/ut/simple/parent/maven-metadata.xml
@@ -0,0 +1,34 @@
+<?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.
+-->
+
+<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd">
+ <groupId>ut.simple</groupId>
+ <artifactId>parent</artifactId>
+ <versioning>
+ <latest>1.0</latest>
+ <release>1.0</release>
+ <versions>
+ <version>1.0</version>
+ </versions>
+ <lastUpdated>20111123122038</lastUpdated>
+ </versioning>
+</metadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0e3b9a7..36bdf5b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,7 +86,7 @@ under the License.
<module>maven-settings</module>
<module>maven-settings-builder</module>
<module>maven-artifact</module>
- <module>maven-aether-provider</module>
+ <module>maven-resolver-provider</module>
<module>maven-repository-metadata</module>
<module>maven-slf4j-provider</module>
<module>maven-embedder</module>
@@ -209,7 +209,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
- <artifactId>maven-aether-provider</artifactId>
+ <artifactId>maven-resolver-provider</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
[5/9] maven git commit: [MNG-6110] renamed 'maven-aether-provider' to
'maven-resolver-provider'
Posted by hb...@apache.org.
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/AbstractRepositoryTestCase.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/AbstractRepositoryTestCase.java b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/AbstractRepositoryTestCase.java
deleted file mode 100644
index b81450c..0000000
--- a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/AbstractRepositoryTestCase.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.net.MalformedURLException;
-
-import org.apache.maven.repository.internal.util.ConsoleRepositoryListener;
-import org.apache.maven.repository.internal.util.ConsoleTransferListener;
-import org.codehaus.plexus.ContainerConfiguration;
-import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
-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;
-
-public abstract class AbstractRepositoryTestCase
- extends PlexusTestCase
-{
- protected RepositorySystem system;
-
- protected RepositorySystemSession session;
-
- @Override
- protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
- {
- super.customizeContainerConfiguration( containerConfiguration );
- containerConfiguration.setAutoWiring( true );
- containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
- }
-
- @Override
- protected void setUp()
- throws Exception
- {
- super.setUp();
- system = lookup( RepositorySystem.class );
- session = newMavenRepositorySystemSession( system );
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- session = null;
- system = null;
- super.tearDown();
- }
-
- public static RepositorySystemSession newMavenRepositorySystemSession( 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() );
-
- return session;
- }
-
- public static RemoteRepository newTestRepository()
- throws MalformedURLException
- {
- return new RemoteRepository.Builder( "repo", "default",
- getTestFile( "target/test-classes/repo" ).toURI().toURL().toString() ).build();
- }
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReaderTest.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReaderTest.java b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReaderTest.java
deleted file mode 100644
index e873138..0000000
--- a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReaderTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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 static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import org.eclipse.aether.RepositoryEvent;
-import org.eclipse.aether.RepositoryEvent.EventType;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.impl.ArtifactDescriptorReader;
-import org.eclipse.aether.impl.RepositoryEventDispatcher;
-import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
-import org.mockito.ArgumentCaptor;
-
-public class DefaultArtifactDescriptorReaderTest
- extends AbstractRepositoryTestCase
-{
-
- public void testMng5459()
- throws Exception
- {
- // prepare
- DefaultArtifactDescriptorReader reader = (DefaultArtifactDescriptorReader) lookup( ArtifactDescriptorReader.class );
-
- RepositoryEventDispatcher eventDispatcher = mock( RepositoryEventDispatcher.class );
-
- ArgumentCaptor<RepositoryEvent> event = ArgumentCaptor.forClass( RepositoryEvent.class );
-
- reader.setRepositoryEventDispatcher( eventDispatcher );
-
- ArtifactDescriptorRequest request = new ArtifactDescriptorRequest();
-
- request.addRepository( newTestRepository() );
-
- request.setArtifact( new DefaultArtifact( "org.apache.maven.its", "dep-mng5459", "jar", "0.4.0-SNAPSHOT" ) );
-
- // execute
- reader.readArtifactDescriptor( session, request );
-
- // verify
- verify( eventDispatcher ).dispatch( event.capture() );
-
- boolean missingArtifactDescriptor = false;
-
- for( RepositoryEvent evt : event.getAllValues() )
- {
- if ( EventType.ARTIFACT_DESCRIPTOR_MISSING.equals( evt.getType() ) )
- {
- assertEquals( "Could not find artifact org.apache.maven.its:dep-mng5459:pom:0.4.0-20130404.090532-2 in repo (" + newTestRepository().getUrl() + ")", evt.getException().getMessage() );
- missingArtifactDescriptor = true;
- }
- }
-
- if( !missingArtifactDescriptor )
- {
- fail( "Expected missing artifact descriptor for org.apache.maven.its:dep-mng5459:pom:0.4.0-20130404.090532-2" );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/DefaultVersionResolverTest.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/DefaultVersionResolverTest.java b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/DefaultVersionResolverTest.java
deleted file mode 100644
index 90dd6a4..0000000
--- a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/DefaultVersionResolverTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.artifact.Artifact;
-import org.eclipse.aether.impl.VersionResolver;
-import org.eclipse.aether.resolution.VersionRequest;
-import org.eclipse.aether.resolution.VersionResult;
-import org.eclipse.aether.artifact.DefaultArtifact;
-
-public class DefaultVersionResolverTest
- extends AbstractRepositoryTestCase
-{
- private DefaultVersionResolver versionResolver;
-
- @Override
- protected void setUp()
- throws Exception
- {
- super.setUp();
- // be sure we're testing the right class, i.e. DefaultVersionResolver.class
- versionResolver = (DefaultVersionResolver) lookup( VersionResolver.class, "default" );
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- versionResolver = null;
- super.tearDown();
- }
-
- public void testResolveSeparateInstalledClassifiedNonUniqueVersionedArtifacts()
- throws Exception
- {
- VersionRequest requestB = new VersionRequest();
- requestB.addRepository( newTestRepository() );
- Artifact artifactB =
- new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", "07.20.3-SNAPSHOT" );
- requestB.setArtifact( artifactB );
-
- VersionResult resultB = versionResolver.resolveVersion( session, requestB );
- assertEquals( "07.20.3-20120809.112920-97", resultB.getVersion() );
-
- VersionRequest requestA = new VersionRequest();
- requestA.addRepository( newTestRepository() );
-
- Artifact artifactA =
- new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", "07.20.3-SNAPSHOT" );
- requestA.setArtifact( artifactA );
-
- VersionResult resultA = versionResolver.resolveVersion( session, requestA );
- assertEquals( "07.20.3-20120809.112124-88", resultA.getVersion() );
- }
-
- public void testResolveSeparateInstalledClassifiedNonVersionedArtifacts()
- throws Exception
- {
- VersionRequest requestA = new VersionRequest();
- requestA.addRepository( newTestRepository() );
- String versionA = "07.20.3-20120809.112124-88";
- Artifact artifactA =
- new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", versionA );
- requestA.setArtifact( artifactA );
-
- VersionResult resultA = versionResolver.resolveVersion( session, requestA );
- assertEquals( versionA, resultA.getVersion() );
-
- VersionRequest requestB = new VersionRequest();
- requestB.addRepository( newTestRepository() );
- String versionB = "07.20.3-20120809.112920-97";
- Artifact artifactB =
- new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", versionB );
- requestB.setArtifact( artifactB );
-
- VersionResult resultB = versionResolver.resolveVersion( session, requestB );
- assertEquals( versionB, resultB.getVersion() );
- }
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/MavenRepositorySystemUtilsTest.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/MavenRepositorySystemUtilsTest.java b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/MavenRepositorySystemUtilsTest.java
deleted file mode 100644
index 768835a..0000000
--- a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/MavenRepositorySystemUtilsTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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 org.eclipse.aether.impl.MetadataGeneratorFactory;
-import org.eclipse.aether.spi.locator.ServiceLocator;
-
-import junit.framework.TestCase;
-
-public class MavenRepositorySystemUtilsTest
- extends TestCase
-{
-
- public void testGetRepositorySystem()
- {
- ServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
- RepositorySystem repoSys = locator.getService( RepositorySystem.class );
- assertNotNull( repoSys );
- }
-
- public void testGetMetadataGeneratorFactories()
- {
- ServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
- assertEquals( 2, locator.getServices( MetadataGeneratorFactory.class ).size() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java
deleted file mode 100644
index 278231f..0000000
--- a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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 static org.junit.Assert.assertTrue;
-
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Set;
-
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class RemoteSnapshotMetadataTest
-{
- private Locale defaultLocale;
-
- @Before
- public void setLocaleToUseBuddhistCalendar()
- {
- defaultLocale = Locale.getDefault();
- Locale.setDefault( new Locale( "th", "TH" ) );
- }
-
- @After
- public void restoreLocale()
- {
- Locale.setDefault( defaultLocale );
- }
-
- static String gregorianDate()
- {
- SimpleDateFormat df = new SimpleDateFormat( "yyyyMMdd" );
- df.setCalendar( new GregorianCalendar() );
- df.setTimeZone( RemoteSnapshotMetadata.DEFAULT_SNAPSHOT_TIME_ZONE );
- return df.format( new Date() );
- }
-
- @Test
- public void gregorianCalendarIsUsed()
- {
- String dateBefore = gregorianDate();
-
- RemoteSnapshotMetadata metadata = new RemoteSnapshotMetadata(
- new DefaultArtifact( "a:b:1-SNAPSHOT" ), false);
- metadata.merge( new Metadata() );
-
- String dateAfter = gregorianDate();
-
- String ts = metadata.metadata.getVersioning().getSnapshot().getTimestamp();
- String datePart = ts.replaceAll( "\\..*", "" );
-
- /* Allow for this test running across midnight */
- Set<String> expected = new HashSet<String>( Arrays.asList( dateBefore, dateAfter ) );
- assertTrue( "Expected " + datePart + " to be in " + expected,
- expected.contains( datePart ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RepositorySystemTest.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RepositorySystemTest.java b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RepositorySystemTest.java
deleted file mode 100644
index db77a44..0000000
--- a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/RepositorySystemTest.java
+++ /dev/null
@@ -1,220 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.Arrays;
-import java.util.List;
-
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.collection.CollectRequest;
-import org.eclipse.aether.collection.CollectResult;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
-import org.eclipse.aether.resolution.ArtifactDescriptorResult;
-import org.eclipse.aether.resolution.ArtifactRequest;
-import org.eclipse.aether.resolution.ArtifactResult;
-import org.eclipse.aether.artifact.DefaultArtifact;
-
-public class RepositorySystemTest
- extends AbstractRepositoryTestCase
-{
- public void testResolveVersionRange()
- throws Exception
- {
- //VersionRangeResult resolveVersionRange( RepositorySystemSession session, VersionRangeRequest request )
- // throws VersionRangeResolutionException;
-
- }
-
- public void testResolveVersion()
- throws Exception
- {
- //VersionResult resolveVersion( RepositorySystemSession session, VersionRequest request )
- // throws VersionResolutionException;
- }
-
- public void testReadArtifactDescriptor()
- throws Exception
- {
- Artifact artifact = new DefaultArtifact( "ut.simple:artifact:extension:classifier:1.0" );
-
- ArtifactDescriptorRequest request = new ArtifactDescriptorRequest();
- request.setArtifact( artifact );
- request.addRepository( newTestRepository() );
-
- ArtifactDescriptorResult result = system.readArtifactDescriptor( session, request );
-
- List<Dependency> deps = result.getDependencies();
- assertEquals( 2, deps.size() );
- checkUtSimpleArtifactDependencies( deps.get( 0 ), deps.get( 1 ) );
- }
-
- /**
- * check ut.simple:artifact:1.0 dependencies
- */
- private void checkUtSimpleArtifactDependencies( Dependency dep1, Dependency dep2 )
- {
- assertEquals( "compile", dep1.getScope() );
- assertFalse( dep1.isOptional() );
- assertEquals( 0, dep1.getExclusions().size() );
- Artifact depArtifact = dep1.getArtifact();
- assertEquals( "ut.simple", depArtifact.getGroupId() );
- assertEquals( "dependency", depArtifact.getArtifactId() );
- assertEquals( "1.0", depArtifact.getVersion() );
- assertEquals( "1.0", depArtifact.getBaseVersion() );
- assertNull( depArtifact.getFile() );
- assertFalse( depArtifact.isSnapshot() );
- assertEquals( "", depArtifact.getClassifier() );
- assertEquals( "jar", depArtifact.getExtension() );
- assertEquals( "java", depArtifact.getProperty( "language", null ) );
- assertEquals( "jar", depArtifact.getProperty( "type", null ) );
- assertEquals( "true", depArtifact.getProperty( "constitutesBuildPath", null ) );
- assertEquals( "false", depArtifact.getProperty( "includesDependencies", null ) );
- assertEquals( 4, depArtifact.getProperties().size() );
-
- assertEquals( "compile", dep2.getScope() );
- assertFalse( dep2.isOptional() );
- assertEquals( 0, dep2.getExclusions().size() );
- depArtifact = dep2.getArtifact();
- assertEquals( "ut.simple", depArtifact.getGroupId() );
- assertEquals( "dependency", depArtifact.getArtifactId() );
- assertEquals( "1.0", depArtifact.getVersion() );
- assertEquals( "1.0", depArtifact.getBaseVersion() );
- assertNull( depArtifact.getFile() );
- assertFalse( depArtifact.isSnapshot() );
- assertEquals( "sources", depArtifact.getClassifier() );
- assertEquals( "jar", depArtifact.getExtension() );
- assertEquals( "java", depArtifact.getProperty( "language", null ) );
- assertEquals( "jar", depArtifact.getProperty( "type", null ) ); // shouldn't it be java-sources given the classifier?
- assertEquals( "true", depArtifact.getProperty( "constitutesBuildPath", null ) ); // shouldn't it be false given the classifier?
- assertEquals( "false", depArtifact.getProperty( "includesDependencies", null ) );
- assertEquals( 4, depArtifact.getProperties().size() );
- }
-
- public void testCollectDependencies()
- throws Exception
- {
- Artifact artifact = new DefaultArtifact( "ut.simple:artifact:extension:classifier:1.0" );
- // notice: extension and classifier not really used in this test...
-
- CollectRequest collectRequest = new CollectRequest();
- collectRequest.setRoot( new Dependency( artifact, null ) );
- collectRequest.addRepository( newTestRepository() );
-
- CollectResult collectResult = system.collectDependencies( session, collectRequest );
-
- List<DependencyNode> nodes = collectResult.getRoot().getChildren();
- assertEquals( 2, nodes.size() );
- checkUtSimpleArtifactDependencies( nodes.get( 0 ).getDependency(), nodes.get( 1 ).getDependency() );
- }
-
- public void testResolveArtifact()
- throws Exception
- {
- Artifact artifact = new DefaultArtifact( "ut.simple:artifact:1.0" );
-
- ArtifactRequest artifactRequest = new ArtifactRequest();
- artifactRequest.setArtifact( artifact );
- artifactRequest.addRepository( newTestRepository() );
-
- ArtifactResult artifactResult = system.resolveArtifact( session, artifactRequest );
- checkArtifactResult( artifactResult, "artifact-1.0.jar" );
-
- artifact = new DefaultArtifact( "ut.simple:artifact:zip:1.0" );
- artifactRequest.setArtifact( artifact );
- artifactResult = system.resolveArtifact( session, artifactRequest );
- checkArtifactResult( artifactResult, "artifact-1.0.zip" );
-
- artifact = new DefaultArtifact( "ut.simple:artifact:zip:classifier:1.0" );
- artifactRequest.setArtifact( artifact );
- artifactResult = system.resolveArtifact( session, artifactRequest );
- checkArtifactResult( artifactResult, "artifact-1.0-classifier.zip" );
- }
-
- private void checkArtifactResult( ArtifactResult result, String filename )
- {
- assertFalse( result.isMissing() );
- assertTrue( result.isResolved() );
- Artifact artifact = result.getArtifact();
- assertNotNull( artifact.getFile() );
- assertEquals( filename, artifact.getFile().getName() );
- }
-
- public void testResolveArtifacts()
- throws Exception
- {
- ArtifactRequest req1 = new ArtifactRequest();
- req1.setArtifact( new DefaultArtifact( "ut.simple:artifact:1.0" ) );
- req1.addRepository( newTestRepository() );
-
- ArtifactRequest req2 = new ArtifactRequest();
- req2.setArtifact( new DefaultArtifact( "ut.simple:artifact:zip:1.0" ) );
- req2.addRepository( newTestRepository() );
-
- ArtifactRequest req3 = new ArtifactRequest();
- req3.setArtifact( new DefaultArtifact( "ut.simple:artifact:zip:classifier:1.0" ) );
- req3.addRepository( newTestRepository() );
-
- List<ArtifactRequest> requests = Arrays.asList( req1, req2, req3 );
-
- List<ArtifactResult> results = system.resolveArtifacts( session, requests );
-
- assertEquals( 3, results.size() );
- checkArtifactResult( results.get( 0 ), "artifact-1.0.jar" );
- checkArtifactResult( results.get( 1 ), "artifact-1.0.zip" );
- checkArtifactResult( results.get( 2 ), "artifact-1.0-classifier.zip" );
- }
-
- public void testResolveMetadata()
- throws Exception
- {
- //List<MetadataResult> resolveMetadata( RepositorySystemSession session,
- // Collection<? extends MetadataRequest> requests );
- }
-
- public void testInstall()
- throws Exception
- {
- //InstallResult install( RepositorySystemSession session, InstallRequest request )
- // throws InstallationException;
- // release, snapshot unique ou non unique, attachement
- }
-
- public void testDeploy()
- throws Exception
- {
- //DeployResult deploy( RepositorySystemSession session, DeployRequest request )
- // throws DeploymentException;
- }
-
- public void testNewLocalRepositoryManager()
- throws Exception
- {
- //LocalRepositoryManager newLocalRepositoryManager( LocalRepository localRepository );
- }
-
- public void testNewSyncContext()
- throws Exception
- {
- //SyncContext newSyncContext( RepositorySystemSession session, boolean shared );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleRepositoryListener.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleRepositoryListener.java b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleRepositoryListener.java
deleted file mode 100644
index 2879a9f..0000000
--- a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleRepositoryListener.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.apache.maven.repository.internal.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;
-
-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 )
- {
- println( "artifactDeployed", event.getArtifact() + " to " + event.getRepository() );
- }
-
- public void artifactDeploying( RepositoryEvent event )
- {
- println( "artifactDeploying", event.getArtifact() + " to " + event.getRepository() );
- }
-
- public void artifactDescriptorInvalid( RepositoryEvent event )
- {
- println( "artifactDescriptorInvalid", "for " + event.getArtifact() + ": " + event.getException().getMessage() );
- }
-
- public void artifactDescriptorMissing( RepositoryEvent event )
- {
- println( "artifactDescriptorMissing", "for " + event.getArtifact() );
- }
-
- public void artifactInstalled( RepositoryEvent event )
- {
- println( "artifactInstalled", event.getArtifact() + " to " + event.getFile() );
- }
-
- public void artifactInstalling( RepositoryEvent event )
- {
- println( "artifactInstalling", event.getArtifact() + " to " + event.getFile() );
- }
-
- public void artifactResolved( RepositoryEvent event )
- {
- println( "artifactResolved", event.getArtifact() + " from " + event.getRepository() );
- }
-
- public void artifactDownloading( RepositoryEvent event )
- {
- println( "artifactDownloading", event.getArtifact() + " from " + event.getRepository() );
- }
-
- public void artifactDownloaded( RepositoryEvent event )
- {
- println( "artifactDownloaded", event.getArtifact() + " from " + event.getRepository() );
- }
-
- public void artifactResolving( RepositoryEvent event )
- {
- println( "artifactResolving", event.getArtifact().toString() );
- }
-
- public void metadataDeployed( RepositoryEvent event )
- {
- println( "metadataDeployed", event.getMetadata() + " to " + event.getRepository() );
- }
-
- public void metadataDeploying( RepositoryEvent event )
- {
- println( "metadataDeploying", event.getMetadata() + " to " + event.getRepository() );
- }
-
- public void metadataInstalled( RepositoryEvent event )
- {
- println( "metadataInstalled", event.getMetadata() + " to " + event.getFile() );
- }
-
- public void metadataInstalling( RepositoryEvent event )
- {
- println( "metadataInstalling", event.getMetadata() + " to " + event.getFile() );
- }
-
- public void metadataInvalid( RepositoryEvent event )
- {
- println( "metadataInvalid", event.getMetadata().toString() );
- }
-
- public void metadataResolved( RepositoryEvent event )
- {
- println( "metadataResolved", event.getMetadata() + " from " + event.getRepository() );
- }
-
- public void metadataResolving( RepositoryEvent event )
- {
- println( "metadataResolving", event.getMetadata() + " from " + event.getRepository() );
- }
-
- private void println( String event, String message )
- {
- out.println( "Aether Repository - " + event + ": " + message );
- }
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleTransferListener.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleTransferListener.java b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleTransferListener.java
deleted file mode 100644
index cf587d8..0000000
--- a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleTransferListener.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package org.apache.maven.repository.internal.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.TransferEvent;
-import org.eclipse.aether.transfer.TransferResource;
-
-public class ConsoleTransferListener
- extends AbstractTransferListener
-{
-
- private PrintStream out;
-
- private Map<TransferResource, Long> downloads = new ConcurrentHashMap<>();
-
- 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";
-
- println( "transferInitiated", message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName() );
- }
-
- @Override
- public void transferProgressed( TransferEvent event )
- {
- TransferResource resource = event.getResource();
- downloads.put( resource, event.getTransferredBytes() );
-
- StringBuilder buffer = new StringBuilder( 64 );
-
- for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() )
- {
- long total = entry.getKey().getContentLength();
- long complete = entry.getValue();
-
- buffer.append( getStatus( complete, total ) ).append( " " );
- }
-
- int pad = lastLength - buffer.length();
- lastLength = buffer.length();
- pad( buffer, pad );
- buffer.append( '\r' );
-
- print( "transferProgressed", buffer.toString() );
- }
-
- 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 )
- {
- DecimalFormat format = new DecimalFormat( "0.0", new DecimalFormatSymbols( Locale.ENGLISH ) );
- double kbPerSec = ( contentLength / 1024.0 ) / ( duration / 1000.0 );
- throughput = " at " + format.format( kbPerSec ) + " KB/sec";
- }
-
- println( "transferSucceeded", type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " ("
- + len + throughput + ")" );
- }
- }
-
- @Override
- public void transferFailed( TransferEvent event )
- {
- transferCompleted( event );
-
- println( "transferFailed", event.getException().getClass() + ": " + event.getException().getMessage() );
- }
-
- private void transferCompleted( TransferEvent event )
- {
- downloads.remove( event.getResource() );
-
- StringBuilder buffer = new StringBuilder( 64 );
- pad( buffer, lastLength );
- buffer.append( '\r' );
- out.println( buffer );
- }
-
- @Override
- public void transferCorrupted( TransferEvent event )
- {
- println( "transferCorrupted", event.getException().getClass() + ": " + event.getException().getMessage() );
- }
-
- protected long toKB( long bytes )
- {
- return ( bytes + 1023 ) / 1024;
- }
-
- private void println( String event, String message )
- {
- print( event, message );
- out.println();
- }
-
- private void print( String event, String message )
- {
- out.print( "Aether Transfer - " + event );
- if ( message != null )
- {
- out.print( ": " );
- out.print( message );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5324/07.20.3-SNAPSHOT/maven-metadata.xml
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5324/07.20.3-SNAPSHOT/maven-metadata.xml b/maven-aether-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5324/07.20.3-SNAPSHOT/maven-metadata.xml
deleted file mode 100644
index 9f0a7fe..0000000
--- a/maven-aether-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5324/07.20.3-SNAPSHOT/maven-metadata.xml
+++ /dev/null
@@ -1,49 +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.
--->
-
-<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd"
- modelVersion="1.1.0">
- <groupId>org.apache.maven.its</groupId>
- <artifactId>dep-mng5324</artifactId>
- <version>07.20.3-SNAPSHOT</version><!-- metadata for artifact snapshot -->
- <versioning>
- <snapshot>
- <timestamp>20120809.112920</timestamp>
- <buildNumber>97</buildNumber>
- </snapshot>
- <lastUpdated>20120809112920</lastUpdated>
- <snapshotVersions>
- <snapshotVersion>
- <classifier>classifierA</classifier>
- <extension>jar</extension>
- <value>07.20.3-20120809.112124-88</value>
- <updated>20120809112124</updated>
- </snapshotVersion>
- <snapshotVersion>
- <classifier>classifierB</classifier>
- <extension>jar</extension>
- <value>07.20.3-20120809.112920-97</value>
- <updated>20120809112920</updated>
- </snapshotVersion>
- </snapshotVersions>
- </versioning>
-</metadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5459/0.4.0-SNAPSHOT/maven-metadata.xml
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5459/0.4.0-SNAPSHOT/maven-metadata.xml b/maven-aether-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5459/0.4.0-SNAPSHOT/maven-metadata.xml
deleted file mode 100644
index 923f26f..0000000
--- a/maven-aether-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5459/0.4.0-SNAPSHOT/maven-metadata.xml
+++ /dev/null
@@ -1,47 +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.
--->
-
-<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd"
- modelVersion="1.1.0">
- <groupId>org.apache.maven.its</groupId>
- <artifactId>dep-mng5459</artifactId>
- <version>0.4.0-SNAPSHOT</version>
- <versioning>
- <snapshot>
- <timestamp>20130404.090532</timestamp>
- <buildNumber>2</buildNumber>
- </snapshot>
- <lastUpdated>20130404093657</lastUpdated>
- <snapshotVersions>
- <snapshotVersion>
- <extension>pom</extension>
- <value>0.4.0-20130404.090532-2</value>
- <updated>20130404090532</updated>
- </snapshotVersion>
- <snapshotVersion>
- <extension>jar</extension>
- <value>0.4.0-20130404.093655-3</value>
- <updated>20130404093655</updated>
- </snapshotVersion>
- </snapshotVersions>
- </versioning>
-</metadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0-classifier.zip
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0-classifier.zip b/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0-classifier.zip
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.jar
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.jar b/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.jar
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.pom
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.pom b/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.pom
deleted file mode 100644
index f8b72af..0000000
--- a/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.pom
+++ /dev/null
@@ -1,48 +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>ut.simple</groupId>
- <artifactId>parent</artifactId>
- <version>1.0</version>
- </parent>
-
- <artifactId>artifact</artifactId>
-
- <name>Simple Unit Test Artifact</name>
-
- <dependencies>
- <dependency>
- <groupId>ut.simple</groupId>
- <artifactId>dependency</artifactId>
- </dependency>
- <dependency>
- <groupId>ut.simple</groupId>
- <artifactId>dependency</artifactId>
- <version>1.0</version>
- <classifier>sources</classifier>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.zip
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.zip b/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/1.0/artifact-1.0.zip
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/maven-metadata.xml
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/maven-metadata.xml b/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/maven-metadata.xml
deleted file mode 100644
index 2de7ecc..0000000
--- a/maven-aether-provider/src/test/resources/repo/ut/simple/artifact/maven-metadata.xml
+++ /dev/null
@@ -1,34 +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.
--->
-
-<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd">
- <groupId>ut.simple</groupId>
- <artifactId>artifact</artifactId>
- <versioning>
- <latest>1.0</latest>
- <release>1.0</release>
- <versions>
- <version>1.0</version>
- </versions>
- <lastUpdated>20111123122038</lastUpdated>
- </versioning>
-</metadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0-sources.jar
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0-sources.jar b/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0-sources.jar
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.jar
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.jar b/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.jar
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.pom
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.pom b/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.pom
deleted file mode 100644
index c021dfa..0000000
--- a/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/1.0/dependency-1.0.pom
+++ /dev/null
@@ -1,31 +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>ut.simple</groupId>
- <artifactId>dependency</artifactId>
- <version>1.0</version>
-
- <name>Simple Unit Test Dependency</name>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/maven-metadata.xml
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/maven-metadata.xml b/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/maven-metadata.xml
deleted file mode 100644
index 8a97c34..0000000
--- a/maven-aether-provider/src/test/resources/repo/ut/simple/dependency/maven-metadata.xml
+++ /dev/null
@@ -1,34 +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.
--->
-
-<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd">
- <groupId>ut.simple</groupId>
- <artifactId>dependency</artifactId>
- <versioning>
- <latest>1.0</latest>
- <release>1.0</release>
- <versions>
- <version>1.0</version>
- </versions>
- <lastUpdated>20111123122038</lastUpdated>
- </versioning>
-</metadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/ut/simple/parent/1.0/parent-1.0.pom
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/parent/1.0/parent-1.0.pom b/maven-aether-provider/src/test/resources/repo/ut/simple/parent/1.0/parent-1.0.pom
deleted file mode 100644
index ed64c9e..0000000
--- a/maven-aether-provider/src/test/resources/repo/ut/simple/parent/1.0/parent-1.0.pom
+++ /dev/null
@@ -1,43 +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>ut.simple</groupId>
- <artifactId>parent</artifactId>
- <version>1.0</version>
- <packaging>pom</packaging>
-
- <name>Simple Unit Test Parent</name>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>ut.simple</groupId>
- <artifactId>dependency</artifactId>
- <version>1.0</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/test/resources/repo/ut/simple/parent/maven-metadata.xml
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/test/resources/repo/ut/simple/parent/maven-metadata.xml b/maven-aether-provider/src/test/resources/repo/ut/simple/parent/maven-metadata.xml
deleted file mode 100644
index 7199d52..0000000
--- a/maven-aether-provider/src/test/resources/repo/ut/simple/parent/maven-metadata.xml
+++ /dev/null
@@ -1,34 +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.
--->
-
-<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd">
- <groupId>ut.simple</groupId>
- <artifactId>parent</artifactId>
- <versioning>
- <latest>1.0</latest>
- <release>1.0</release>
- <versions>
- <version>1.0</version>
- </versions>
- <lastUpdated>20111123122038</lastUpdated>
- </versioning>
-</metadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-compat/pom.xml
----------------------------------------------------------------------
diff --git a/maven-compat/pom.xml b/maven-compat/pom.xml
index 876c11c..c740504 100644
--- a/maven-compat/pom.xml
+++ b/maven-compat/pom.xml
@@ -60,7 +60,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
- <artifactId>maven-aether-provider</artifactId>
+ <artifactId>maven-resolver-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-core/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/pom.xml b/maven-core/pom.xml
index ad5484a..95162bd 100644
--- a/maven-core/pom.xml
+++ b/maven-core/pom.xml
@@ -70,7 +70,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
- <artifactId>maven-aether-provider</artifactId>
+ <artifactId>maven-resolver-provider</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-core/src/main/resources/META-INF/maven/extension.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/main/resources/META-INF/maven/extension.xml b/maven-core/src/main/resources/META-INF/maven/extension.xml
index f9cf07a..1d24d92 100644
--- a/maven-core/src/main/resources/META-INF/maven/extension.xml
+++ b/maven-core/src/main/resources/META-INF/maven/extension.xml
@@ -54,7 +54,7 @@ under the License.
<exportedPackage>org.apache.maven.wagon.repository</exportedPackage>
<exportedPackage>org.apache.maven.wagon.resource</exportedPackage>
- <!-- aether-api, aether-spi, aether-impl -->
+ <!-- maven-resolver-api, maven-resolver-spi, maven-resolver-impl -->
<exportedPackage>org.eclipse.aether.*</exportedPackage>
<exportedPackage>org.eclipse.aether.artifact</exportedPackage>
<exportedPackage>org.eclipse.aether.collection</exportedPackage>
@@ -132,7 +132,7 @@ under the License.
<exportedArtifact>org.sonatype.sisu:sisu-inject-plexus</exportedArtifact>
<exportedArtifact>org.eclipse.sisu:org.eclipse.sisu.plexus</exportedArtifact>
<exportedArtifact>org.apache.maven:maven-artifact</exportedArtifact>
- <exportedArtifact>org.apache.maven:maven-aether-provider</exportedArtifact>
+ <exportedArtifact>org.apache.maven:maven-resolver-provider</exportedArtifact>
<exportedArtifact>org.apache.maven:maven-artifact-manager</exportedArtifact>
<exportedArtifact>org.apache.maven:maven-compat</exportedArtifact>
<exportedArtifact>org.apache.maven:maven-core</exportedArtifact>
@@ -152,9 +152,9 @@ under the License.
<exportedArtifact>org.apache.maven:maven-settings-builder</exportedArtifact>
<exportedArtifact>org.apache.maven:maven-toolchain</exportedArtifact>
<exportedArtifact>org.apache.maven.wagon:wagon-provider-api</exportedArtifact>
- <exportedArtifact>org.eclipse.aether:aether-api</exportedArtifact>
- <exportedArtifact>org.eclipse.aether:aether-spi</exportedArtifact>
- <exportedArtifact>org.eclipse.aether:aether-impl</exportedArtifact>
+ <exportedArtifact>org.apache.maven.resolver:maven-resolver-api</exportedArtifact>
+ <exportedArtifact>org.apache.maven.resolver:maven-resolver-spi</exportedArtifact>
+ <exportedArtifact>org.apache.maven.resolver:maven-resolver-impl</exportedArtifact>
<exportedArtifact>javax.inject:javax.inject</exportedArtifact>
<exportedArtifact>org.slf4j:slf4j-api</exportedArtifact>
@@ -166,6 +166,9 @@ under the License.
<exportedArtifact>org.sonatype.aether:aether-api</exportedArtifact>
<exportedArtifact>org.sonatype.aether:aether-spi</exportedArtifact>
<exportedArtifact>org.sonatype.aether:aether-impl</exportedArtifact>
+ <exportedArtifact>org.eclipse.aether:aether-api</exportedArtifact>
+ <exportedArtifact>org.eclipse.aether:aether-spi</exportedArtifact>
+ <exportedArtifact>org.eclipse.aether:aether-impl</exportedArtifact>
<!--
| NOTE: Don't exclude the wagons or any of their dependencies (apart from the wagon API). This would otherwise
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/pom.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/pom.xml b/maven-resolver-provider/pom.xml
new file mode 100644
index 0000000..7d71e33
--- /dev/null
+++ b/maven-resolver-provider/pom.xml
@@ -0,0 +1,128 @@
+<?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</groupId>
+ <artifactId>maven</artifactId>
+ <version>3.5.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>maven-resolver-provider</artifactId>
+
+ <name>Maven Artifact Resolver Provider</name>
+ <description>Extensions to Maven Resolver for utilizing Maven POM and repository metadata.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model-builder</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-repository-metadata</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ <classifier>no_aop</classifier>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>aopalliance</groupId>
+ <artifactId>aopalliance</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <!-- Testing -->
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-connector-basic</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-transport-wagon</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-file</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.sisu</groupId>
+ <artifactId>org.eclipse.sisu.plexus</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.9.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-metadata</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
+
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorReaderDelegate.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorReaderDelegate.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorReaderDelegate.java
new file mode 100644
index 0000000..2395b36
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorReaderDelegate.java
@@ -0,0 +1,153 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.License;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Prerequisites;
+import org.apache.maven.model.Repository;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.ArtifactProperties;
+import org.eclipse.aether.artifact.ArtifactType;
+import org.eclipse.aether.artifact.ArtifactTypeRegistry;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.DefaultArtifactType;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.Exclusion;
+import org.eclipse.aether.resolution.ArtifactDescriptorResult;
+
+/**
+ * Populates Aether {@link ArtifactDescriptorResult} from Maven project {@link Model}.
+ *
+ * @since 3.2.4
+ * @provisional This class is part of work in progress and can be changed or removed without notice.
+ */
+public class ArtifactDescriptorReaderDelegate
+{
+ public void populateResult( RepositorySystemSession session, ArtifactDescriptorResult result, Model model )
+ {
+ ArtifactTypeRegistry stereotypes = session.getArtifactTypeRegistry();
+
+ for ( Repository r : model.getRepositories() )
+ {
+ result.addRepository( ArtifactDescriptorUtils.toRemoteRepository( r ) );
+ }
+
+ for ( org.apache.maven.model.Dependency dependency : model.getDependencies() )
+ {
+ result.addDependency( convert( dependency, stereotypes ) );
+ }
+
+ DependencyManagement mngt = model.getDependencyManagement();
+ if ( mngt != null )
+ {
+ for ( org.apache.maven.model.Dependency dependency : mngt.getDependencies() )
+ {
+ result.addManagedDependency( convert( dependency, stereotypes ) );
+ }
+ }
+
+ Map<String, Object> properties = new LinkedHashMap<>();
+
+ Prerequisites prerequisites = model.getPrerequisites();
+ if ( prerequisites != null )
+ {
+ properties.put( "prerequisites.maven", prerequisites.getMaven() );
+ }
+
+ List<License> licenses = model.getLicenses();
+ properties.put( "license.count", licenses.size() );
+ for ( int i = 0; i < licenses.size(); i++ )
+ {
+ License license = licenses.get( i );
+ properties.put( "license." + i + ".name", license.getName() );
+ properties.put( "license." + i + ".url", license.getUrl() );
+ properties.put( "license." + i + ".comments", license.getComments() );
+ properties.put( "license." + i + ".distribution", license.getDistribution() );
+ }
+
+ result.setProperties( properties );
+
+ setArtifactProperties( result, model );
+ }
+
+ private Dependency convert( org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes )
+ {
+ ArtifactType stereotype = stereotypes.get( dependency.getType() );
+ if ( stereotype == null )
+ {
+ stereotype = new DefaultArtifactType( dependency.getType() );
+ }
+
+ boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0;
+
+ Map<String, String> props = null;
+ if ( system )
+ {
+ props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() );
+ }
+
+ Artifact artifact =
+ new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null,
+ dependency.getVersion(), props, stereotype );
+
+ List<Exclusion> exclusions = new ArrayList<>( dependency.getExclusions().size() );
+ for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() )
+ {
+ exclusions.add( convert( exclusion ) );
+ }
+
+ Dependency result = new Dependency( artifact, dependency.getScope(), dependency.isOptional(), exclusions );
+
+ return result;
+ }
+
+ private Exclusion convert( org.apache.maven.model.Exclusion exclusion )
+ {
+ return new Exclusion( exclusion.getGroupId(), exclusion.getArtifactId(), "*", "*" );
+ }
+
+ private void setArtifactProperties( ArtifactDescriptorResult result, Model model )
+ {
+ String downloadUrl = null;
+ DistributionManagement distMngt = model.getDistributionManagement();
+ if ( distMngt != null )
+ {
+ downloadUrl = distMngt.getDownloadUrl();
+ }
+ if ( downloadUrl != null && downloadUrl.length() > 0 )
+ {
+ Artifact artifact = result.getArtifact();
+ Map<String, String> props = new HashMap<>( artifact.getProperties() );
+ props.put( ArtifactProperties.DOWNLOAD_URL, downloadUrl );
+ result.setArtifact( artifact.setProperties( props ) );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java
new file mode 100644
index 0000000..7d4ede8
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java
@@ -0,0 +1,81 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.model.Repository;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.repository.RepositoryPolicy;
+
+/**
+ * <strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part
+ * of the public API. In particular, this class can be changed or deleted without prior notice.
+ *
+ * @author Benjamin Bentmann
+ */
+public class ArtifactDescriptorUtils
+{
+
+ public static Artifact toPomArtifact( Artifact artifact )
+ {
+ Artifact pomArtifact = artifact;
+
+ if ( pomArtifact.getClassifier().length() > 0 || !"pom".equals( pomArtifact.getExtension() ) )
+ {
+ pomArtifact =
+ new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), "pom", artifact.getVersion() );
+ }
+
+ return pomArtifact;
+ }
+
+ public static RemoteRepository toRemoteRepository( Repository repository )
+ {
+ RemoteRepository.Builder builder =
+ new RemoteRepository.Builder( repository.getId(), repository.getLayout(), repository.getUrl() );
+ builder.setSnapshotPolicy( toRepositoryPolicy( repository.getSnapshots() ) );
+ builder.setReleasePolicy( toRepositoryPolicy( repository.getReleases() ) );
+ return builder.build();
+ }
+
+ public static RepositoryPolicy toRepositoryPolicy( org.apache.maven.model.RepositoryPolicy policy )
+ {
+ boolean enabled = true;
+ String checksums = RepositoryPolicy.CHECKSUM_POLICY_WARN;
+ String updates = RepositoryPolicy.UPDATE_POLICY_DAILY;
+
+ if ( policy != null )
+ {
+ enabled = policy.isEnabled();
+ if ( policy.getUpdatePolicy() != null )
+ {
+ updates = policy.getUpdatePolicy();
+ }
+ if ( policy.getChecksumPolicy() != null )
+ {
+ checksums = policy.getChecksumPolicy();
+ }
+ }
+
+ return new RepositoryPolicy( enabled, updates, checksums );
+ }
+
+}
[3/9] maven git commit: [MNG-6110] renamed 'maven-aether-provider' to
'maven-resolver-provider'
Posted by hb...@apache.org.
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
new file mode 100644
index 0000000..1b11cb3
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
@@ -0,0 +1,145 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.Properties;
+
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.artifact.DefaultArtifactType;
+import org.eclipse.aether.collection.DependencyGraphTransformer;
+import org.eclipse.aether.collection.DependencyManager;
+import org.eclipse.aether.collection.DependencySelector;
+import org.eclipse.aether.collection.DependencyTraverser;
+import org.eclipse.aether.impl.ArtifactDescriptorReader;
+import org.eclipse.aether.impl.DefaultServiceLocator;
+import org.eclipse.aether.impl.MetadataGeneratorFactory;
+import org.eclipse.aether.impl.VersionRangeResolver;
+import org.eclipse.aether.impl.VersionResolver;
+import org.eclipse.aether.util.artifact.DefaultArtifactTypeRegistry;
+import org.eclipse.aether.util.graph.manager.ClassicDependencyManager;
+import org.eclipse.aether.util.graph.selector.AndDependencySelector;
+import org.eclipse.aether.util.graph.selector.ExclusionDependencySelector;
+import org.eclipse.aether.util.graph.selector.OptionalDependencySelector;
+import org.eclipse.aether.util.graph.selector.ScopeDependencySelector;
+import org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
+import org.eclipse.aether.util.graph.transformer.ConflictResolver;
+import org.eclipse.aether.util.graph.transformer.JavaDependencyContextRefiner;
+import org.eclipse.aether.util.graph.transformer.JavaScopeDeriver;
+import org.eclipse.aether.util.graph.transformer.JavaScopeSelector;
+import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
+import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
+import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
+import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
+
+/**
+ * A utility class to assist in setting up a Maven-like repository system. <em>Note:</em> This component is meant to
+ * assist those clients that employ the repository system outside of an IoC container, Maven plugins should instead
+ * always use regular dependency injection to acquire the repository system.
+ *
+ * @author Benjamin Bentmann
+ */
+public final class MavenRepositorySystemUtils
+{
+
+ private MavenRepositorySystemUtils()
+ {
+ // hide constructor
+ }
+
+ /**
+ * Creates a new service locator that already knows about all service implementations included in this library. To
+ * acquire a complete repository system, clients need to add some repository connectors for remote transfers.
+ *
+ * @return The new service locator, never {@code null}.
+ */
+ public static DefaultServiceLocator newServiceLocator()
+ {
+ DefaultServiceLocator locator = new DefaultServiceLocator();
+ locator.addService( ArtifactDescriptorReader.class, DefaultArtifactDescriptorReader.class );
+ locator.addService( VersionResolver.class, DefaultVersionResolver.class );
+ locator.addService( VersionRangeResolver.class, DefaultVersionRangeResolver.class );
+ locator.addService( MetadataGeneratorFactory.class, SnapshotMetadataGeneratorFactory.class );
+ locator.addService( MetadataGeneratorFactory.class, VersionsMetadataGeneratorFactory.class );
+ return locator;
+ }
+
+ /**
+ * Creates a new Maven-like repository system session by initializing the session with values typical for
+ * Maven-based resolution. In more detail, this method configures settings relevant for the processing of dependency
+ * graphs, most other settings remain at their generic default value. Use the various setters to further configure
+ * the session with authentication, mirror, proxy and other information required for your environment.
+ *
+ * @return The new repository system session, never {@code null}.
+ */
+ public static DefaultRepositorySystemSession newSession()
+ {
+ DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
+
+ DependencyTraverser depTraverser = new FatArtifactTraverser();
+ session.setDependencyTraverser( depTraverser );
+
+ DependencyManager depManager = new ClassicDependencyManager();
+ session.setDependencyManager( depManager );
+
+ DependencySelector depFilter =
+ new AndDependencySelector( new ScopeDependencySelector( "test", "provided" ),
+ new OptionalDependencySelector(), new ExclusionDependencySelector() );
+ session.setDependencySelector( depFilter );
+
+ DependencyGraphTransformer transformer =
+ new ConflictResolver( new NearestVersionSelector(), new JavaScopeSelector(),
+ new SimpleOptionalitySelector(), new JavaScopeDeriver() );
+ new ChainedDependencyGraphTransformer( transformer, new JavaDependencyContextRefiner() );
+ session.setDependencyGraphTransformer( transformer );
+
+ DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry();
+ stereotypes.add( new DefaultArtifactType( "pom" ) );
+ stereotypes.add( new DefaultArtifactType( "maven-plugin", "jar", "", "java" ) );
+ stereotypes.add( new DefaultArtifactType( "jar", "jar", "", "java" ) );
+ stereotypes.add( new DefaultArtifactType( "ejb", "jar", "", "java" ) );
+ stereotypes.add( new DefaultArtifactType( "ejb-client", "jar", "client", "java" ) );
+ stereotypes.add( new DefaultArtifactType( "test-jar", "jar", "tests", "java" ) );
+ stereotypes.add( new DefaultArtifactType( "javadoc", "jar", "javadoc", "java" ) );
+ stereotypes.add( new DefaultArtifactType( "java-source", "jar", "sources", "java", false, false ) );
+ stereotypes.add( new DefaultArtifactType( "war", "war", "", "java", false, true ) );
+ stereotypes.add( new DefaultArtifactType( "ear", "ear", "", "java", false, true ) );
+ stereotypes.add( new DefaultArtifactType( "rar", "rar", "", "java", false, true ) );
+ stereotypes.add( new DefaultArtifactType( "par", "par", "", "java", false, true ) );
+ session.setArtifactTypeRegistry( stereotypes );
+
+ session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) );
+
+ final Properties systemProperties = new Properties();
+
+ // MNG-5670 guard against ConcurrentModificationException
+ // MNG-6053 guard against key without value
+ Properties sysProp = System.getProperties();
+ synchronized ( sysProp )
+ {
+ systemProperties.putAll( sysProp );
+ }
+
+ session.setSystemProperties( systemProperties );
+ session.setConfigProperties( systemProperties );
+
+ return session;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenResolverModule.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenResolverModule.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenResolverModule.java
new file mode 100644
index 0000000..070b91c
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenResolverModule.java
@@ -0,0 +1,70 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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 com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.name.Names;
+import org.apache.maven.model.building.DefaultModelBuilderFactory;
+import org.apache.maven.model.building.ModelBuilder;
+import org.eclipse.aether.impl.ArtifactDescriptorReader;
+import org.eclipse.aether.impl.MetadataGeneratorFactory;
+import org.eclipse.aether.impl.VersionRangeResolver;
+import org.eclipse.aether.impl.VersionResolver;
+import org.eclipse.aether.impl.guice.AetherModule;
+
+public final class MavenResolverModule
+ extends AbstractModule
+{
+
+ @Override
+ protected void configure()
+ {
+ install( new AetherModule() );
+ bind( ArtifactDescriptorReader.class ).to( DefaultArtifactDescriptorReader.class ).in( Singleton.class );
+ bind( VersionResolver.class ).to( DefaultVersionResolver.class ).in( Singleton.class );
+ bind( VersionRangeResolver.class ).to( DefaultVersionRangeResolver.class ).in( Singleton.class );
+ bind( MetadataGeneratorFactory.class ).annotatedWith( Names.named( "snapshot" ) )
+ .to( SnapshotMetadataGeneratorFactory.class ).in( Singleton.class );
+
+ bind( MetadataGeneratorFactory.class ).annotatedWith( Names.named( "versions" ) )
+ .to( VersionsMetadataGeneratorFactory.class ).in( Singleton.class );
+
+ bind( ModelBuilder.class ).toInstance( new DefaultModelBuilderFactory().newInstance() );
+ }
+
+ @Provides
+ @Singleton
+ Set<MetadataGeneratorFactory> provideMetadataGeneratorFactories(
+ @Named( "snapshot" ) MetadataGeneratorFactory snapshot,
+ @Named( "versions" ) MetadataGeneratorFactory versions )
+ {
+ Set<MetadataGeneratorFactory> factories = new HashSet<>( 2 );
+ factories.add( snapshot );
+ factories.add( versions );
+ return Collections.unmodifiableSet( factories );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenSnapshotMetadata.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenSnapshotMetadata.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenSnapshotMetadata.java
new file mode 100644
index 0000000..e4c9a7e
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenSnapshotMetadata.java
@@ -0,0 +1,100 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+
+import org.apache.maven.artifact.repository.metadata.Metadata;
+import org.eclipse.aether.artifact.Artifact;
+
+/**
+ * @author Herv� Boutemy
+ */
+abstract class MavenSnapshotMetadata
+ extends MavenMetadata
+{
+ static final String SNAPSHOT = "SNAPSHOT";
+
+ protected final Collection<Artifact> artifacts = new ArrayList<>();
+
+ protected final boolean legacyFormat;
+
+ protected MavenSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
+ {
+ super( metadata, file );
+ this.legacyFormat = legacyFormat;
+ }
+
+ protected static Metadata createRepositoryMetadata( Artifact artifact, boolean legacyFormat )
+ {
+ Metadata metadata = new Metadata();
+ if ( !legacyFormat )
+ {
+ metadata.setModelVersion( "1.1.0" );
+ }
+ metadata.setGroupId( artifact.getGroupId() );
+ metadata.setArtifactId( artifact.getArtifactId() );
+ metadata.setVersion( artifact.getBaseVersion() );
+
+ return metadata;
+ }
+
+ public void bind( Artifact artifact )
+ {
+ artifacts.add( artifact );
+ }
+
+ public Object getKey()
+ {
+ return getGroupId() + ':' + getArtifactId() + ':' + getVersion();
+ }
+
+ public static Object getKey( Artifact artifact )
+ {
+ return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion();
+ }
+
+ protected String getKey( String classifier, String extension )
+ {
+ return classifier + ':' + extension;
+ }
+
+ public String getGroupId()
+ {
+ return metadata.getGroupId();
+ }
+
+ public String getArtifactId()
+ {
+ return metadata.getArtifactId();
+ }
+
+ public String getVersion()
+ {
+ return metadata.getVersion();
+ }
+
+ public Nature getNature()
+ {
+ return Nature.SNAPSHOT;
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenWorkspaceReader.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenWorkspaceReader.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenWorkspaceReader.java
new file mode 100644
index 0000000..270cf58
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenWorkspaceReader.java
@@ -0,0 +1,32 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.model.Model;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.repository.WorkspaceReader;
+
+public interface MavenWorkspaceReader
+ extends WorkspaceReader
+{
+
+ Model findModel( Artifact artifact );
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java
new file mode 100644
index 0000000..c6ef3aa
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java
@@ -0,0 +1,114 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.Map;
+
+import org.apache.commons.lang3.Validate;
+import org.eclipse.aether.artifact.AbstractArtifact;
+import org.eclipse.aether.artifact.Artifact;
+
+/**
+ * @author Benjamin Bentmann
+ */
+final class RelocatedArtifact
+ extends AbstractArtifact
+{
+
+ private final Artifact artifact;
+
+ private final String groupId;
+
+ private final String artifactId;
+
+ private final String version;
+
+ public RelocatedArtifact( Artifact artifact, String groupId, String artifactId, String version )
+ {
+ this.artifact = Validate.notNull( artifact, "artifact cannot be null" );
+ // TODO Use StringUtils here
+ this.groupId = ( groupId != null && groupId.length() > 0 ) ? groupId : null;
+ this.artifactId = ( artifactId != null && artifactId.length() > 0 ) ? artifactId : null;
+ this.version = ( version != null && version.length() > 0 ) ? version : null;
+ }
+
+ public String getGroupId()
+ {
+ if ( groupId != null )
+ {
+ return groupId;
+ }
+ else
+ {
+ return artifact.getGroupId();
+ }
+ }
+
+ public String getArtifactId()
+ {
+ if ( artifactId != null )
+ {
+ return artifactId;
+ }
+ else
+ {
+ return artifact.getArtifactId();
+ }
+ }
+
+ public String getVersion()
+ {
+ if ( version != null )
+ {
+ return version;
+ }
+ else
+ {
+ return artifact.getVersion();
+ }
+ }
+
+ public String getClassifier()
+ {
+ return artifact.getClassifier();
+ }
+
+ public String getExtension()
+ {
+ return artifact.getExtension();
+ }
+
+ public File getFile()
+ {
+ return artifact.getFile();
+ }
+
+ public String getProperty( String key, String defaultValue )
+ {
+ return artifact.getProperty( key, defaultValue );
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return artifact.getProperties();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java
new file mode 100644
index 0000000..1e791d8
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java
@@ -0,0 +1,157 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.apache.maven.artifact.repository.metadata.Metadata;
+import org.apache.maven.artifact.repository.metadata.Snapshot;
+import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
+import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.eclipse.aether.artifact.Artifact;
+
+/**
+ * @author Benjamin Bentmann
+ */
+final class RemoteSnapshotMetadata
+ extends MavenSnapshotMetadata
+{
+ public static final String DEFAULT_SNAPSHOT_TIMESTAMP_FORMAT = "yyyyMMdd.HHmmss";
+
+ public static final TimeZone DEFAULT_SNAPSHOT_TIME_ZONE = TimeZone.getTimeZone( "Etc/UTC" );
+
+ private final Map<String, SnapshotVersion> versions = new LinkedHashMap<>();
+
+ public RemoteSnapshotMetadata( Artifact artifact, boolean legacyFormat )
+ {
+ super( createRepositoryMetadata( artifact, legacyFormat ), null, legacyFormat );
+ }
+
+ private RemoteSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
+ {
+ super( metadata, file, legacyFormat );
+ }
+
+ public MavenMetadata setFile( File file )
+ {
+ return new RemoteSnapshotMetadata( metadata, file, legacyFormat );
+ }
+
+ public String getExpandedVersion( Artifact artifact )
+ {
+ String key = getKey( artifact.getClassifier(), artifact.getExtension() );
+ return versions.get( key ).getVersion();
+ }
+
+ @Override
+ protected void merge( Metadata recessive )
+ {
+ Snapshot snapshot;
+ String lastUpdated;
+
+ if ( metadata.getVersioning() == null )
+ {
+ DateFormat utcDateFormatter = new SimpleDateFormat( DEFAULT_SNAPSHOT_TIMESTAMP_FORMAT );
+ utcDateFormatter.setCalendar( new GregorianCalendar() );
+ utcDateFormatter.setTimeZone( DEFAULT_SNAPSHOT_TIME_ZONE );
+
+ snapshot = new Snapshot();
+ snapshot.setBuildNumber( getBuildNumber( recessive ) + 1 );
+ snapshot.setTimestamp( utcDateFormatter.format( new Date() ) );
+
+ Versioning versioning = new Versioning();
+ versioning.setSnapshot( snapshot );
+ versioning.setLastUpdated( snapshot.getTimestamp().replace( ".", "" ) );
+ lastUpdated = versioning.getLastUpdated();
+
+ metadata.setVersioning( versioning );
+ }
+ else
+ {
+ snapshot = metadata.getVersioning().getSnapshot();
+ lastUpdated = metadata.getVersioning().getLastUpdated();
+ }
+
+ for ( Artifact artifact : artifacts )
+ {
+ String version = artifact.getVersion();
+
+ if ( version.endsWith( SNAPSHOT ) )
+ {
+ String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber();
+ version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
+ }
+
+ SnapshotVersion sv = new SnapshotVersion();
+ sv.setClassifier( artifact.getClassifier() );
+ sv.setExtension( artifact.getExtension() );
+ sv.setVersion( version );
+ sv.setUpdated( lastUpdated );
+
+ versions.put( getKey( sv.getClassifier(), sv.getExtension() ), sv );
+ }
+
+ artifacts.clear();
+
+ Versioning versioning = recessive.getVersioning();
+ if ( versioning != null )
+ {
+ for ( SnapshotVersion sv : versioning.getSnapshotVersions() )
+ {
+ String key = getKey( sv.getClassifier(), sv.getExtension() );
+ if ( !versions.containsKey( key ) )
+ {
+ versions.put( key, sv );
+ }
+ }
+ }
+
+ if ( !legacyFormat )
+ {
+ metadata.getVersioning().setSnapshotVersions( new ArrayList<>( versions.values() ) );
+ }
+ }
+
+ private static int getBuildNumber( Metadata metadata )
+ {
+ int number = 0;
+
+ Versioning versioning = metadata.getVersioning();
+ if ( versioning != null )
+ {
+ Snapshot snapshot = versioning.getSnapshot();
+ if ( snapshot != null && snapshot.getBuildNumber() > 0 )
+ {
+ number = snapshot.getBuildNumber();
+ }
+ }
+
+ return number;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java
new file mode 100644
index 0000000..8258966
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java
@@ -0,0 +1,107 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.deployment.DeployRequest;
+import org.eclipse.aether.impl.MetadataGenerator;
+import org.eclipse.aether.metadata.Metadata;
+import org.eclipse.aether.util.ConfigUtils;
+
+/**
+ * @author Benjamin Bentmann
+ */
+class RemoteSnapshotMetadataGenerator
+ implements MetadataGenerator
+{
+
+ private final Map<Object, RemoteSnapshotMetadata> snapshots;
+
+ private final boolean legacyFormat;
+
+ public RemoteSnapshotMetadataGenerator( RepositorySystemSession session, DeployRequest request )
+ {
+ legacyFormat = ConfigUtils.getBoolean( session.getConfigProperties(), false, "maven.metadata.legacy" );
+
+ snapshots = new LinkedHashMap<>();
+
+ /*
+ * NOTE: This should be considered a quirk to support interop with Maven's legacy ArtifactDeployer which
+ * processes one artifact at a time and hence cannot associate the artifacts from the same project to use the
+ * same timestamp+buildno for the snapshot versions. Allowing the caller to pass in metadata from a previous
+ * deployment allows to re-establish the association between the artifacts of the same project.
+ */
+ for ( Metadata metadata : request.getMetadata() )
+ {
+ if ( metadata instanceof RemoteSnapshotMetadata )
+ {
+ RemoteSnapshotMetadata snapshotMetadata = (RemoteSnapshotMetadata) metadata;
+ snapshots.put( snapshotMetadata.getKey(), snapshotMetadata );
+ }
+ }
+ }
+
+ public Collection<? extends Metadata> prepare( Collection<? extends Artifact> artifacts )
+ {
+ for ( Artifact artifact : artifacts )
+ {
+ if ( artifact.isSnapshot() )
+ {
+ Object key = RemoteSnapshotMetadata.getKey( artifact );
+ RemoteSnapshotMetadata snapshotMetadata = snapshots.get( key );
+ if ( snapshotMetadata == null )
+ {
+ snapshotMetadata = new RemoteSnapshotMetadata( artifact, legacyFormat );
+ snapshots.put( key, snapshotMetadata );
+ }
+ snapshotMetadata.bind( artifact );
+ }
+ }
+
+ return snapshots.values();
+ }
+
+ public Artifact transformArtifact( Artifact artifact )
+ {
+ if ( artifact.isSnapshot() && artifact.getVersion().equals( artifact.getBaseVersion() ) )
+ {
+ Object key = RemoteSnapshotMetadata.getKey( artifact );
+ RemoteSnapshotMetadata snapshotMetadata = snapshots.get( key );
+ if ( snapshotMetadata != null )
+ {
+ artifact = artifact.setVersion( snapshotMetadata.getExpandedVersion( artifact ) );
+ }
+ }
+
+ return artifact;
+ }
+
+ public Collection<? extends Metadata> finish( Collection<? extends Artifact> artifacts )
+ {
+ return Collections.emptyList();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/SnapshotMetadataGeneratorFactory.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/SnapshotMetadataGeneratorFactory.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/SnapshotMetadataGeneratorFactory.java
new file mode 100644
index 0000000..79ffaad
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/SnapshotMetadataGeneratorFactory.java
@@ -0,0 +1,52 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.component.annotations.Component;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.deployment.DeployRequest;
+import org.eclipse.aether.impl.MetadataGenerator;
+import org.eclipse.aether.impl.MetadataGeneratorFactory;
+import org.eclipse.aether.installation.InstallRequest;
+
+/**
+ * @author Benjamin Bentmann
+ */
+@Component( role = MetadataGeneratorFactory.class, hint = "snapshot" )
+public class SnapshotMetadataGeneratorFactory
+ implements MetadataGeneratorFactory
+{
+
+ public MetadataGenerator newInstance( RepositorySystemSession session, InstallRequest request )
+ {
+ return new LocalSnapshotMetadataGenerator( session, request );
+ }
+
+ public MetadataGenerator newInstance( RepositorySystemSession session, DeployRequest request )
+ {
+ return new RemoteSnapshotMetadataGenerator( session, request );
+ }
+
+ public float getPriority()
+ {
+ return 10;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java
new file mode 100644
index 0000000..f5e13be
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java
@@ -0,0 +1,133 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+
+import org.apache.maven.artifact.repository.metadata.Metadata;
+import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.ArtifactProperties;
+
+/**
+ * @author Benjamin Bentmann
+ */
+final class VersionsMetadata
+ extends MavenMetadata
+{
+
+ private final Artifact artifact;
+
+ public VersionsMetadata( Artifact artifact )
+ {
+ super( createRepositoryMetadata( artifact ), null );
+ this.artifact = artifact;
+ }
+
+ public VersionsMetadata( Artifact artifact, File file )
+ {
+ super( createRepositoryMetadata( artifact ), file );
+ this.artifact = artifact;
+ }
+
+ private static Metadata createRepositoryMetadata( Artifact artifact )
+ {
+ Metadata metadata = new Metadata();
+ metadata.setGroupId( artifact.getGroupId() );
+ metadata.setArtifactId( artifact.getArtifactId() );
+
+ Versioning versioning = new Versioning();
+ versioning.addVersion( artifact.getBaseVersion() );
+ if ( !artifact.isSnapshot() )
+ {
+ versioning.setRelease( artifact.getBaseVersion() );
+ }
+ if ( "maven-plugin".equals( artifact.getProperty( ArtifactProperties.TYPE, "" ) ) )
+ {
+ versioning.setLatest( artifact.getBaseVersion() );
+ }
+
+ metadata.setVersioning( versioning );
+
+ return metadata;
+ }
+
+ @Override
+ protected void merge( Metadata recessive )
+ {
+ Versioning versioning = metadata.getVersioning();
+ versioning.updateTimestamp();
+
+ if ( recessive.getVersioning() != null )
+ {
+ if ( versioning.getLatest() == null )
+ {
+ versioning.setLatest( recessive.getVersioning().getLatest() );
+ }
+ if ( versioning.getRelease() == null )
+ {
+ versioning.setRelease( recessive.getVersioning().getRelease() );
+ }
+
+ Collection<String> versions = new LinkedHashSet<>( recessive.getVersioning().getVersions() );
+ versions.addAll( versioning.getVersions() );
+ versioning.setVersions( new ArrayList<>( versions ) );
+ }
+ }
+
+ public Object getKey()
+ {
+ return getGroupId() + ':' + getArtifactId();
+ }
+
+ public static Object getKey( Artifact artifact )
+ {
+ return artifact.getGroupId() + ':' + artifact.getArtifactId();
+ }
+
+ public MavenMetadata setFile( File file )
+ {
+ return new VersionsMetadata( artifact, file );
+ }
+
+ public String getGroupId()
+ {
+ return artifact.getGroupId();
+ }
+
+ public String getArtifactId()
+ {
+ return artifact.getArtifactId();
+ }
+
+ public String getVersion()
+ {
+ return "";
+ }
+
+ public Nature getNature()
+ {
+ return artifact.isSnapshot() ? Nature.RELEASE_OR_SNAPSHOT : Nature.RELEASE;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGenerator.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGenerator.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGenerator.java
new file mode 100644
index 0000000..5173001
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGenerator.java
@@ -0,0 +1,108 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.deployment.DeployRequest;
+import org.eclipse.aether.impl.MetadataGenerator;
+import org.eclipse.aether.installation.InstallRequest;
+import org.eclipse.aether.metadata.Metadata;
+
+/**
+ * @author Benjamin Bentmann
+ */
+class VersionsMetadataGenerator
+ implements MetadataGenerator
+{
+
+ private Map<Object, VersionsMetadata> versions;
+
+ private Map<Object, VersionsMetadata> processedVersions;
+
+ public VersionsMetadataGenerator( RepositorySystemSession session, InstallRequest request )
+ {
+ this( session, request.getMetadata() );
+ }
+
+ public VersionsMetadataGenerator( RepositorySystemSession session, DeployRequest request )
+ {
+ this( session, request.getMetadata() );
+ }
+
+ private VersionsMetadataGenerator( RepositorySystemSession session, Collection<? extends Metadata> metadatas )
+ {
+ versions = new LinkedHashMap<>();
+ processedVersions = new LinkedHashMap<>();
+
+ /*
+ * NOTE: This should be considered a quirk to support interop with Maven's legacy ArtifactDeployer which
+ * processes one artifact at a time and hence cannot associate the artifacts from the same project to use the
+ * same version index. Allowing the caller to pass in metadata from a previous deployment allows to re-establish
+ * the association between the artifacts of the same project.
+ */
+ for ( Iterator<? extends Metadata> it = metadatas.iterator(); it.hasNext(); )
+ {
+ Metadata metadata = it.next();
+ if ( metadata instanceof VersionsMetadata )
+ {
+ it.remove();
+ VersionsMetadata versionsMetadata = (VersionsMetadata) metadata;
+ processedVersions.put( versionsMetadata.getKey(), versionsMetadata );
+ }
+ }
+ }
+
+ public Collection<? extends Metadata> prepare( Collection<? extends Artifact> artifacts )
+ {
+ return Collections.emptyList();
+ }
+
+ public Artifact transformArtifact( Artifact artifact )
+ {
+ return artifact;
+ }
+
+ public Collection<? extends Metadata> finish( Collection<? extends Artifact> artifacts )
+ {
+ for ( Artifact artifact : artifacts )
+ {
+ Object key = VersionsMetadata.getKey( artifact );
+ if ( processedVersions.get( key ) == null )
+ {
+ VersionsMetadata versionsMetadata = versions.get( key );
+ if ( versionsMetadata == null )
+ {
+ versionsMetadata = new VersionsMetadata( artifact );
+ versions.put( key, versionsMetadata );
+ }
+ }
+ }
+
+ return versions.values();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGeneratorFactory.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGeneratorFactory.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGeneratorFactory.java
new file mode 100644
index 0000000..47ef360
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGeneratorFactory.java
@@ -0,0 +1,52 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.component.annotations.Component;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.deployment.DeployRequest;
+import org.eclipse.aether.impl.MetadataGenerator;
+import org.eclipse.aether.impl.MetadataGeneratorFactory;
+import org.eclipse.aether.installation.InstallRequest;
+
+/**
+ * @author Benjamin Bentmann
+ */
+@Component( role = MetadataGeneratorFactory.class, hint = "versions" )
+public class VersionsMetadataGeneratorFactory
+ implements MetadataGeneratorFactory
+{
+
+ public MetadataGenerator newInstance( RepositorySystemSession session, InstallRequest request )
+ {
+ return new VersionsMetadataGenerator( session, request );
+ }
+
+ public MetadataGenerator newInstance( RepositorySystemSession session, DeployRequest request )
+ {
+ return new VersionsMetadataGenerator( session, request );
+ }
+
+ public float getPriority()
+ {
+ return 5;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/package-info.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/package-info.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/package-info.java
new file mode 100644
index 0000000..7309c2b
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/package-info.java
@@ -0,0 +1,25 @@
+// CHECKSTYLE_OFF: RegexpHeader
+/**
+ * <a href="https://maven.apache.org/resolver/">Maven Resolver</a> extensions for utilizing the Maven POM and Maven
+ * repository metadata.
+ */
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.
+ */
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/site/apt/index.apt b/maven-resolver-provider/src/site/apt/index.apt
new file mode 100644
index 0000000..b50ea1d
--- /dev/null
+++ b/maven-resolver-provider/src/site/apt/index.apt
@@ -0,0 +1,33 @@
+~~ 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.
+
+ -----
+ Introduction
+ -----
+ Herv� Boutemy
+ -----
+ 2012-09-29
+ -----
+
+Maven Artifact Resolver Provider
+
+ Maven Artifact Resolver Provider is a {{{/resolver/}Maven Artifact Resolver}} extension to support
+ Maven POMs and local+remote repositories.
+
+ Main component is <<<MavenRepositorySystemUtils>>>
+ ({{{./apidocs/org/apache/maven/repository/internal/MavenRepositorySystemUtils.html}javadoc}},
+ {{{./xref/org/apache/maven/repository/internal/MavenRepositorySystemUtils.html}source}}).
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/site/site.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/site/site.xml b/maven-resolver-provider/src/site/site.xml
new file mode 100644
index 0000000..3a16bf9
--- /dev/null
+++ b/maven-resolver-provider/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/blob/8972072e/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/AbstractRepositoryTestCase.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/AbstractRepositoryTestCase.java b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/AbstractRepositoryTestCase.java
new file mode 100644
index 0000000..b81450c
--- /dev/null
+++ b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/AbstractRepositoryTestCase.java
@@ -0,0 +1,87 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.net.MalformedURLException;
+
+import org.apache.maven.repository.internal.util.ConsoleRepositoryListener;
+import org.apache.maven.repository.internal.util.ConsoleTransferListener;
+import org.codehaus.plexus.ContainerConfiguration;
+import org.codehaus.plexus.PlexusConstants;
+import org.codehaus.plexus.PlexusTestCase;
+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;
+
+public abstract class AbstractRepositoryTestCase
+ extends PlexusTestCase
+{
+ protected RepositorySystem system;
+
+ protected RepositorySystemSession session;
+
+ @Override
+ protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
+ {
+ super.customizeContainerConfiguration( containerConfiguration );
+ containerConfiguration.setAutoWiring( true );
+ containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
+ }
+
+ @Override
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+ system = lookup( RepositorySystem.class );
+ session = newMavenRepositorySystemSession( system );
+ }
+
+ @Override
+ protected void tearDown()
+ throws Exception
+ {
+ session = null;
+ system = null;
+ super.tearDown();
+ }
+
+ public static RepositorySystemSession newMavenRepositorySystemSession( 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() );
+
+ return session;
+ }
+
+ public static RemoteRepository newTestRepository()
+ throws MalformedURLException
+ {
+ return new RemoteRepository.Builder( "repo", "default",
+ getTestFile( "target/test-classes/repo" ).toURI().toURL().toString() ).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReaderTest.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReaderTest.java b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReaderTest.java
new file mode 100644
index 0000000..e873138
--- /dev/null
+++ b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReaderTest.java
@@ -0,0 +1,77 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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 static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import org.eclipse.aether.RepositoryEvent;
+import org.eclipse.aether.RepositoryEvent.EventType;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.impl.ArtifactDescriptorReader;
+import org.eclipse.aether.impl.RepositoryEventDispatcher;
+import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
+import org.mockito.ArgumentCaptor;
+
+public class DefaultArtifactDescriptorReaderTest
+ extends AbstractRepositoryTestCase
+{
+
+ public void testMng5459()
+ throws Exception
+ {
+ // prepare
+ DefaultArtifactDescriptorReader reader = (DefaultArtifactDescriptorReader) lookup( ArtifactDescriptorReader.class );
+
+ RepositoryEventDispatcher eventDispatcher = mock( RepositoryEventDispatcher.class );
+
+ ArgumentCaptor<RepositoryEvent> event = ArgumentCaptor.forClass( RepositoryEvent.class );
+
+ reader.setRepositoryEventDispatcher( eventDispatcher );
+
+ ArtifactDescriptorRequest request = new ArtifactDescriptorRequest();
+
+ request.addRepository( newTestRepository() );
+
+ request.setArtifact( new DefaultArtifact( "org.apache.maven.its", "dep-mng5459", "jar", "0.4.0-SNAPSHOT" ) );
+
+ // execute
+ reader.readArtifactDescriptor( session, request );
+
+ // verify
+ verify( eventDispatcher ).dispatch( event.capture() );
+
+ boolean missingArtifactDescriptor = false;
+
+ for( RepositoryEvent evt : event.getAllValues() )
+ {
+ if ( EventType.ARTIFACT_DESCRIPTOR_MISSING.equals( evt.getType() ) )
+ {
+ assertEquals( "Could not find artifact org.apache.maven.its:dep-mng5459:pom:0.4.0-20130404.090532-2 in repo (" + newTestRepository().getUrl() + ")", evt.getException().getMessage() );
+ missingArtifactDescriptor = true;
+ }
+ }
+
+ if( !missingArtifactDescriptor )
+ {
+ fail( "Expected missing artifact descriptor for org.apache.maven.its:dep-mng5459:pom:0.4.0-20130404.090532-2" );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/DefaultVersionResolverTest.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/DefaultVersionResolverTest.java b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/DefaultVersionResolverTest.java
new file mode 100644
index 0000000..90dd6a4
--- /dev/null
+++ b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/DefaultVersionResolverTest.java
@@ -0,0 +1,96 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.artifact.Artifact;
+import org.eclipse.aether.impl.VersionResolver;
+import org.eclipse.aether.resolution.VersionRequest;
+import org.eclipse.aether.resolution.VersionResult;
+import org.eclipse.aether.artifact.DefaultArtifact;
+
+public class DefaultVersionResolverTest
+ extends AbstractRepositoryTestCase
+{
+ private DefaultVersionResolver versionResolver;
+
+ @Override
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+ // be sure we're testing the right class, i.e. DefaultVersionResolver.class
+ versionResolver = (DefaultVersionResolver) lookup( VersionResolver.class, "default" );
+ }
+
+ @Override
+ protected void tearDown()
+ throws Exception
+ {
+ versionResolver = null;
+ super.tearDown();
+ }
+
+ public void testResolveSeparateInstalledClassifiedNonUniqueVersionedArtifacts()
+ throws Exception
+ {
+ VersionRequest requestB = new VersionRequest();
+ requestB.addRepository( newTestRepository() );
+ Artifact artifactB =
+ new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", "07.20.3-SNAPSHOT" );
+ requestB.setArtifact( artifactB );
+
+ VersionResult resultB = versionResolver.resolveVersion( session, requestB );
+ assertEquals( "07.20.3-20120809.112920-97", resultB.getVersion() );
+
+ VersionRequest requestA = new VersionRequest();
+ requestA.addRepository( newTestRepository() );
+
+ Artifact artifactA =
+ new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", "07.20.3-SNAPSHOT" );
+ requestA.setArtifact( artifactA );
+
+ VersionResult resultA = versionResolver.resolveVersion( session, requestA );
+ assertEquals( "07.20.3-20120809.112124-88", resultA.getVersion() );
+ }
+
+ public void testResolveSeparateInstalledClassifiedNonVersionedArtifacts()
+ throws Exception
+ {
+ VersionRequest requestA = new VersionRequest();
+ requestA.addRepository( newTestRepository() );
+ String versionA = "07.20.3-20120809.112124-88";
+ Artifact artifactA =
+ new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", versionA );
+ requestA.setArtifact( artifactA );
+
+ VersionResult resultA = versionResolver.resolveVersion( session, requestA );
+ assertEquals( versionA, resultA.getVersion() );
+
+ VersionRequest requestB = new VersionRequest();
+ requestB.addRepository( newTestRepository() );
+ String versionB = "07.20.3-20120809.112920-97";
+ Artifact artifactB =
+ new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", versionB );
+ requestB.setArtifact( artifactB );
+
+ VersionResult resultB = versionResolver.resolveVersion( session, requestB );
+ assertEquals( versionB, resultB.getVersion() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/MavenRepositorySystemUtilsTest.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/MavenRepositorySystemUtilsTest.java b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/MavenRepositorySystemUtilsTest.java
new file mode 100644
index 0000000..768835a
--- /dev/null
+++ b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/MavenRepositorySystemUtilsTest.java
@@ -0,0 +1,45 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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 org.eclipse.aether.impl.MetadataGeneratorFactory;
+import org.eclipse.aether.spi.locator.ServiceLocator;
+
+import junit.framework.TestCase;
+
+public class MavenRepositorySystemUtilsTest
+ extends TestCase
+{
+
+ public void testGetRepositorySystem()
+ {
+ ServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
+ RepositorySystem repoSys = locator.getService( RepositorySystem.class );
+ assertNotNull( repoSys );
+ }
+
+ public void testGetMetadataGeneratorFactories()
+ {
+ ServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
+ assertEquals( 2, locator.getServices( MetadataGeneratorFactory.class ).size() );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java
new file mode 100644
index 0000000..278231f
--- /dev/null
+++ b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataTest.java
@@ -0,0 +1,82 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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 static org.junit.Assert.assertTrue;
+
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.apache.maven.artifact.repository.metadata.Metadata;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class RemoteSnapshotMetadataTest
+{
+ private Locale defaultLocale;
+
+ @Before
+ public void setLocaleToUseBuddhistCalendar()
+ {
+ defaultLocale = Locale.getDefault();
+ Locale.setDefault( new Locale( "th", "TH" ) );
+ }
+
+ @After
+ public void restoreLocale()
+ {
+ Locale.setDefault( defaultLocale );
+ }
+
+ static String gregorianDate()
+ {
+ SimpleDateFormat df = new SimpleDateFormat( "yyyyMMdd" );
+ df.setCalendar( new GregorianCalendar() );
+ df.setTimeZone( RemoteSnapshotMetadata.DEFAULT_SNAPSHOT_TIME_ZONE );
+ return df.format( new Date() );
+ }
+
+ @Test
+ public void gregorianCalendarIsUsed()
+ {
+ String dateBefore = gregorianDate();
+
+ RemoteSnapshotMetadata metadata = new RemoteSnapshotMetadata(
+ new DefaultArtifact( "a:b:1-SNAPSHOT" ), false);
+ metadata.merge( new Metadata() );
+
+ String dateAfter = gregorianDate();
+
+ String ts = metadata.metadata.getVersioning().getSnapshot().getTimestamp();
+ String datePart = ts.replaceAll( "\\..*", "" );
+
+ /* Allow for this test running across midnight */
+ Set<String> expected = new HashSet<String>( Arrays.asList( dateBefore, dateAfter ) );
+ assertTrue( "Expected " + datePart + " to be in " + expected,
+ expected.contains( datePart ) );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/RepositorySystemTest.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/RepositorySystemTest.java b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/RepositorySystemTest.java
new file mode 100644
index 0000000..db77a44
--- /dev/null
+++ b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/RepositorySystemTest.java
@@ -0,0 +1,220 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.Arrays;
+import java.util.List;
+
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.collection.CollectRequest;
+import org.eclipse.aether.collection.CollectResult;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
+import org.eclipse.aether.resolution.ArtifactDescriptorResult;
+import org.eclipse.aether.resolution.ArtifactRequest;
+import org.eclipse.aether.resolution.ArtifactResult;
+import org.eclipse.aether.artifact.DefaultArtifact;
+
+public class RepositorySystemTest
+ extends AbstractRepositoryTestCase
+{
+ public void testResolveVersionRange()
+ throws Exception
+ {
+ //VersionRangeResult resolveVersionRange( RepositorySystemSession session, VersionRangeRequest request )
+ // throws VersionRangeResolutionException;
+
+ }
+
+ public void testResolveVersion()
+ throws Exception
+ {
+ //VersionResult resolveVersion( RepositorySystemSession session, VersionRequest request )
+ // throws VersionResolutionException;
+ }
+
+ public void testReadArtifactDescriptor()
+ throws Exception
+ {
+ Artifact artifact = new DefaultArtifact( "ut.simple:artifact:extension:classifier:1.0" );
+
+ ArtifactDescriptorRequest request = new ArtifactDescriptorRequest();
+ request.setArtifact( artifact );
+ request.addRepository( newTestRepository() );
+
+ ArtifactDescriptorResult result = system.readArtifactDescriptor( session, request );
+
+ List<Dependency> deps = result.getDependencies();
+ assertEquals( 2, deps.size() );
+ checkUtSimpleArtifactDependencies( deps.get( 0 ), deps.get( 1 ) );
+ }
+
+ /**
+ * check ut.simple:artifact:1.0 dependencies
+ */
+ private void checkUtSimpleArtifactDependencies( Dependency dep1, Dependency dep2 )
+ {
+ assertEquals( "compile", dep1.getScope() );
+ assertFalse( dep1.isOptional() );
+ assertEquals( 0, dep1.getExclusions().size() );
+ Artifact depArtifact = dep1.getArtifact();
+ assertEquals( "ut.simple", depArtifact.getGroupId() );
+ assertEquals( "dependency", depArtifact.getArtifactId() );
+ assertEquals( "1.0", depArtifact.getVersion() );
+ assertEquals( "1.0", depArtifact.getBaseVersion() );
+ assertNull( depArtifact.getFile() );
+ assertFalse( depArtifact.isSnapshot() );
+ assertEquals( "", depArtifact.getClassifier() );
+ assertEquals( "jar", depArtifact.getExtension() );
+ assertEquals( "java", depArtifact.getProperty( "language", null ) );
+ assertEquals( "jar", depArtifact.getProperty( "type", null ) );
+ assertEquals( "true", depArtifact.getProperty( "constitutesBuildPath", null ) );
+ assertEquals( "false", depArtifact.getProperty( "includesDependencies", null ) );
+ assertEquals( 4, depArtifact.getProperties().size() );
+
+ assertEquals( "compile", dep2.getScope() );
+ assertFalse( dep2.isOptional() );
+ assertEquals( 0, dep2.getExclusions().size() );
+ depArtifact = dep2.getArtifact();
+ assertEquals( "ut.simple", depArtifact.getGroupId() );
+ assertEquals( "dependency", depArtifact.getArtifactId() );
+ assertEquals( "1.0", depArtifact.getVersion() );
+ assertEquals( "1.0", depArtifact.getBaseVersion() );
+ assertNull( depArtifact.getFile() );
+ assertFalse( depArtifact.isSnapshot() );
+ assertEquals( "sources", depArtifact.getClassifier() );
+ assertEquals( "jar", depArtifact.getExtension() );
+ assertEquals( "java", depArtifact.getProperty( "language", null ) );
+ assertEquals( "jar", depArtifact.getProperty( "type", null ) ); // shouldn't it be java-sources given the classifier?
+ assertEquals( "true", depArtifact.getProperty( "constitutesBuildPath", null ) ); // shouldn't it be false given the classifier?
+ assertEquals( "false", depArtifact.getProperty( "includesDependencies", null ) );
+ assertEquals( 4, depArtifact.getProperties().size() );
+ }
+
+ public void testCollectDependencies()
+ throws Exception
+ {
+ Artifact artifact = new DefaultArtifact( "ut.simple:artifact:extension:classifier:1.0" );
+ // notice: extension and classifier not really used in this test...
+
+ CollectRequest collectRequest = new CollectRequest();
+ collectRequest.setRoot( new Dependency( artifact, null ) );
+ collectRequest.addRepository( newTestRepository() );
+
+ CollectResult collectResult = system.collectDependencies( session, collectRequest );
+
+ List<DependencyNode> nodes = collectResult.getRoot().getChildren();
+ assertEquals( 2, nodes.size() );
+ checkUtSimpleArtifactDependencies( nodes.get( 0 ).getDependency(), nodes.get( 1 ).getDependency() );
+ }
+
+ public void testResolveArtifact()
+ throws Exception
+ {
+ Artifact artifact = new DefaultArtifact( "ut.simple:artifact:1.0" );
+
+ ArtifactRequest artifactRequest = new ArtifactRequest();
+ artifactRequest.setArtifact( artifact );
+ artifactRequest.addRepository( newTestRepository() );
+
+ ArtifactResult artifactResult = system.resolveArtifact( session, artifactRequest );
+ checkArtifactResult( artifactResult, "artifact-1.0.jar" );
+
+ artifact = new DefaultArtifact( "ut.simple:artifact:zip:1.0" );
+ artifactRequest.setArtifact( artifact );
+ artifactResult = system.resolveArtifact( session, artifactRequest );
+ checkArtifactResult( artifactResult, "artifact-1.0.zip" );
+
+ artifact = new DefaultArtifact( "ut.simple:artifact:zip:classifier:1.0" );
+ artifactRequest.setArtifact( artifact );
+ artifactResult = system.resolveArtifact( session, artifactRequest );
+ checkArtifactResult( artifactResult, "artifact-1.0-classifier.zip" );
+ }
+
+ private void checkArtifactResult( ArtifactResult result, String filename )
+ {
+ assertFalse( result.isMissing() );
+ assertTrue( result.isResolved() );
+ Artifact artifact = result.getArtifact();
+ assertNotNull( artifact.getFile() );
+ assertEquals( filename, artifact.getFile().getName() );
+ }
+
+ public void testResolveArtifacts()
+ throws Exception
+ {
+ ArtifactRequest req1 = new ArtifactRequest();
+ req1.setArtifact( new DefaultArtifact( "ut.simple:artifact:1.0" ) );
+ req1.addRepository( newTestRepository() );
+
+ ArtifactRequest req2 = new ArtifactRequest();
+ req2.setArtifact( new DefaultArtifact( "ut.simple:artifact:zip:1.0" ) );
+ req2.addRepository( newTestRepository() );
+
+ ArtifactRequest req3 = new ArtifactRequest();
+ req3.setArtifact( new DefaultArtifact( "ut.simple:artifact:zip:classifier:1.0" ) );
+ req3.addRepository( newTestRepository() );
+
+ List<ArtifactRequest> requests = Arrays.asList( req1, req2, req3 );
+
+ List<ArtifactResult> results = system.resolveArtifacts( session, requests );
+
+ assertEquals( 3, results.size() );
+ checkArtifactResult( results.get( 0 ), "artifact-1.0.jar" );
+ checkArtifactResult( results.get( 1 ), "artifact-1.0.zip" );
+ checkArtifactResult( results.get( 2 ), "artifact-1.0-classifier.zip" );
+ }
+
+ public void testResolveMetadata()
+ throws Exception
+ {
+ //List<MetadataResult> resolveMetadata( RepositorySystemSession session,
+ // Collection<? extends MetadataRequest> requests );
+ }
+
+ public void testInstall()
+ throws Exception
+ {
+ //InstallResult install( RepositorySystemSession session, InstallRequest request )
+ // throws InstallationException;
+ // release, snapshot unique ou non unique, attachement
+ }
+
+ public void testDeploy()
+ throws Exception
+ {
+ //DeployResult deploy( RepositorySystemSession session, DeployRequest request )
+ // throws DeploymentException;
+ }
+
+ public void testNewLocalRepositoryManager()
+ throws Exception
+ {
+ //LocalRepositoryManager newLocalRepositoryManager( LocalRepository localRepository );
+ }
+
+ public void testNewSyncContext()
+ throws Exception
+ {
+ //SyncContext newSyncContext( RepositorySystemSession session, boolean shared );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleRepositoryListener.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleRepositoryListener.java b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleRepositoryListener.java
new file mode 100644
index 0000000..2879a9f
--- /dev/null
+++ b/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/util/ConsoleRepositoryListener.java
@@ -0,0 +1,132 @@
+package org.apache.maven.repository.internal.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;
+
+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 )
+ {
+ println( "artifactDeployed", event.getArtifact() + " to " + event.getRepository() );
+ }
+
+ public void artifactDeploying( RepositoryEvent event )
+ {
+ println( "artifactDeploying", event.getArtifact() + " to " + event.getRepository() );
+ }
+
+ public void artifactDescriptorInvalid( RepositoryEvent event )
+ {
+ println( "artifactDescriptorInvalid", "for " + event.getArtifact() + ": " + event.getException().getMessage() );
+ }
+
+ public void artifactDescriptorMissing( RepositoryEvent event )
+ {
+ println( "artifactDescriptorMissing", "for " + event.getArtifact() );
+ }
+
+ public void artifactInstalled( RepositoryEvent event )
+ {
+ println( "artifactInstalled", event.getArtifact() + " to " + event.getFile() );
+ }
+
+ public void artifactInstalling( RepositoryEvent event )
+ {
+ println( "artifactInstalling", event.getArtifact() + " to " + event.getFile() );
+ }
+
+ public void artifactResolved( RepositoryEvent event )
+ {
+ println( "artifactResolved", event.getArtifact() + " from " + event.getRepository() );
+ }
+
+ public void artifactDownloading( RepositoryEvent event )
+ {
+ println( "artifactDownloading", event.getArtifact() + " from " + event.getRepository() );
+ }
+
+ public void artifactDownloaded( RepositoryEvent event )
+ {
+ println( "artifactDownloaded", event.getArtifact() + " from " + event.getRepository() );
+ }
+
+ public void artifactResolving( RepositoryEvent event )
+ {
+ println( "artifactResolving", event.getArtifact().toString() );
+ }
+
+ public void metadataDeployed( RepositoryEvent event )
+ {
+ println( "metadataDeployed", event.getMetadata() + " to " + event.getRepository() );
+ }
+
+ public void metadataDeploying( RepositoryEvent event )
+ {
+ println( "metadataDeploying", event.getMetadata() + " to " + event.getRepository() );
+ }
+
+ public void metadataInstalled( RepositoryEvent event )
+ {
+ println( "metadataInstalled", event.getMetadata() + " to " + event.getFile() );
+ }
+
+ public void metadataInstalling( RepositoryEvent event )
+ {
+ println( "metadataInstalling", event.getMetadata() + " to " + event.getFile() );
+ }
+
+ public void metadataInvalid( RepositoryEvent event )
+ {
+ println( "metadataInvalid", event.getMetadata().toString() );
+ }
+
+ public void metadataResolved( RepositoryEvent event )
+ {
+ println( "metadataResolved", event.getMetadata() + " from " + event.getRepository() );
+ }
+
+ public void metadataResolving( RepositoryEvent event )
+ {
+ println( "metadataResolving", event.getMetadata() + " from " + event.getRepository() );
+ }
+
+ private void println( String event, String message )
+ {
+ out.println( "Aether Repository - " + event + ": " + message );
+ }
+}
[7/9] maven git commit: [MNG-6110] renamed 'maven-aether-provider' to
'maven-resolver-provider'
Posted by hb...@apache.org.
[MNG-6110] renamed 'maven-aether-provider' to 'maven-resolver-provider'
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/8972072e
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/8972072e
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/8972072e
Branch: refs/heads/master
Commit: 8972072e3200e2ecfe2acb6d0b2dc40b10a6bc31
Parents: 4d6c929
Author: Christian Schulte <sc...@apache.org>
Authored: Sun Dec 11 23:36:04 2016 +0100
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Wed Feb 1 07:59:53 2017 +0100
----------------------------------------------------------------------
maven-aether-provider/pom.xml | 128 ----
.../ArtifactDescriptorReaderDelegate.java | 153 -----
.../internal/ArtifactDescriptorUtils.java | 81 ---
.../DefaultArtifactDescriptorReader.java | 415 -------------
.../repository/internal/DefaultModelCache.java | 119 ----
.../internal/DefaultModelResolver.java | 229 -------
.../internal/DefaultVersionRangeResolver.java | 307 ---------
.../internal/DefaultVersionResolver.java | 617 -------------------
.../internal/LocalSnapshotMetadata.java | 163 -----
.../LocalSnapshotMetadataGenerator.java | 82 ---
.../repository/internal/MavenAetherModule.java | 76 ---
.../repository/internal/MavenMetadata.java | 137 ----
.../internal/MavenRepositorySystemUtils.java | 145 -----
.../internal/MavenSnapshotMetadata.java | 100 ---
.../internal/MavenWorkspaceReader.java | 32 -
.../repository/internal/RelocatedArtifact.java | 114 ----
.../internal/RemoteSnapshotMetadata.java | 157 -----
.../RemoteSnapshotMetadataGenerator.java | 107 ----
.../SnapshotMetadataGeneratorFactory.java | 52 --
.../repository/internal/VersionsMetadata.java | 133 ----
.../internal/VersionsMetadataGenerator.java | 108 ----
.../VersionsMetadataGeneratorFactory.java | 52 --
.../maven/repository/internal/package-info.java | 25 -
maven-aether-provider/src/site/apt/index.apt | 33 -
maven-aether-provider/src/site/site.xml | 36 --
.../internal/AbstractRepositoryTestCase.java | 87 ---
.../DefaultArtifactDescriptorReaderTest.java | 77 ---
.../internal/DefaultVersionResolverTest.java | 96 ---
.../MavenRepositorySystemUtilsTest.java | 45 --
.../internal/RemoteSnapshotMetadataTest.java | 82 ---
.../internal/RepositorySystemTest.java | 220 -------
.../util/ConsoleRepositoryListener.java | 132 ----
.../internal/util/ConsoleTransferListener.java | 186 ------
.../07.20.3-SNAPSHOT/maven-metadata.xml | 49 --
.../0.4.0-SNAPSHOT/maven-metadata.xml | 47 --
.../artifact/1.0/artifact-1.0-classifier.zip | 0
.../ut/simple/artifact/1.0/artifact-1.0.jar | 0
.../ut/simple/artifact/1.0/artifact-1.0.pom | 48 --
.../ut/simple/artifact/1.0/artifact-1.0.zip | 0
.../repo/ut/simple/artifact/maven-metadata.xml | 34 -
.../dependency/1.0/dependency-1.0-sources.jar | 0
.../ut/simple/dependency/1.0/dependency-1.0.jar | 0
.../ut/simple/dependency/1.0/dependency-1.0.pom | 31 -
.../ut/simple/dependency/maven-metadata.xml | 34 -
.../repo/ut/simple/parent/1.0/parent-1.0.pom | 43 --
.../repo/ut/simple/parent/maven-metadata.xml | 34 -
maven-compat/pom.xml | 2 +-
maven-core/pom.xml | 2 +-
.../main/resources/META-INF/maven/extension.xml | 13 +-
maven-resolver-provider/pom.xml | 128 ++++
.../ArtifactDescriptorReaderDelegate.java | 153 +++++
.../internal/ArtifactDescriptorUtils.java | 81 +++
.../DefaultArtifactDescriptorReader.java | 415 +++++++++++++
.../repository/internal/DefaultModelCache.java | 119 ++++
.../internal/DefaultModelResolver.java | 229 +++++++
.../internal/DefaultVersionRangeResolver.java | 307 +++++++++
.../internal/DefaultVersionResolver.java | 617 +++++++++++++++++++
.../internal/LocalSnapshotMetadata.java | 163 +++++
.../LocalSnapshotMetadataGenerator.java | 82 +++
.../repository/internal/MavenAetherModule.java | 80 +++
.../repository/internal/MavenMetadata.java | 137 ++++
.../internal/MavenRepositorySystemUtils.java | 145 +++++
.../internal/MavenResolverModule.java | 70 +++
.../internal/MavenSnapshotMetadata.java | 100 +++
.../internal/MavenWorkspaceReader.java | 32 +
.../repository/internal/RelocatedArtifact.java | 114 ++++
.../internal/RemoteSnapshotMetadata.java | 157 +++++
.../RemoteSnapshotMetadataGenerator.java | 107 ++++
.../SnapshotMetadataGeneratorFactory.java | 52 ++
.../repository/internal/VersionsMetadata.java | 133 ++++
.../internal/VersionsMetadataGenerator.java | 108 ++++
.../VersionsMetadataGeneratorFactory.java | 52 ++
.../maven/repository/internal/package-info.java | 25 +
maven-resolver-provider/src/site/apt/index.apt | 33 +
maven-resolver-provider/src/site/site.xml | 36 ++
.../internal/AbstractRepositoryTestCase.java | 87 +++
.../DefaultArtifactDescriptorReaderTest.java | 77 +++
.../internal/DefaultVersionResolverTest.java | 96 +++
.../MavenRepositorySystemUtilsTest.java | 45 ++
.../internal/RemoteSnapshotMetadataTest.java | 82 +++
.../internal/RepositorySystemTest.java | 220 +++++++
.../util/ConsoleRepositoryListener.java | 132 ++++
.../internal/util/ConsoleTransferListener.java | 186 ++++++
.../07.20.3-SNAPSHOT/maven-metadata.xml | 49 ++
.../0.4.0-SNAPSHOT/maven-metadata.xml | 47 ++
.../artifact/1.0/artifact-1.0-classifier.zip | 0
.../ut/simple/artifact/1.0/artifact-1.0.jar | 0
.../ut/simple/artifact/1.0/artifact-1.0.pom | 48 ++
.../ut/simple/artifact/1.0/artifact-1.0.zip | 0
.../repo/ut/simple/artifact/maven-metadata.xml | 34 +
.../dependency/1.0/dependency-1.0-sources.jar | 0
.../ut/simple/dependency/1.0/dependency-1.0.jar | 0
.../ut/simple/dependency/1.0/dependency-1.0.pom | 31 +
.../ut/simple/dependency/maven-metadata.xml | 34 +
.../repo/ut/simple/parent/1.0/parent-1.0.pom | 43 ++
.../repo/ut/simple/parent/maven-metadata.xml | 34 +
pom.xml | 4 +-
97 files changed, 4932 insertions(+), 4855 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/pom.xml
----------------------------------------------------------------------
diff --git a/maven-aether-provider/pom.xml b/maven-aether-provider/pom.xml
deleted file mode 100644
index 91d1ae7..0000000
--- a/maven-aether-provider/pom.xml
+++ /dev/null
@@ -1,128 +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</groupId>
- <artifactId>maven</artifactId>
- <version>3.5.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>maven-aether-provider</artifactId>
-
- <name>Maven Aether Provider</name>
- <description>Extensions to Maven Resolver for utilizing Maven POM and repository metadata.</description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model-builder</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-repository-metadata</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- <classifier>no_aop</classifier>
- <optional>true</optional>
- <exclusions>
- <exclusion>
- <groupId>aopalliance</groupId>
- <artifactId>aopalliance</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <!-- Testing -->
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-connector-basic</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-transport-wagon</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-file</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.sisu</groupId>
- <artifactId>org.eclipse.sisu.plexus</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>1.9.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-metadata</artifactId>
- </plugin>
- </plugins>
- </build>
-
-</project>
-
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorReaderDelegate.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorReaderDelegate.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorReaderDelegate.java
deleted file mode 100644
index 2395b36..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorReaderDelegate.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.maven.model.DependencyManagement;
-import org.apache.maven.model.DistributionManagement;
-import org.apache.maven.model.License;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Prerequisites;
-import org.apache.maven.model.Repository;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.ArtifactProperties;
-import org.eclipse.aether.artifact.ArtifactType;
-import org.eclipse.aether.artifact.ArtifactTypeRegistry;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.artifact.DefaultArtifactType;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.Exclusion;
-import org.eclipse.aether.resolution.ArtifactDescriptorResult;
-
-/**
- * Populates Aether {@link ArtifactDescriptorResult} from Maven project {@link Model}.
- *
- * @since 3.2.4
- * @provisional This class is part of work in progress and can be changed or removed without notice.
- */
-public class ArtifactDescriptorReaderDelegate
-{
- public void populateResult( RepositorySystemSession session, ArtifactDescriptorResult result, Model model )
- {
- ArtifactTypeRegistry stereotypes = session.getArtifactTypeRegistry();
-
- for ( Repository r : model.getRepositories() )
- {
- result.addRepository( ArtifactDescriptorUtils.toRemoteRepository( r ) );
- }
-
- for ( org.apache.maven.model.Dependency dependency : model.getDependencies() )
- {
- result.addDependency( convert( dependency, stereotypes ) );
- }
-
- DependencyManagement mngt = model.getDependencyManagement();
- if ( mngt != null )
- {
- for ( org.apache.maven.model.Dependency dependency : mngt.getDependencies() )
- {
- result.addManagedDependency( convert( dependency, stereotypes ) );
- }
- }
-
- Map<String, Object> properties = new LinkedHashMap<>();
-
- Prerequisites prerequisites = model.getPrerequisites();
- if ( prerequisites != null )
- {
- properties.put( "prerequisites.maven", prerequisites.getMaven() );
- }
-
- List<License> licenses = model.getLicenses();
- properties.put( "license.count", licenses.size() );
- for ( int i = 0; i < licenses.size(); i++ )
- {
- License license = licenses.get( i );
- properties.put( "license." + i + ".name", license.getName() );
- properties.put( "license." + i + ".url", license.getUrl() );
- properties.put( "license." + i + ".comments", license.getComments() );
- properties.put( "license." + i + ".distribution", license.getDistribution() );
- }
-
- result.setProperties( properties );
-
- setArtifactProperties( result, model );
- }
-
- private Dependency convert( org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes )
- {
- ArtifactType stereotype = stereotypes.get( dependency.getType() );
- if ( stereotype == null )
- {
- stereotype = new DefaultArtifactType( dependency.getType() );
- }
-
- boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0;
-
- Map<String, String> props = null;
- if ( system )
- {
- props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() );
- }
-
- Artifact artifact =
- new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null,
- dependency.getVersion(), props, stereotype );
-
- List<Exclusion> exclusions = new ArrayList<>( dependency.getExclusions().size() );
- for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() )
- {
- exclusions.add( convert( exclusion ) );
- }
-
- Dependency result = new Dependency( artifact, dependency.getScope(), dependency.isOptional(), exclusions );
-
- return result;
- }
-
- private Exclusion convert( org.apache.maven.model.Exclusion exclusion )
- {
- return new Exclusion( exclusion.getGroupId(), exclusion.getArtifactId(), "*", "*" );
- }
-
- private void setArtifactProperties( ArtifactDescriptorResult result, Model model )
- {
- String downloadUrl = null;
- DistributionManagement distMngt = model.getDistributionManagement();
- if ( distMngt != null )
- {
- downloadUrl = distMngt.getDownloadUrl();
- }
- if ( downloadUrl != null && downloadUrl.length() > 0 )
- {
- Artifact artifact = result.getArtifact();
- Map<String, String> props = new HashMap<>( artifact.getProperties() );
- props.put( ArtifactProperties.DOWNLOAD_URL, downloadUrl );
- result.setArtifact( artifact.setProperties( props ) );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java
deleted file mode 100644
index 7d4ede8..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.model.Repository;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.repository.RepositoryPolicy;
-
-/**
- * <strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part
- * of the public API. In particular, this class can be changed or deleted without prior notice.
- *
- * @author Benjamin Bentmann
- */
-public class ArtifactDescriptorUtils
-{
-
- public static Artifact toPomArtifact( Artifact artifact )
- {
- Artifact pomArtifact = artifact;
-
- if ( pomArtifact.getClassifier().length() > 0 || !"pom".equals( pomArtifact.getExtension() ) )
- {
- pomArtifact =
- new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), "pom", artifact.getVersion() );
- }
-
- return pomArtifact;
- }
-
- public static RemoteRepository toRemoteRepository( Repository repository )
- {
- RemoteRepository.Builder builder =
- new RemoteRepository.Builder( repository.getId(), repository.getLayout(), repository.getUrl() );
- builder.setSnapshotPolicy( toRepositoryPolicy( repository.getSnapshots() ) );
- builder.setReleasePolicy( toRepositoryPolicy( repository.getReleases() ) );
- return builder.build();
- }
-
- public static RepositoryPolicy toRepositoryPolicy( org.apache.maven.model.RepositoryPolicy policy )
- {
- boolean enabled = true;
- String checksums = RepositoryPolicy.CHECKSUM_POLICY_WARN;
- String updates = RepositoryPolicy.UPDATE_POLICY_DAILY;
-
- if ( policy != null )
- {
- enabled = policy.isEnabled();
- if ( policy.getUpdatePolicy() != null )
- {
- updates = policy.getUpdatePolicy();
- }
- if ( policy.getChecksumPolicy() != null )
- {
- checksums = policy.getChecksumPolicy();
- }
- }
-
- return new RepositoryPolicy( enabled, updates, checksums );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
deleted file mode 100644
index 0f31330..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
+++ /dev/null
@@ -1,415 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.LinkedHashSet;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.apache.commons.lang3.Validate;
-import org.apache.maven.model.DistributionManagement;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Relocation;
-import org.apache.maven.model.building.DefaultModelBuilderFactory;
-import org.apache.maven.model.building.DefaultModelBuildingRequest;
-import org.apache.maven.model.building.FileModelSource;
-import org.apache.maven.model.building.ModelBuilder;
-import org.apache.maven.model.building.ModelBuildingException;
-import org.apache.maven.model.building.ModelBuildingRequest;
-import org.apache.maven.model.building.ModelProblem;
-import org.apache.maven.model.resolution.UnresolvableModelException;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.eclipse.aether.RepositoryEvent;
-import org.eclipse.aether.RepositoryEvent.EventType;
-import org.eclipse.aether.RepositoryException;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.RequestTrace;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.impl.ArtifactDescriptorReader;
-import org.eclipse.aether.impl.ArtifactResolver;
-import org.eclipse.aether.impl.RemoteRepositoryManager;
-import org.eclipse.aether.impl.RepositoryEventDispatcher;
-import org.eclipse.aether.impl.VersionRangeResolver;
-import org.eclipse.aether.impl.VersionResolver;
-import org.eclipse.aether.repository.WorkspaceReader;
-import org.eclipse.aether.repository.WorkspaceRepository;
-import org.eclipse.aether.resolution.ArtifactDescriptorException;
-import org.eclipse.aether.resolution.ArtifactDescriptorPolicy;
-import org.eclipse.aether.resolution.ArtifactDescriptorPolicyRequest;
-import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
-import org.eclipse.aether.resolution.ArtifactDescriptorResult;
-import org.eclipse.aether.resolution.ArtifactRequest;
-import org.eclipse.aether.resolution.ArtifactResolutionException;
-import org.eclipse.aether.resolution.ArtifactResult;
-import org.eclipse.aether.resolution.VersionRequest;
-import org.eclipse.aether.resolution.VersionResolutionException;
-import org.eclipse.aether.resolution.VersionResult;
-import org.eclipse.aether.spi.locator.Service;
-import org.eclipse.aether.spi.locator.ServiceLocator;
-import org.eclipse.aether.spi.log.Logger;
-import org.eclipse.aether.spi.log.LoggerFactory;
-import org.eclipse.aether.spi.log.NullLoggerFactory;
-import org.eclipse.aether.transfer.ArtifactNotFoundException;
-
-/**
- * @author Benjamin Bentmann
- */
-@Named
-@Component( role = ArtifactDescriptorReader.class )
-public class DefaultArtifactDescriptorReader
- implements ArtifactDescriptorReader, Service
-{
-
- @SuppressWarnings( "unused" )
- @Requirement( role = LoggerFactory.class )
- private Logger logger = NullLoggerFactory.LOGGER;
-
- @Requirement
- private RemoteRepositoryManager remoteRepositoryManager;
-
- @Requirement
- private VersionResolver versionResolver;
-
- @Requirement
- private VersionRangeResolver versionRangeResolver;
-
- @Requirement
- private ArtifactResolver artifactResolver;
-
- @Requirement
- private RepositoryEventDispatcher repositoryEventDispatcher;
-
- @Requirement
- private ModelBuilder modelBuilder;
-
- public DefaultArtifactDescriptorReader()
- {
- // enable no-arg constructor
- }
-
- @Inject
- DefaultArtifactDescriptorReader( RemoteRepositoryManager remoteRepositoryManager, VersionResolver versionResolver,
- ArtifactResolver artifactResolver, ModelBuilder modelBuilder,
- RepositoryEventDispatcher repositoryEventDispatcher, LoggerFactory loggerFactory )
- {
- setRemoteRepositoryManager( remoteRepositoryManager );
- setVersionResolver( versionResolver );
- setArtifactResolver( artifactResolver );
- setModelBuilder( modelBuilder );
- setLoggerFactory( loggerFactory );
- setRepositoryEventDispatcher( repositoryEventDispatcher );
- }
-
- public void initService( ServiceLocator locator )
- {
- setLoggerFactory( locator.getService( LoggerFactory.class ) );
- setRemoteRepositoryManager( locator.getService( RemoteRepositoryManager.class ) );
- setVersionResolver( locator.getService( VersionResolver.class ) );
- setVersionRangeResolver( locator.getService( VersionRangeResolver.class ) );
- setArtifactResolver( locator.getService( ArtifactResolver.class ) );
- setRepositoryEventDispatcher( locator.getService( RepositoryEventDispatcher.class ) );
- modelBuilder = locator.getService( ModelBuilder.class );
- if ( modelBuilder == null )
- {
- setModelBuilder( new DefaultModelBuilderFactory().newInstance() );
- }
- }
-
- public DefaultArtifactDescriptorReader setLoggerFactory( LoggerFactory loggerFactory )
- {
- this.logger = NullLoggerFactory.getSafeLogger( loggerFactory, getClass() );
- return this;
- }
-
- void setLogger( LoggerFactory loggerFactory )
- {
- // plexus support
- setLoggerFactory( loggerFactory );
- }
-
- public DefaultArtifactDescriptorReader setRemoteRepositoryManager( RemoteRepositoryManager remoteRepositoryManager )
- {
- this.remoteRepositoryManager = Validate.notNull( remoteRepositoryManager,
- "remoteRepositoryManager cannot be null" );
- return this;
- }
-
- public DefaultArtifactDescriptorReader setVersionResolver( VersionResolver versionResolver )
- {
- this.versionResolver = Validate.notNull( versionResolver, "versionResolver cannot be null" );
- return this;
- }
-
- /** @since 3.2.2 */
- public DefaultArtifactDescriptorReader setVersionRangeResolver( VersionRangeResolver versionRangeResolver )
- {
- this.versionRangeResolver = Validate.notNull( versionRangeResolver, "versionRangeResolver cannot be null" );
- return this;
- }
-
- public DefaultArtifactDescriptorReader setArtifactResolver( ArtifactResolver artifactResolver )
- {
- this.artifactResolver = Validate.notNull( artifactResolver, "artifactResolver cannot be null" );
- return this;
- }
-
- public DefaultArtifactDescriptorReader setRepositoryEventDispatcher(
- RepositoryEventDispatcher repositoryEventDispatcher )
- {
- this.repositoryEventDispatcher = Validate.notNull( repositoryEventDispatcher,
- "repositoryEventDispatcher cannot be null" );
- return this;
- }
-
- public DefaultArtifactDescriptorReader setModelBuilder( ModelBuilder modelBuilder )
- {
- this.modelBuilder = Validate.notNull( modelBuilder, "modelBuilder cannot be null" );
- return this;
- }
-
- public ArtifactDescriptorResult readArtifactDescriptor( RepositorySystemSession session,
- ArtifactDescriptorRequest request )
- throws ArtifactDescriptorException
- {
- ArtifactDescriptorResult result = new ArtifactDescriptorResult( request );
-
- Model model = loadPom( session, request, result );
- if ( model != null )
- {
- Map<String, Object> config = session.getConfigProperties();
- ArtifactDescriptorReaderDelegate delegate =
- (ArtifactDescriptorReaderDelegate) config.get( ArtifactDescriptorReaderDelegate.class.getName() );
-
- if ( delegate == null )
- {
- delegate = new ArtifactDescriptorReaderDelegate();
- }
-
- delegate.populateResult( session, result, model );
- }
-
- return result;
- }
-
- private Model loadPom( RepositorySystemSession session, ArtifactDescriptorRequest request,
- ArtifactDescriptorResult result )
- throws ArtifactDescriptorException
- {
- RequestTrace trace = RequestTrace.newChild( request.getTrace(), request );
-
- Set<String> visited = new LinkedHashSet<>();
- for ( Artifact a = request.getArtifact();; )
- {
- Artifact pomArtifact = ArtifactDescriptorUtils.toPomArtifact( a );
- try
- {
- VersionRequest versionRequest =
- new VersionRequest( a, request.getRepositories(), request.getRequestContext() );
- versionRequest.setTrace( trace );
- VersionResult versionResult = versionResolver.resolveVersion( session, versionRequest );
-
- a = a.setVersion( versionResult.getVersion() );
-
- versionRequest =
- new VersionRequest( pomArtifact, request.getRepositories(), request.getRequestContext() );
- versionRequest.setTrace( trace );
- versionResult = versionResolver.resolveVersion( session, versionRequest );
-
- pomArtifact = pomArtifact.setVersion( versionResult.getVersion() );
- }
- catch ( VersionResolutionException e )
- {
- result.addException( e );
- throw new ArtifactDescriptorException( result );
- }
-
- if ( !visited.add( a.getGroupId() + ':' + a.getArtifactId() + ':' + a.getBaseVersion() ) )
- {
- RepositoryException exception =
- new RepositoryException( "Artifact relocations form a cycle: " + visited );
- invalidDescriptor( session, trace, a, exception );
- if ( ( getPolicy( session, a, request ) & ArtifactDescriptorPolicy.IGNORE_INVALID ) != 0 )
- {
- return null;
- }
- result.addException( exception );
- throw new ArtifactDescriptorException( result );
- }
-
- ArtifactResult resolveResult;
- try
- {
- ArtifactRequest resolveRequest =
- new ArtifactRequest( pomArtifact, request.getRepositories(), request.getRequestContext() );
- resolveRequest.setTrace( trace );
- resolveResult = artifactResolver.resolveArtifact( session, resolveRequest );
- pomArtifact = resolveResult.getArtifact();
- result.setRepository( resolveResult.getRepository() );
- }
- catch ( ArtifactResolutionException e )
- {
- if ( e.getCause() instanceof ArtifactNotFoundException )
- {
- missingDescriptor( session, trace, a, (Exception) e.getCause() );
- if ( ( getPolicy( session, a, request ) & ArtifactDescriptorPolicy.IGNORE_MISSING ) != 0 )
- {
- return null;
- }
- }
- result.addException( e );
- throw new ArtifactDescriptorException( result );
- }
-
- Model model;
-
- // hack: don't rebuild model if it was already loaded during reactor resolution
- final WorkspaceReader workspace = session.getWorkspaceReader();
- if ( workspace instanceof MavenWorkspaceReader )
- {
- model = ( (MavenWorkspaceReader) workspace ).findModel( pomArtifact );
- if ( model != null )
- {
- return model;
- }
- }
-
- try
- {
- ModelBuildingRequest modelRequest = new DefaultModelBuildingRequest();
- modelRequest.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
- modelRequest.setProcessPlugins( false );
- modelRequest.setTwoPhaseBuilding( false );
- modelRequest.setSystemProperties( toProperties( session.getUserProperties(),
- session.getSystemProperties() ) );
- modelRequest.setModelCache( DefaultModelCache.newInstance( session ) );
- modelRequest.setModelResolver( new DefaultModelResolver( session, trace.newChild( modelRequest ),
- request.getRequestContext(), artifactResolver,
- versionRangeResolver, remoteRepositoryManager,
- request.getRepositories() ) );
- if ( resolveResult.getRepository() instanceof WorkspaceRepository )
- {
- modelRequest.setPomFile( pomArtifact.getFile() );
- }
- else
- {
- modelRequest.setModelSource( new FileModelSource( pomArtifact.getFile() ) );
- }
-
- model = modelBuilder.build( modelRequest ).getEffectiveModel();
- }
- catch ( ModelBuildingException e )
- {
- for ( ModelProblem problem : e.getProblems() )
- {
- if ( problem.getException() instanceof UnresolvableModelException )
- {
- result.addException( problem.getException() );
- throw new ArtifactDescriptorException( result );
- }
- }
- invalidDescriptor( session, trace, a, e );
- if ( ( getPolicy( session, a, request ) & ArtifactDescriptorPolicy.IGNORE_INVALID ) != 0 )
- {
- return null;
- }
- result.addException( e );
- throw new ArtifactDescriptorException( result );
- }
-
- Relocation relocation = getRelocation( model );
-
- if ( relocation != null )
- {
- result.addRelocation( a );
- a =
- new RelocatedArtifact( a, relocation.getGroupId(), relocation.getArtifactId(),
- relocation.getVersion() );
- result.setArtifact( a );
- }
- else
- {
- return model;
- }
- }
- }
-
- private Properties toProperties( Map<String, String> dominant, Map<String, String> recessive )
- {
- Properties props = new Properties();
- if ( recessive != null )
- {
- props.putAll( recessive );
- }
- if ( dominant != null )
- {
- props.putAll( dominant );
- }
- return props;
- }
-
- private Relocation getRelocation( Model model )
- {
- Relocation relocation = null;
- DistributionManagement distMngt = model.getDistributionManagement();
- if ( distMngt != null )
- {
- relocation = distMngt.getRelocation();
- }
- return relocation;
- }
-
- private void missingDescriptor( RepositorySystemSession session, RequestTrace trace, Artifact artifact,
- Exception exception )
- {
- RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.ARTIFACT_DESCRIPTOR_MISSING );
- event.setTrace( trace );
- event.setArtifact( artifact );
- event.setException( exception );
-
- repositoryEventDispatcher.dispatch( event.build() );
- }
-
- private void invalidDescriptor( RepositorySystemSession session, RequestTrace trace, Artifact artifact,
- Exception exception )
- {
- RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.ARTIFACT_DESCRIPTOR_INVALID );
- event.setTrace( trace );
- event.setArtifact( artifact );
- event.setException( exception );
-
- repositoryEventDispatcher.dispatch( event.build() );
- }
-
- private int getPolicy( RepositorySystemSession session, Artifact a, ArtifactDescriptorRequest request )
- {
- ArtifactDescriptorPolicy policy = session.getArtifactDescriptorPolicy();
- if ( policy == null )
- {
- return ArtifactDescriptorPolicy.STRICT;
- }
- return policy.getPolicy( session, new ArtifactDescriptorPolicyRequest( a, request.getRequestContext() ) );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelCache.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelCache.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelCache.java
deleted file mode 100644
index f13495d..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelCache.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.model.building.ModelCache;
-import org.eclipse.aether.RepositoryCache;
-import org.eclipse.aether.RepositorySystemSession;
-
-/**
- * A model builder cache backed by the repository system cache.
- *
- * @author Benjamin Bentmann
- */
-class DefaultModelCache
- implements ModelCache
-{
-
- private final RepositorySystemSession session;
-
- private final RepositoryCache cache;
-
- public static ModelCache newInstance( RepositorySystemSession session )
- {
- if ( session.getCache() == null )
- {
- return null;
- }
- else
- {
- return new DefaultModelCache( session );
- }
- }
-
- private DefaultModelCache( RepositorySystemSession session )
- {
- this.session = session;
- this.cache = session.getCache();
- }
-
- public Object get( String groupId, String artifactId, String version, String tag )
- {
- return cache.get( session, new Key( groupId, artifactId, version, tag ) );
- }
-
- public void put( String groupId, String artifactId, String version, String tag, Object data )
- {
- cache.put( session, new Key( groupId, artifactId, version, tag ), data );
- }
-
- static class Key
- {
-
- private final String groupId;
-
- private final String artifactId;
-
- private final String version;
-
- private final String tag;
-
- private final int hash;
-
- public Key( String groupId, String artifactId, String version, String tag )
- {
- this.groupId = groupId;
- this.artifactId = artifactId;
- this.version = version;
- this.tag = tag;
-
- int h = 17;
- h = h * 31 + this.groupId.hashCode();
- h = h * 31 + this.artifactId.hashCode();
- h = h * 31 + this.version.hashCode();
- h = h * 31 + this.tag.hashCode();
- hash = h;
- }
-
- @Override
- public boolean equals( Object obj )
- {
- if ( this == obj )
- {
- return true;
- }
- if ( null == obj || !getClass().equals( obj.getClass() ) )
- {
- return false;
- }
-
- Key that = (Key) obj;
- return artifactId.equals( that.artifactId ) && groupId.equals( that.groupId )
- && version.equals( that.version ) && tag.equals( that.tag );
- }
-
- @Override
- public int hashCode()
- {
- return hash;
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java
deleted file mode 100644
index f344959..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import org.apache.maven.model.Parent;
-import org.apache.maven.model.Repository;
-import org.apache.maven.model.building.FileModelSource;
-import org.apache.maven.model.building.ModelSource;
-import org.apache.maven.model.resolution.InvalidRepositoryException;
-import org.apache.maven.model.resolution.ModelResolver;
-import org.apache.maven.model.resolution.UnresolvableModelException;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.RequestTrace;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.impl.ArtifactResolver;
-import org.eclipse.aether.impl.RemoteRepositoryManager;
-import org.eclipse.aether.impl.VersionRangeResolver;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.resolution.ArtifactRequest;
-import org.eclipse.aether.resolution.ArtifactResolutionException;
-import org.eclipse.aether.resolution.VersionRangeRequest;
-import org.eclipse.aether.resolution.VersionRangeResolutionException;
-import org.eclipse.aether.resolution.VersionRangeResult;
-
-/**
- * A model resolver to assist building of dependency POMs. This resolver gives priority to those repositories that have
- * been initially specified and repositories discovered in dependency POMs are recessively merged into the search chain.
- *
- * @author Benjamin Bentmann
- * @see DefaultArtifactDescriptorReader
- */
-class DefaultModelResolver
- implements ModelResolver
-{
-
- private final RepositorySystemSession session;
-
- private final RequestTrace trace;
-
- private final String context;
-
- private List<RemoteRepository> repositories;
-
- private final List<RemoteRepository> externalRepositories;
-
- private final ArtifactResolver resolver;
-
- private final VersionRangeResolver versionRangeResolver;
-
- private final RemoteRepositoryManager remoteRepositoryManager;
-
- private final Set<String> repositoryIds;
-
- public DefaultModelResolver( RepositorySystemSession session, RequestTrace trace, String context,
- ArtifactResolver resolver, VersionRangeResolver versionRangeResolver,
- RemoteRepositoryManager remoteRepositoryManager, List<RemoteRepository> repositories )
- {
- this.session = session;
- this.trace = trace;
- this.context = context;
- this.resolver = resolver;
- this.versionRangeResolver = versionRangeResolver;
- this.remoteRepositoryManager = remoteRepositoryManager;
- this.repositories = repositories;
- List<RemoteRepository> externalRepositories = new ArrayList<>();
- externalRepositories.addAll( repositories );
- this.externalRepositories = Collections.unmodifiableList( externalRepositories );
-
- this.repositoryIds = new HashSet<>();
- }
-
- private DefaultModelResolver( DefaultModelResolver original )
- {
- this.session = original.session;
- this.trace = original.trace;
- this.context = original.context;
- this.resolver = original.resolver;
- this.versionRangeResolver = original.versionRangeResolver;
- this.remoteRepositoryManager = original.remoteRepositoryManager;
- this.repositories = new ArrayList<>( original.repositories );
- this.externalRepositories = original.externalRepositories;
- this.repositoryIds = new HashSet<>( original.repositoryIds );
- }
-
- @Override
- public void addRepository( Repository repository )
- throws InvalidRepositoryException
- {
- addRepository( repository, false );
- }
-
- @Override
- public void addRepository( final Repository repository, boolean replace )
- throws InvalidRepositoryException
- {
- if ( session.isIgnoreArtifactDescriptorRepositories() )
- {
- return;
- }
-
- if ( !repositoryIds.add( repository.getId() ) )
- {
- if ( !replace )
- {
- return;
- }
-
- removeMatchingRepository( repositories, repository.getId() );
- }
-
- List<RemoteRepository> newRepositories =
- Collections.singletonList( ArtifactDescriptorUtils.toRemoteRepository( repository ) );
-
- this.repositories =
- remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories, true );
- }
-
- private static void removeMatchingRepository( Iterable<RemoteRepository> repositories, final String id )
- {
- Iterables.removeIf( repositories, new Predicate<RemoteRepository>()
- {
- @Override
- public boolean apply( RemoteRepository remoteRepository )
- {
- return remoteRepository.getId().equals( id );
- }
- } );
- }
-
- @Override
- public ModelResolver newCopy()
- {
- return new DefaultModelResolver( this );
- }
-
- @Override
- public ModelSource resolveModel( String groupId, String artifactId, String version )
- throws UnresolvableModelException
- {
- Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version );
-
- try
- {
- ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context );
- request.setTrace( trace );
- pomArtifact = resolver.resolveArtifact( session, request ).getArtifact();
- }
- catch ( ArtifactResolutionException e )
- {
- throw new UnresolvableModelException( e.getMessage(), groupId, artifactId, version, e );
- }
-
- File pomFile = pomArtifact.getFile();
-
- return new FileModelSource( pomFile );
- }
-
- public ModelSource resolveModel( Parent parent )
- throws UnresolvableModelException
- {
- Artifact artifact = new DefaultArtifact( parent.getGroupId(), parent.getArtifactId(), "", "pom",
- parent.getVersion() );
-
- VersionRangeRequest versionRangeRequest = new VersionRangeRequest( artifact, repositories, context );
- versionRangeRequest.setTrace( trace );
-
- try
- {
- VersionRangeResult versionRangeResult =
- versionRangeResolver.resolveVersionRange( session, versionRangeRequest );
-
- if ( versionRangeResult.getHighestVersion() == null )
- {
- throw new UnresolvableModelException( "No versions matched the requested range '" + parent.getVersion()
- + "'", parent.getGroupId(), parent.getArtifactId(),
- parent.getVersion() );
-
- }
-
- if ( versionRangeResult.getVersionConstraint() != null
- && versionRangeResult.getVersionConstraint().getRange() != null
- && versionRangeResult.getVersionConstraint().getRange().getUpperBound() == null )
- {
- throw new UnresolvableModelException( "The requested version range '" + parent.getVersion()
- + "' does not specify an upper bound", parent.getGroupId(),
- parent.getArtifactId(), parent.getVersion() );
-
- }
-
- parent.setVersion( versionRangeResult.getHighestVersion().toString() );
- }
- catch ( VersionRangeResolutionException e )
- {
- throw new UnresolvableModelException( e.getMessage(), parent.getGroupId(), parent.getArtifactId(),
- parent.getVersion(), e );
-
- }
-
- return resolveModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java
deleted file mode 100644
index ddd3e97..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java
+++ /dev/null
@@ -1,307 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.commons.lang3.Validate;
-import org.apache.maven.artifact.repository.metadata.Versioning;
-import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.util.IOUtil;
-import org.eclipse.aether.RepositoryEvent;
-import org.eclipse.aether.RepositoryEvent.EventType;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.RequestTrace;
-import org.eclipse.aether.SyncContext;
-import org.eclipse.aether.impl.MetadataResolver;
-import org.eclipse.aether.impl.RepositoryEventDispatcher;
-import org.eclipse.aether.impl.SyncContextFactory;
-import org.eclipse.aether.impl.VersionRangeResolver;
-import org.eclipse.aether.metadata.DefaultMetadata;
-import org.eclipse.aether.metadata.Metadata;
-import org.eclipse.aether.repository.ArtifactRepository;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.repository.WorkspaceReader;
-import org.eclipse.aether.resolution.MetadataRequest;
-import org.eclipse.aether.resolution.MetadataResult;
-import org.eclipse.aether.resolution.VersionRangeRequest;
-import org.eclipse.aether.resolution.VersionRangeResolutionException;
-import org.eclipse.aether.resolution.VersionRangeResult;
-import org.eclipse.aether.spi.locator.Service;
-import org.eclipse.aether.spi.locator.ServiceLocator;
-import org.eclipse.aether.spi.log.Logger;
-import org.eclipse.aether.spi.log.LoggerFactory;
-import org.eclipse.aether.spi.log.NullLoggerFactory;
-import org.eclipse.aether.util.version.GenericVersionScheme;
-import org.eclipse.aether.version.InvalidVersionSpecificationException;
-import org.eclipse.aether.version.Version;
-import org.eclipse.aether.version.VersionConstraint;
-import org.eclipse.aether.version.VersionScheme;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Benjamin Bentmann
- */
-@Named
-@Component( role = VersionRangeResolver.class )
-public class DefaultVersionRangeResolver
- implements VersionRangeResolver, Service
-{
-
- private static final String MAVEN_METADATA_XML = "maven-metadata.xml";
-
- @SuppressWarnings( "unused" )
- @Requirement( role = LoggerFactory.class )
- private Logger logger = NullLoggerFactory.LOGGER;
-
- @Requirement
- private MetadataResolver metadataResolver;
-
- @Requirement
- private SyncContextFactory syncContextFactory;
-
- @Requirement
- private RepositoryEventDispatcher repositoryEventDispatcher;
-
- public DefaultVersionRangeResolver()
- {
- // enable default constructor
- }
-
- @Inject
- DefaultVersionRangeResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
- RepositoryEventDispatcher repositoryEventDispatcher, LoggerFactory loggerFactory )
- {
- setMetadataResolver( metadataResolver );
- setSyncContextFactory( syncContextFactory );
- setLoggerFactory( loggerFactory );
- setRepositoryEventDispatcher( repositoryEventDispatcher );
- }
-
- public void initService( ServiceLocator locator )
- {
- setLoggerFactory( locator.getService( LoggerFactory.class ) );
- setMetadataResolver( locator.getService( MetadataResolver.class ) );
- setSyncContextFactory( locator.getService( SyncContextFactory.class ) );
- setRepositoryEventDispatcher( locator.getService( RepositoryEventDispatcher.class ) );
- }
-
- public DefaultVersionRangeResolver setLoggerFactory( LoggerFactory loggerFactory )
- {
- this.logger = NullLoggerFactory.getSafeLogger( loggerFactory, getClass() );
- return this;
- }
-
- void setLogger( LoggerFactory loggerFactory )
- {
- // plexus support
- setLoggerFactory( loggerFactory );
- }
-
- public DefaultVersionRangeResolver setMetadataResolver( MetadataResolver metadataResolver )
- {
- this.metadataResolver = Validate.notNull( metadataResolver, "metadataResolver cannot be null" );
- return this;
- }
-
- public DefaultVersionRangeResolver setSyncContextFactory( SyncContextFactory syncContextFactory )
- {
- this.syncContextFactory = Validate.notNull( syncContextFactory, "syncContextFactory cannot be null" );
- return this;
- }
-
- public DefaultVersionRangeResolver setRepositoryEventDispatcher(
- RepositoryEventDispatcher repositoryEventDispatcher )
- {
- this.repositoryEventDispatcher = Validate.notNull( repositoryEventDispatcher,
- "repositoryEventDispatcher cannot be null" );
- return this;
- }
-
- public VersionRangeResult resolveVersionRange( RepositorySystemSession session, VersionRangeRequest request )
- throws VersionRangeResolutionException
- {
- VersionRangeResult result = new VersionRangeResult( request );
-
- VersionScheme versionScheme = new GenericVersionScheme();
-
- VersionConstraint versionConstraint;
- try
- {
- versionConstraint = versionScheme.parseVersionConstraint( request.getArtifact().getVersion() );
- }
- catch ( InvalidVersionSpecificationException e )
- {
- result.addException( e );
- throw new VersionRangeResolutionException( result );
- }
-
- result.setVersionConstraint( versionConstraint );
-
- if ( versionConstraint.getRange() == null )
- {
- result.addVersion( versionConstraint.getVersion() );
- }
- else
- {
- Map<String, ArtifactRepository> versionIndex = getVersions( session, result, request );
-
- List<Version> versions = new ArrayList<>();
- for ( Map.Entry<String, ArtifactRepository> v : versionIndex.entrySet() )
- {
- try
- {
- Version ver = versionScheme.parseVersion( v.getKey() );
- if ( versionConstraint.containsVersion( ver ) )
- {
- versions.add( ver );
- result.setRepository( ver, v.getValue() );
- }
- }
- catch ( InvalidVersionSpecificationException e )
- {
- result.addException( e );
- }
- }
-
- Collections.sort( versions );
- result.setVersions( versions );
- }
-
- return result;
- }
-
- private Map<String, ArtifactRepository> getVersions( RepositorySystemSession session, VersionRangeResult result,
- VersionRangeRequest request )
- {
- RequestTrace trace = RequestTrace.newChild( request.getTrace(), request );
-
- Map<String, ArtifactRepository> versionIndex = new HashMap<>();
-
- Metadata metadata =
- new DefaultMetadata( request.getArtifact().getGroupId(), request.getArtifact().getArtifactId(),
- MAVEN_METADATA_XML, Metadata.Nature.RELEASE_OR_SNAPSHOT );
-
- List<MetadataRequest> metadataRequests = new ArrayList<>( request.getRepositories().size() );
-
- metadataRequests.add( new MetadataRequest( metadata, null, request.getRequestContext() ) );
-
- for ( RemoteRepository repository : request.getRepositories() )
- {
- MetadataRequest metadataRequest = new MetadataRequest( metadata, repository, request.getRequestContext() );
- metadataRequest.setDeleteLocalCopyIfMissing( true );
- metadataRequest.setTrace( trace );
- metadataRequests.add( metadataRequest );
- }
-
- List<MetadataResult> metadataResults = metadataResolver.resolveMetadata( session, metadataRequests );
-
- WorkspaceReader workspace = session.getWorkspaceReader();
- if ( workspace != null )
- {
- List<String> versions = workspace.findVersions( request.getArtifact() );
- for ( String version : versions )
- {
- versionIndex.put( version, workspace.getRepository() );
- }
- }
-
- for ( MetadataResult metadataResult : metadataResults )
- {
- result.addException( metadataResult.getException() );
-
- ArtifactRepository repository = metadataResult.getRequest().getRepository();
- if ( repository == null )
- {
- repository = session.getLocalRepository();
- }
-
- Versioning versioning = readVersions( session, trace, metadataResult.getMetadata(), repository, result );
- for ( String version : versioning.getVersions() )
- {
- if ( !versionIndex.containsKey( version ) )
- {
- versionIndex.put( version, repository );
- }
- }
- }
-
- return versionIndex;
- }
-
- private Versioning readVersions( RepositorySystemSession session, RequestTrace trace, Metadata metadata,
- ArtifactRepository repository, VersionRangeResult result )
- {
- Versioning versioning = null;
-
- FileInputStream fis = null;
- try
- {
- if ( metadata != null )
- {
-
- try ( SyncContext syncContext = syncContextFactory.newInstance( session, true ) )
- {
- syncContext.acquire( null, Collections.singleton( metadata ) );
-
- if ( metadata.getFile() != null && metadata.getFile().exists() )
- {
- fis = new FileInputStream( metadata.getFile() );
- org.apache.maven.artifact.repository.metadata.Metadata m =
- new MetadataXpp3Reader().read( fis, false );
- versioning = m.getVersioning();
- }
- }
- }
- }
- catch ( Exception e )
- {
- invalidMetadata( session, trace, metadata, repository, e );
- result.addException( e );
- }
- finally
- {
- IOUtil.close( fis );
- }
-
- return ( versioning != null ) ? versioning : new Versioning();
- }
-
- private void invalidMetadata( RepositorySystemSession session, RequestTrace trace, Metadata metadata,
- ArtifactRepository repository, Exception exception )
- {
- RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.METADATA_INVALID );
- event.setTrace( trace );
- event.setMetadata( metadata );
- event.setException( exception );
- event.setRepository( repository );
-
- repositoryEventDispatcher.dispatch( event.build() );
- }
-
-}
\ No newline at end of file
[6/9] maven git commit: [MNG-6110] renamed 'maven-aether-provider' to
'maven-resolver-provider'
Posted by hb...@apache.org.
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java
deleted file mode 100644
index 2b0890b..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java
+++ /dev/null
@@ -1,617 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.commons.lang3.Validate;
-import org.apache.maven.artifact.repository.metadata.Snapshot;
-import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
-import org.apache.maven.artifact.repository.metadata.Versioning;
-import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringUtils;
-import org.eclipse.aether.RepositoryCache;
-import org.eclipse.aether.RepositoryEvent;
-import org.eclipse.aether.RepositoryEvent.EventType;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.RequestTrace;
-import org.eclipse.aether.SyncContext;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.impl.MetadataResolver;
-import org.eclipse.aether.impl.RepositoryEventDispatcher;
-import org.eclipse.aether.impl.SyncContextFactory;
-import org.eclipse.aether.impl.VersionResolver;
-import org.eclipse.aether.internal.impl.CacheUtils;
-import org.eclipse.aether.metadata.DefaultMetadata;
-import org.eclipse.aether.metadata.Metadata;
-import org.eclipse.aether.repository.ArtifactRepository;
-import org.eclipse.aether.repository.LocalRepository;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.repository.WorkspaceReader;
-import org.eclipse.aether.repository.WorkspaceRepository;
-import org.eclipse.aether.resolution.MetadataRequest;
-import org.eclipse.aether.resolution.MetadataResult;
-import org.eclipse.aether.resolution.VersionRequest;
-import org.eclipse.aether.resolution.VersionResolutionException;
-import org.eclipse.aether.resolution.VersionResult;
-import org.eclipse.aether.spi.locator.Service;
-import org.eclipse.aether.spi.locator.ServiceLocator;
-import org.eclipse.aether.spi.log.Logger;
-import org.eclipse.aether.spi.log.LoggerFactory;
-import org.eclipse.aether.spi.log.NullLoggerFactory;
-import org.eclipse.aether.util.ConfigUtils;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Benjamin Bentmann
- */
-@Named
-@Component( role = VersionResolver.class )
-public class DefaultVersionResolver
- implements VersionResolver, Service
-{
-
- private static final String MAVEN_METADATA_XML = "maven-metadata.xml";
-
- private static final String RELEASE = "RELEASE";
-
- private static final String LATEST = "LATEST";
-
- private static final String SNAPSHOT = "SNAPSHOT";
-
- @SuppressWarnings( "unused" )
- @Requirement( role = LoggerFactory.class )
- private Logger logger = NullLoggerFactory.LOGGER;
-
- @Requirement
- private MetadataResolver metadataResolver;
-
- @Requirement
- private SyncContextFactory syncContextFactory;
-
- @Requirement
- private RepositoryEventDispatcher repositoryEventDispatcher;
-
- public DefaultVersionResolver()
- {
- // enable no-arg constructor
- }
-
- @Inject
- DefaultVersionResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
- RepositoryEventDispatcher repositoryEventDispatcher, LoggerFactory loggerFactory )
- {
- setMetadataResolver( metadataResolver );
- setSyncContextFactory( syncContextFactory );
- setLoggerFactory( loggerFactory );
- setRepositoryEventDispatcher( repositoryEventDispatcher );
- }
-
- public void initService( ServiceLocator locator )
- {
- setLoggerFactory( locator.getService( LoggerFactory.class ) );
- setMetadataResolver( locator.getService( MetadataResolver.class ) );
- setSyncContextFactory( locator.getService( SyncContextFactory.class ) );
- setRepositoryEventDispatcher( locator.getService( RepositoryEventDispatcher.class ) );
- }
-
- public DefaultVersionResolver setLoggerFactory( LoggerFactory loggerFactory )
- {
- this.logger = NullLoggerFactory.getSafeLogger( loggerFactory, getClass() );
- return this;
- }
-
- void setLogger( LoggerFactory loggerFactory )
- {
- // plexus support
- setLoggerFactory( loggerFactory );
- }
-
- public DefaultVersionResolver setMetadataResolver( MetadataResolver metadataResolver )
- {
- this.metadataResolver = Validate.notNull( metadataResolver, "metadataResolver cannot be null" );
- return this;
- }
-
- public DefaultVersionResolver setSyncContextFactory( SyncContextFactory syncContextFactory )
- {
- this.syncContextFactory = Validate.notNull( syncContextFactory, "syncContextFactory cannot be null" );
- return this;
- }
-
- public DefaultVersionResolver setRepositoryEventDispatcher( RepositoryEventDispatcher repositoryEventDispatcher )
- {
- this.repositoryEventDispatcher = Validate.notNull( repositoryEventDispatcher,
- "repositoryEventDispatcher cannot be null" );
- return this;
- }
-
- public VersionResult resolveVersion( RepositorySystemSession session, VersionRequest request )
- throws VersionResolutionException
- {
- RequestTrace trace = RequestTrace.newChild( request.getTrace(), request );
-
- Artifact artifact = request.getArtifact();
-
- String version = artifact.getVersion();
-
- VersionResult result = new VersionResult( request );
-
- Key cacheKey = null;
- RepositoryCache cache = session.getCache();
- if ( cache != null && !ConfigUtils.getBoolean( session, false, "aether.versionResolver.noCache" ) )
- {
- cacheKey = new Key( session, request );
-
- Object obj = cache.get( session, cacheKey );
- if ( obj instanceof Record )
- {
- Record record = (Record) obj;
- result.setVersion( record.version );
- result.setRepository(
- CacheUtils.getRepository( session, request.getRepositories(), record.repoClass, record.repoId ) );
- return result;
- }
- }
-
- Metadata metadata;
-
- if ( RELEASE.equals( version ) )
- {
- metadata = new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), MAVEN_METADATA_XML,
- Metadata.Nature.RELEASE );
- }
- else if ( LATEST.equals( version ) )
- {
- metadata = new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), MAVEN_METADATA_XML,
- Metadata.Nature.RELEASE_OR_SNAPSHOT );
- }
- else if ( version.endsWith( SNAPSHOT ) )
- {
- WorkspaceReader workspace = session.getWorkspaceReader();
- if ( workspace != null && workspace.findVersions( artifact ).contains( version ) )
- {
- metadata = null;
- result.setRepository( workspace.getRepository() );
- }
- else
- {
- metadata =
- new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), version, MAVEN_METADATA_XML,
- Metadata.Nature.SNAPSHOT );
- }
- }
- else
- {
- metadata = null;
- }
-
- if ( metadata == null )
- {
- result.setVersion( version );
- }
- else
- {
- List<MetadataRequest> metadataReqs = new ArrayList<>( request.getRepositories().size() );
-
- metadataReqs.add( new MetadataRequest( metadata, null, request.getRequestContext() ) );
-
- for ( RemoteRepository repository : request.getRepositories() )
- {
- MetadataRequest metadataRequest =
- new MetadataRequest( metadata, repository, request.getRequestContext() );
- metadataRequest.setDeleteLocalCopyIfMissing( true );
- metadataRequest.setFavorLocalRepository( true );
- metadataRequest.setTrace( trace );
- metadataReqs.add( metadataRequest );
- }
-
- List<MetadataResult> metadataResults = metadataResolver.resolveMetadata( session, metadataReqs );
-
- Map<String, VersionInfo> infos = new HashMap<>();
-
- for ( MetadataResult metadataResult : metadataResults )
- {
- result.addException( metadataResult.getException() );
-
- ArtifactRepository repository = metadataResult.getRequest().getRepository();
- if ( repository == null )
- {
- repository = session.getLocalRepository();
- }
-
- Versioning v = readVersions( session, trace, metadataResult.getMetadata(), repository, result );
- merge( artifact, infos, v, repository );
- }
-
- if ( RELEASE.equals( version ) )
- {
- resolve( result, infos, RELEASE );
- }
- else if ( LATEST.equals( version ) )
- {
- if ( !resolve( result, infos, LATEST ) )
- {
- resolve( result, infos, RELEASE );
- }
-
- if ( result.getVersion() != null && result.getVersion().endsWith( SNAPSHOT ) )
- {
- VersionRequest subRequest = new VersionRequest();
- subRequest.setArtifact( artifact.setVersion( result.getVersion() ) );
- if ( result.getRepository() instanceof RemoteRepository )
- {
- RemoteRepository r = (RemoteRepository) result.getRepository();
- subRequest.setRepositories( Collections.singletonList( r ) );
- }
- else
- {
- subRequest.setRepositories( request.getRepositories() );
- }
- VersionResult subResult = resolveVersion( session, subRequest );
- result.setVersion( subResult.getVersion() );
- result.setRepository( subResult.getRepository() );
- for ( Exception exception : subResult.getExceptions() )
- {
- result.addException( exception );
- }
- }
- }
- else
- {
- String key = SNAPSHOT + getKey( artifact.getClassifier(), artifact.getExtension() );
- merge( infos, SNAPSHOT, key );
- if ( !resolve( result, infos, key ) )
- {
- result.setVersion( version );
- }
- }
-
- if ( StringUtils.isEmpty( result.getVersion() ) )
- {
- throw new VersionResolutionException( result );
- }
- }
-
- if ( cacheKey != null && metadata != null && isSafelyCacheable( session, artifact ) )
- {
- cache.put( session, cacheKey, new Record( result.getVersion(), result.getRepository() ) );
- }
-
- return result;
- }
-
- private boolean resolve( VersionResult result, Map<String, VersionInfo> infos, String key )
- {
- VersionInfo info = infos.get( key );
- if ( info != null )
- {
- result.setVersion( info.version );
- result.setRepository( info.repository );
- }
- return info != null;
- }
-
- private Versioning readVersions( RepositorySystemSession session, RequestTrace trace, Metadata metadata,
- ArtifactRepository repository, VersionResult result )
- {
- Versioning versioning = null;
-
- FileInputStream fis = null;
- try
- {
- if ( metadata != null )
- {
-
- try ( SyncContext syncContext = syncContextFactory.newInstance( session, true ) )
- {
- syncContext.acquire( null, Collections.singleton( metadata ) );
-
- if ( metadata.getFile() != null && metadata.getFile().exists() )
- {
- fis = new FileInputStream( metadata.getFile() );
- org.apache.maven.artifact.repository.metadata.Metadata m =
- new MetadataXpp3Reader().read( fis, false );
- versioning = m.getVersioning();
-
- /*
- * NOTE: Users occasionally misuse the id "local" for remote repos which screws up the metadata
- * of the local repository. This is especially troublesome during snapshot resolution so we try
- * to handle that gracefully.
- */
- if ( versioning != null && repository instanceof LocalRepository )
- {
- if ( versioning.getSnapshot() != null && versioning.getSnapshot().getBuildNumber() > 0 )
- {
- Versioning repaired = new Versioning();
- repaired.setLastUpdated( versioning.getLastUpdated() );
- Snapshot snapshot = new Snapshot();
- snapshot.setLocalCopy( true );
- repaired.setSnapshot( snapshot );
- versioning = repaired;
-
- throw new IOException( "Snapshot information corrupted with remote repository data"
- + ", please verify that no remote repository uses the id '"
- + repository.getId() + "'" );
- }
- }
- }
- }
- }
- }
- catch ( Exception e )
- {
- invalidMetadata( session, trace, metadata, repository, e );
- result.addException( e );
- }
- finally
- {
- IOUtil.close( fis );
- }
-
- return ( versioning != null ) ? versioning : new Versioning();
- }
-
- private void invalidMetadata( RepositorySystemSession session, RequestTrace trace, Metadata metadata,
- ArtifactRepository repository, Exception exception )
- {
- RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.METADATA_INVALID );
- event.setTrace( trace );
- event.setMetadata( metadata );
- event.setException( exception );
- event.setRepository( repository );
-
- repositoryEventDispatcher.dispatch( event.build() );
- }
-
- private void merge( Artifact artifact, Map<String, VersionInfo> infos, Versioning versioning,
- ArtifactRepository repository )
- {
- if ( StringUtils.isNotEmpty( versioning.getRelease() ) )
- {
- merge( RELEASE, infos, versioning.getLastUpdated(), versioning.getRelease(), repository );
- }
-
- if ( StringUtils.isNotEmpty( versioning.getLatest() ) )
- {
- merge( LATEST, infos, versioning.getLastUpdated(), versioning.getLatest(), repository );
- }
-
- for ( SnapshotVersion sv : versioning.getSnapshotVersions() )
- {
- if ( StringUtils.isNotEmpty( sv.getVersion() ) )
- {
- String key = getKey( sv.getClassifier(), sv.getExtension() );
- merge( SNAPSHOT + key, infos, sv.getUpdated(), sv.getVersion(), repository );
- }
- }
-
- Snapshot snapshot = versioning.getSnapshot();
- if ( snapshot != null && versioning.getSnapshotVersions().isEmpty() )
- {
- String version = artifact.getVersion();
- if ( snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0 )
- {
- String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber();
- version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
- }
- merge( SNAPSHOT, infos, versioning.getLastUpdated(), version, repository );
- }
- }
-
- private void merge( String key, Map<String, VersionInfo> infos, String timestamp, String version,
- ArtifactRepository repository )
- {
- VersionInfo info = infos.get( key );
- if ( info == null )
- {
- info = new VersionInfo( timestamp, version, repository );
- infos.put( key, info );
- }
- else if ( info.isOutdated( timestamp ) )
- {
- info.version = version;
- info.repository = repository;
- info.timestamp = timestamp;
- }
- }
-
- private void merge( Map<String, VersionInfo> infos, String srcKey, String dstKey )
- {
- VersionInfo srcInfo = infos.get( srcKey );
- VersionInfo dstInfo = infos.get( dstKey );
-
- if ( dstInfo == null || ( srcInfo != null && dstInfo.isOutdated( srcInfo.timestamp )
- && srcInfo.repository != dstInfo.repository ) )
- {
- infos.put( dstKey, srcInfo );
- }
- }
-
- private String getKey( String classifier, String extension )
- {
- return StringUtils.clean( classifier ) + ':' + StringUtils.clean( extension );
- }
-
- private boolean isSafelyCacheable( RepositorySystemSession session, Artifact artifact )
- {
- /*
- * The workspace/reactor is in flux so we better not assume definitive information for any of its
- * artifacts/projects.
- */
-
- WorkspaceReader workspace = session.getWorkspaceReader();
- if ( workspace == null )
- {
- return true;
- }
-
- Artifact pomArtifact = ArtifactDescriptorUtils.toPomArtifact( artifact );
-
- return workspace.findArtifact( pomArtifact ) == null;
- }
-
- private static class VersionInfo
- {
-
- String timestamp;
-
- String version;
-
- ArtifactRepository repository;
-
- public VersionInfo( String timestamp, String version, ArtifactRepository repository )
- {
- this.timestamp = ( timestamp != null ) ? timestamp : "";
- this.version = version;
- this.repository = repository;
- }
-
- public boolean isOutdated( String timestamp )
- {
- return timestamp != null && timestamp.compareTo( this.timestamp ) > 0;
- }
-
- }
-
- private static class Key
- {
-
- private final String groupId;
-
- private final String artifactId;
-
- private final String classifier;
-
- private final String extension;
-
- private final String version;
-
- private final String context;
-
- private final File localRepo;
-
- private final WorkspaceRepository workspace;
-
- private final List<RemoteRepository> repositories;
-
- private final int hashCode;
-
- public Key( RepositorySystemSession session, VersionRequest request )
- {
- Artifact artifact = request.getArtifact();
- groupId = artifact.getGroupId();
- artifactId = artifact.getArtifactId();
- classifier = artifact.getClassifier();
- extension = artifact.getExtension();
- version = artifact.getVersion();
- localRepo = session.getLocalRepository().getBasedir();
- workspace = CacheUtils.getWorkspace( session );
- repositories = new ArrayList<>( request.getRepositories().size() );
- boolean repoMan = false;
- for ( RemoteRepository repository : request.getRepositories() )
- {
- if ( repository.isRepositoryManager() )
- {
- repoMan = true;
- repositories.addAll( repository.getMirroredRepositories() );
- }
- else
- {
- repositories.add( repository );
- }
- }
- context = repoMan ? request.getRequestContext() : "";
-
- int hash = 17;
- hash = hash * 31 + groupId.hashCode();
- hash = hash * 31 + artifactId.hashCode();
- hash = hash * 31 + classifier.hashCode();
- hash = hash * 31 + extension.hashCode();
- hash = hash * 31 + version.hashCode();
- hash = hash * 31 + localRepo.hashCode();
- hash = hash * 31 + CacheUtils.repositoriesHashCode( repositories );
- hashCode = hash;
- }
-
- @Override
- public boolean equals( Object obj )
- {
- if ( obj == this )
- {
- return true;
- }
- else if ( obj == null || !getClass().equals( obj.getClass() ) )
- {
- return false;
- }
-
- Key that = (Key) obj;
- return artifactId.equals( that.artifactId ) && groupId.equals( that.groupId ) && classifier.equals(
- that.classifier ) && extension.equals( that.extension ) && version.equals( that.version )
- && context.equals( that.context ) && localRepo.equals( that.localRepo )
- && CacheUtils.eq( workspace, that.workspace )
- && CacheUtils.repositoriesEquals( repositories, that.repositories );
- }
-
- @Override
- public int hashCode()
- {
- return hashCode;
- }
-
- }
-
- private static class Record
- {
- final String version;
-
- final String repoId;
-
- final Class<?> repoClass;
-
- public Record( String version, ArtifactRepository repository )
- {
- this.version = version;
- if ( repository != null )
- {
- repoId = repository.getId();
- repoClass = repository.getClass();
- }
- else
- {
- repoId = null;
- repoClass = null;
- }
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java
deleted file mode 100644
index a572010..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.artifact.repository.metadata.Snapshot;
-import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
-import org.apache.maven.artifact.repository.metadata.Versioning;
-import org.eclipse.aether.artifact.Artifact;
-
-/**
- * @author Benjamin Bentmann
- */
-final class LocalSnapshotMetadata
- extends MavenMetadata
-{
-
- private final Collection<Artifact> artifacts = new ArrayList<>();
-
- private final boolean legacyFormat;
-
- public LocalSnapshotMetadata( Artifact artifact, boolean legacyFormat )
- {
- super( createMetadata( artifact, legacyFormat ), null );
- this.legacyFormat = legacyFormat;
- }
-
- public LocalSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
- {
- super( metadata, file );
- this.legacyFormat = legacyFormat;
- }
-
- private static Metadata createMetadata( Artifact artifact, boolean legacyFormat )
- {
- Snapshot snapshot = new Snapshot();
- snapshot.setLocalCopy( true );
- Versioning versioning = new Versioning();
- versioning.setSnapshot( snapshot );
-
- Metadata metadata = new Metadata();
- metadata.setVersioning( versioning );
- metadata.setGroupId( artifact.getGroupId() );
- metadata.setArtifactId( artifact.getArtifactId() );
- metadata.setVersion( artifact.getBaseVersion() );
-
- if ( !legacyFormat )
- {
- metadata.setModelVersion( "1.1.0" );
- }
-
- return metadata;
- }
-
- public void bind( Artifact artifact )
- {
- artifacts.add( artifact );
- }
-
- public MavenMetadata setFile( File file )
- {
- return new LocalSnapshotMetadata( metadata, file, legacyFormat );
- }
-
- public Object getKey()
- {
- return getGroupId() + ':' + getArtifactId() + ':' + getVersion();
- }
-
- public static Object getKey( Artifact artifact )
- {
- return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion();
- }
-
- @Override
- protected void merge( Metadata recessive )
- {
- metadata.getVersioning().updateTimestamp();
-
- if ( !legacyFormat )
- {
- String lastUpdated = metadata.getVersioning().getLastUpdated();
-
- Map<String, SnapshotVersion> versions = new LinkedHashMap<>();
-
- for ( Artifact artifact : artifacts )
- {
- SnapshotVersion sv = new SnapshotVersion();
- sv.setClassifier( artifact.getClassifier() );
- sv.setExtension( artifact.getExtension() );
- sv.setVersion( getVersion() );
- sv.setUpdated( lastUpdated );
- versions.put( getKey( sv.getClassifier(), sv.getExtension() ), sv );
- }
-
- Versioning versioning = recessive.getVersioning();
- if ( versioning != null )
- {
- for ( SnapshotVersion sv : versioning.getSnapshotVersions() )
- {
- String key = getKey( sv.getClassifier(), sv.getExtension() );
- if ( !versions.containsKey( key ) )
- {
- versions.put( key, sv );
- }
- }
- }
-
- metadata.getVersioning().setSnapshotVersions( new ArrayList<>( versions.values() ) );
- }
-
- artifacts.clear();
- }
-
- private String getKey( String classifier, String extension )
- {
- return classifier + ':' + extension;
- }
-
- public String getGroupId()
- {
- return metadata.getGroupId();
- }
-
- public String getArtifactId()
- {
- return metadata.getArtifactId();
- }
-
- public String getVersion()
- {
- return metadata.getVersion();
- }
-
- public Nature getNature()
- {
- return Nature.SNAPSHOT;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadataGenerator.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadataGenerator.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadataGenerator.java
deleted file mode 100644
index 072ba66..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadataGenerator.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.impl.MetadataGenerator;
-import org.eclipse.aether.installation.InstallRequest;
-import org.eclipse.aether.metadata.Metadata;
-import org.eclipse.aether.util.ConfigUtils;
-
-/**
- * @author Benjamin Bentmann
- */
-class LocalSnapshotMetadataGenerator
- implements MetadataGenerator
-{
-
- private Map<Object, LocalSnapshotMetadata> snapshots;
-
- private final boolean legacyFormat;
-
- public LocalSnapshotMetadataGenerator( RepositorySystemSession session, InstallRequest request )
- {
- legacyFormat = ConfigUtils.getBoolean( session.getConfigProperties(), false, "maven.metadata.legacy" );
-
- snapshots = new LinkedHashMap<>();
- }
-
- public Collection<? extends Metadata> prepare( Collection<? extends Artifact> artifacts )
- {
- for ( Artifact artifact : artifacts )
- {
- if ( artifact.isSnapshot() )
- {
- Object key = LocalSnapshotMetadata.getKey( artifact );
- LocalSnapshotMetadata snapshotMetadata = snapshots.get( key );
- if ( snapshotMetadata == null )
- {
- snapshotMetadata = new LocalSnapshotMetadata( artifact, legacyFormat );
- snapshots.put( key, snapshotMetadata );
- }
- snapshotMetadata.bind( artifact );
- }
- }
-
- return Collections.emptyList();
- }
-
- public Artifact transformArtifact( Artifact artifact )
- {
- return artifact;
- }
-
- public Collection<? extends Metadata> finish( Collection<? extends Artifact> artifacts )
- {
- return snapshots.values();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java
deleted file mode 100644
index 1c9acd7..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.model.building.DefaultModelBuilderFactory;
-import org.apache.maven.model.building.ModelBuilder;
-import org.eclipse.aether.impl.AetherModule;
-import org.eclipse.aether.impl.ArtifactDescriptorReader;
-import org.eclipse.aether.impl.MetadataGeneratorFactory;
-import org.eclipse.aether.impl.VersionRangeResolver;
-import org.eclipse.aether.impl.VersionResolver;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.name.Names;
-
-public final class MavenAetherModule
- extends AbstractModule
-{
-
- @Override
- protected void configure()
- {
- install( new AetherModule() );
- bind( ArtifactDescriptorReader.class ) //
- .to( DefaultArtifactDescriptorReader.class ).in( Singleton.class );
- bind( VersionResolver.class ) //
- .to( DefaultVersionResolver.class ).in( Singleton.class );
- bind( VersionRangeResolver.class ) //
- .to( DefaultVersionRangeResolver.class ).in( Singleton.class );
- bind( MetadataGeneratorFactory.class ).annotatedWith( Names.named( "snapshot" ) ) //
- .to( SnapshotMetadataGeneratorFactory.class ).in( Singleton.class );
- bind( MetadataGeneratorFactory.class ).annotatedWith( Names.named( "versions" ) ) //
- .to( VersionsMetadataGeneratorFactory.class ).in( Singleton.class );
- bind( ModelBuilder.class ) //
- .toInstance( new DefaultModelBuilderFactory().newInstance() );
- }
-
- @Provides
- @Singleton
- Set<MetadataGeneratorFactory> provideMetadataGeneratorFactories( @Named( "snapshot" )
- MetadataGeneratorFactory snapshot,
- @Named( "versions" )
- MetadataGeneratorFactory versions )
- {
- Set<MetadataGeneratorFactory> factories = new HashSet<>();
- factories.add( snapshot );
- factories.add( versions );
- return Collections.unmodifiableSet( factories );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java
deleted file mode 100644
index aef44f6..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.artifact.repository.metadata.Metadata;
-import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
-import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer;
-import org.codehaus.plexus.util.ReaderFactory;
-import org.codehaus.plexus.util.WriterFactory;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.eclipse.aether.RepositoryException;
-import org.eclipse.aether.metadata.AbstractMetadata;
-import org.eclipse.aether.metadata.MergeableMetadata;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * @author Benjamin Bentmann
- */
-abstract class MavenMetadata
- extends AbstractMetadata
- implements MergeableMetadata
-{
-
- static final String MAVEN_METADATA_XML = "maven-metadata.xml";
-
- private final File file;
-
- protected Metadata metadata;
-
- private boolean merged;
-
- protected MavenMetadata( Metadata metadata, File file )
- {
- this.metadata = metadata;
- this.file = file;
- }
-
- public String getType()
- {
- return MAVEN_METADATA_XML;
- }
-
- public File getFile()
- {
- return file;
- }
-
- public void merge( File existing, File result )
- throws RepositoryException
- {
- Metadata recessive = read( existing );
-
- merge( recessive );
-
- write( result, metadata );
-
- merged = true;
- }
-
- public boolean isMerged()
- {
- return merged;
- }
-
- protected abstract void merge( Metadata recessive );
-
- static Metadata read( File metadataFile )
- throws RepositoryException
- {
- if ( metadataFile.length() <= 0 )
- {
- return new Metadata();
- }
-
- try ( Reader reader = ReaderFactory.newXmlReader( metadataFile ) )
- {
- return new MetadataXpp3Reader().read( reader, false );
- }
- catch ( IOException e )
- {
- throw new RepositoryException( "Could not read metadata " + metadataFile + ": " + e.getMessage(), e );
- }
- catch ( XmlPullParserException e )
- {
- throw new RepositoryException( "Could not parse metadata " + metadataFile + ": " + e.getMessage(), e );
- }
- }
-
- private void write( File metadataFile, Metadata metadata )
- throws RepositoryException
- {
- metadataFile.getParentFile().mkdirs();
- try ( Writer writer = WriterFactory.newXmlWriter( metadataFile ) )
- {
- new MetadataXpp3Writer().write( writer, metadata );
- }
- catch ( IOException e )
- {
- throw new RepositoryException( "Could not write metadata " + metadataFile + ": " + e.getMessage(), e );
- }
- }
-
- public Map<String, String> getProperties()
- {
- return Collections.emptyMap();
- }
-
- @Override
- public org.eclipse.aether.metadata.Metadata setProperties( Map<String, String> properties )
- {
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
deleted file mode 100644
index 1b11cb3..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.Properties;
-
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.artifact.DefaultArtifactType;
-import org.eclipse.aether.collection.DependencyGraphTransformer;
-import org.eclipse.aether.collection.DependencyManager;
-import org.eclipse.aether.collection.DependencySelector;
-import org.eclipse.aether.collection.DependencyTraverser;
-import org.eclipse.aether.impl.ArtifactDescriptorReader;
-import org.eclipse.aether.impl.DefaultServiceLocator;
-import org.eclipse.aether.impl.MetadataGeneratorFactory;
-import org.eclipse.aether.impl.VersionRangeResolver;
-import org.eclipse.aether.impl.VersionResolver;
-import org.eclipse.aether.util.artifact.DefaultArtifactTypeRegistry;
-import org.eclipse.aether.util.graph.manager.ClassicDependencyManager;
-import org.eclipse.aether.util.graph.selector.AndDependencySelector;
-import org.eclipse.aether.util.graph.selector.ExclusionDependencySelector;
-import org.eclipse.aether.util.graph.selector.OptionalDependencySelector;
-import org.eclipse.aether.util.graph.selector.ScopeDependencySelector;
-import org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
-import org.eclipse.aether.util.graph.transformer.ConflictResolver;
-import org.eclipse.aether.util.graph.transformer.JavaDependencyContextRefiner;
-import org.eclipse.aether.util.graph.transformer.JavaScopeDeriver;
-import org.eclipse.aether.util.graph.transformer.JavaScopeSelector;
-import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
-import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
-import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
-import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
-
-/**
- * A utility class to assist in setting up a Maven-like repository system. <em>Note:</em> This component is meant to
- * assist those clients that employ the repository system outside of an IoC container, Maven plugins should instead
- * always use regular dependency injection to acquire the repository system.
- *
- * @author Benjamin Bentmann
- */
-public final class MavenRepositorySystemUtils
-{
-
- private MavenRepositorySystemUtils()
- {
- // hide constructor
- }
-
- /**
- * Creates a new service locator that already knows about all service implementations included in this library. To
- * acquire a complete repository system, clients need to add some repository connectors for remote transfers.
- *
- * @return The new service locator, never {@code null}.
- */
- public static DefaultServiceLocator newServiceLocator()
- {
- DefaultServiceLocator locator = new DefaultServiceLocator();
- locator.addService( ArtifactDescriptorReader.class, DefaultArtifactDescriptorReader.class );
- locator.addService( VersionResolver.class, DefaultVersionResolver.class );
- locator.addService( VersionRangeResolver.class, DefaultVersionRangeResolver.class );
- locator.addService( MetadataGeneratorFactory.class, SnapshotMetadataGeneratorFactory.class );
- locator.addService( MetadataGeneratorFactory.class, VersionsMetadataGeneratorFactory.class );
- return locator;
- }
-
- /**
- * Creates a new Maven-like repository system session by initializing the session with values typical for
- * Maven-based resolution. In more detail, this method configures settings relevant for the processing of dependency
- * graphs, most other settings remain at their generic default value. Use the various setters to further configure
- * the session with authentication, mirror, proxy and other information required for your environment.
- *
- * @return The new repository system session, never {@code null}.
- */
- public static DefaultRepositorySystemSession newSession()
- {
- DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
-
- DependencyTraverser depTraverser = new FatArtifactTraverser();
- session.setDependencyTraverser( depTraverser );
-
- DependencyManager depManager = new ClassicDependencyManager();
- session.setDependencyManager( depManager );
-
- DependencySelector depFilter =
- new AndDependencySelector( new ScopeDependencySelector( "test", "provided" ),
- new OptionalDependencySelector(), new ExclusionDependencySelector() );
- session.setDependencySelector( depFilter );
-
- DependencyGraphTransformer transformer =
- new ConflictResolver( new NearestVersionSelector(), new JavaScopeSelector(),
- new SimpleOptionalitySelector(), new JavaScopeDeriver() );
- new ChainedDependencyGraphTransformer( transformer, new JavaDependencyContextRefiner() );
- session.setDependencyGraphTransformer( transformer );
-
- DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry();
- stereotypes.add( new DefaultArtifactType( "pom" ) );
- stereotypes.add( new DefaultArtifactType( "maven-plugin", "jar", "", "java" ) );
- stereotypes.add( new DefaultArtifactType( "jar", "jar", "", "java" ) );
- stereotypes.add( new DefaultArtifactType( "ejb", "jar", "", "java" ) );
- stereotypes.add( new DefaultArtifactType( "ejb-client", "jar", "client", "java" ) );
- stereotypes.add( new DefaultArtifactType( "test-jar", "jar", "tests", "java" ) );
- stereotypes.add( new DefaultArtifactType( "javadoc", "jar", "javadoc", "java" ) );
- stereotypes.add( new DefaultArtifactType( "java-source", "jar", "sources", "java", false, false ) );
- stereotypes.add( new DefaultArtifactType( "war", "war", "", "java", false, true ) );
- stereotypes.add( new DefaultArtifactType( "ear", "ear", "", "java", false, true ) );
- stereotypes.add( new DefaultArtifactType( "rar", "rar", "", "java", false, true ) );
- stereotypes.add( new DefaultArtifactType( "par", "par", "", "java", false, true ) );
- session.setArtifactTypeRegistry( stereotypes );
-
- session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) );
-
- final Properties systemProperties = new Properties();
-
- // MNG-5670 guard against ConcurrentModificationException
- // MNG-6053 guard against key without value
- Properties sysProp = System.getProperties();
- synchronized ( sysProp )
- {
- systemProperties.putAll( sysProp );
- }
-
- session.setSystemProperties( systemProperties );
- session.setConfigProperties( systemProperties );
-
- return session;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenSnapshotMetadata.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenSnapshotMetadata.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenSnapshotMetadata.java
deleted file mode 100644
index e4c9a7e..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenSnapshotMetadata.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.ArrayList;
-import java.util.Collection;
-
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.eclipse.aether.artifact.Artifact;
-
-/**
- * @author Herv� Boutemy
- */
-abstract class MavenSnapshotMetadata
- extends MavenMetadata
-{
- static final String SNAPSHOT = "SNAPSHOT";
-
- protected final Collection<Artifact> artifacts = new ArrayList<>();
-
- protected final boolean legacyFormat;
-
- protected MavenSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
- {
- super( metadata, file );
- this.legacyFormat = legacyFormat;
- }
-
- protected static Metadata createRepositoryMetadata( Artifact artifact, boolean legacyFormat )
- {
- Metadata metadata = new Metadata();
- if ( !legacyFormat )
- {
- metadata.setModelVersion( "1.1.0" );
- }
- metadata.setGroupId( artifact.getGroupId() );
- metadata.setArtifactId( artifact.getArtifactId() );
- metadata.setVersion( artifact.getBaseVersion() );
-
- return metadata;
- }
-
- public void bind( Artifact artifact )
- {
- artifacts.add( artifact );
- }
-
- public Object getKey()
- {
- return getGroupId() + ':' + getArtifactId() + ':' + getVersion();
- }
-
- public static Object getKey( Artifact artifact )
- {
- return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion();
- }
-
- protected String getKey( String classifier, String extension )
- {
- return classifier + ':' + extension;
- }
-
- public String getGroupId()
- {
- return metadata.getGroupId();
- }
-
- public String getArtifactId()
- {
- return metadata.getArtifactId();
- }
-
- public String getVersion()
- {
- return metadata.getVersion();
- }
-
- public Nature getNature()
- {
- return Nature.SNAPSHOT;
- }
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenWorkspaceReader.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenWorkspaceReader.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenWorkspaceReader.java
deleted file mode 100644
index 270cf58..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenWorkspaceReader.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.model.Model;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.repository.WorkspaceReader;
-
-public interface MavenWorkspaceReader
- extends WorkspaceReader
-{
-
- Model findModel( Artifact artifact );
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java
deleted file mode 100644
index c6ef3aa..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.Map;
-
-import org.apache.commons.lang3.Validate;
-import org.eclipse.aether.artifact.AbstractArtifact;
-import org.eclipse.aether.artifact.Artifact;
-
-/**
- * @author Benjamin Bentmann
- */
-final class RelocatedArtifact
- extends AbstractArtifact
-{
-
- private final Artifact artifact;
-
- private final String groupId;
-
- private final String artifactId;
-
- private final String version;
-
- public RelocatedArtifact( Artifact artifact, String groupId, String artifactId, String version )
- {
- this.artifact = Validate.notNull( artifact, "artifact cannot be null" );
- // TODO Use StringUtils here
- this.groupId = ( groupId != null && groupId.length() > 0 ) ? groupId : null;
- this.artifactId = ( artifactId != null && artifactId.length() > 0 ) ? artifactId : null;
- this.version = ( version != null && version.length() > 0 ) ? version : null;
- }
-
- public String getGroupId()
- {
- if ( groupId != null )
- {
- return groupId;
- }
- else
- {
- return artifact.getGroupId();
- }
- }
-
- public String getArtifactId()
- {
- if ( artifactId != null )
- {
- return artifactId;
- }
- else
- {
- return artifact.getArtifactId();
- }
- }
-
- public String getVersion()
- {
- if ( version != null )
- {
- return version;
- }
- else
- {
- return artifact.getVersion();
- }
- }
-
- public String getClassifier()
- {
- return artifact.getClassifier();
- }
-
- public String getExtension()
- {
- return artifact.getExtension();
- }
-
- public File getFile()
- {
- return artifact.getFile();
- }
-
- public String getProperty( String key, String defaultValue )
- {
- return artifact.getProperty( key, defaultValue );
- }
-
- public Map<String, String> getProperties()
- {
- return artifact.getProperties();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java
deleted file mode 100644
index 1e791d8..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.TimeZone;
-
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.artifact.repository.metadata.Snapshot;
-import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
-import org.apache.maven.artifact.repository.metadata.Versioning;
-import org.eclipse.aether.artifact.Artifact;
-
-/**
- * @author Benjamin Bentmann
- */
-final class RemoteSnapshotMetadata
- extends MavenSnapshotMetadata
-{
- public static final String DEFAULT_SNAPSHOT_TIMESTAMP_FORMAT = "yyyyMMdd.HHmmss";
-
- public static final TimeZone DEFAULT_SNAPSHOT_TIME_ZONE = TimeZone.getTimeZone( "Etc/UTC" );
-
- private final Map<String, SnapshotVersion> versions = new LinkedHashMap<>();
-
- public RemoteSnapshotMetadata( Artifact artifact, boolean legacyFormat )
- {
- super( createRepositoryMetadata( artifact, legacyFormat ), null, legacyFormat );
- }
-
- private RemoteSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
- {
- super( metadata, file, legacyFormat );
- }
-
- public MavenMetadata setFile( File file )
- {
- return new RemoteSnapshotMetadata( metadata, file, legacyFormat );
- }
-
- public String getExpandedVersion( Artifact artifact )
- {
- String key = getKey( artifact.getClassifier(), artifact.getExtension() );
- return versions.get( key ).getVersion();
- }
-
- @Override
- protected void merge( Metadata recessive )
- {
- Snapshot snapshot;
- String lastUpdated;
-
- if ( metadata.getVersioning() == null )
- {
- DateFormat utcDateFormatter = new SimpleDateFormat( DEFAULT_SNAPSHOT_TIMESTAMP_FORMAT );
- utcDateFormatter.setCalendar( new GregorianCalendar() );
- utcDateFormatter.setTimeZone( DEFAULT_SNAPSHOT_TIME_ZONE );
-
- snapshot = new Snapshot();
- snapshot.setBuildNumber( getBuildNumber( recessive ) + 1 );
- snapshot.setTimestamp( utcDateFormatter.format( new Date() ) );
-
- Versioning versioning = new Versioning();
- versioning.setSnapshot( snapshot );
- versioning.setLastUpdated( snapshot.getTimestamp().replace( ".", "" ) );
- lastUpdated = versioning.getLastUpdated();
-
- metadata.setVersioning( versioning );
- }
- else
- {
- snapshot = metadata.getVersioning().getSnapshot();
- lastUpdated = metadata.getVersioning().getLastUpdated();
- }
-
- for ( Artifact artifact : artifacts )
- {
- String version = artifact.getVersion();
-
- if ( version.endsWith( SNAPSHOT ) )
- {
- String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber();
- version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
- }
-
- SnapshotVersion sv = new SnapshotVersion();
- sv.setClassifier( artifact.getClassifier() );
- sv.setExtension( artifact.getExtension() );
- sv.setVersion( version );
- sv.setUpdated( lastUpdated );
-
- versions.put( getKey( sv.getClassifier(), sv.getExtension() ), sv );
- }
-
- artifacts.clear();
-
- Versioning versioning = recessive.getVersioning();
- if ( versioning != null )
- {
- for ( SnapshotVersion sv : versioning.getSnapshotVersions() )
- {
- String key = getKey( sv.getClassifier(), sv.getExtension() );
- if ( !versions.containsKey( key ) )
- {
- versions.put( key, sv );
- }
- }
- }
-
- if ( !legacyFormat )
- {
- metadata.getVersioning().setSnapshotVersions( new ArrayList<>( versions.values() ) );
- }
- }
-
- private static int getBuildNumber( Metadata metadata )
- {
- int number = 0;
-
- Versioning versioning = metadata.getVersioning();
- if ( versioning != null )
- {
- Snapshot snapshot = versioning.getSnapshot();
- if ( snapshot != null && snapshot.getBuildNumber() > 0 )
- {
- number = snapshot.getBuildNumber();
- }
- }
-
- return number;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java
deleted file mode 100644
index 8258966..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.deployment.DeployRequest;
-import org.eclipse.aether.impl.MetadataGenerator;
-import org.eclipse.aether.metadata.Metadata;
-import org.eclipse.aether.util.ConfigUtils;
-
-/**
- * @author Benjamin Bentmann
- */
-class RemoteSnapshotMetadataGenerator
- implements MetadataGenerator
-{
-
- private final Map<Object, RemoteSnapshotMetadata> snapshots;
-
- private final boolean legacyFormat;
-
- public RemoteSnapshotMetadataGenerator( RepositorySystemSession session, DeployRequest request )
- {
- legacyFormat = ConfigUtils.getBoolean( session.getConfigProperties(), false, "maven.metadata.legacy" );
-
- snapshots = new LinkedHashMap<>();
-
- /*
- * NOTE: This should be considered a quirk to support interop with Maven's legacy ArtifactDeployer which
- * processes one artifact at a time and hence cannot associate the artifacts from the same project to use the
- * same timestamp+buildno for the snapshot versions. Allowing the caller to pass in metadata from a previous
- * deployment allows to re-establish the association between the artifacts of the same project.
- */
- for ( Metadata metadata : request.getMetadata() )
- {
- if ( metadata instanceof RemoteSnapshotMetadata )
- {
- RemoteSnapshotMetadata snapshotMetadata = (RemoteSnapshotMetadata) metadata;
- snapshots.put( snapshotMetadata.getKey(), snapshotMetadata );
- }
- }
- }
-
- public Collection<? extends Metadata> prepare( Collection<? extends Artifact> artifacts )
- {
- for ( Artifact artifact : artifacts )
- {
- if ( artifact.isSnapshot() )
- {
- Object key = RemoteSnapshotMetadata.getKey( artifact );
- RemoteSnapshotMetadata snapshotMetadata = snapshots.get( key );
- if ( snapshotMetadata == null )
- {
- snapshotMetadata = new RemoteSnapshotMetadata( artifact, legacyFormat );
- snapshots.put( key, snapshotMetadata );
- }
- snapshotMetadata.bind( artifact );
- }
- }
-
- return snapshots.values();
- }
-
- public Artifact transformArtifact( Artifact artifact )
- {
- if ( artifact.isSnapshot() && artifact.getVersion().equals( artifact.getBaseVersion() ) )
- {
- Object key = RemoteSnapshotMetadata.getKey( artifact );
- RemoteSnapshotMetadata snapshotMetadata = snapshots.get( key );
- if ( snapshotMetadata != null )
- {
- artifact = artifact.setVersion( snapshotMetadata.getExpandedVersion( artifact ) );
- }
- }
-
- return artifact;
- }
-
- public Collection<? extends Metadata> finish( Collection<? extends Artifact> artifacts )
- {
- return Collections.emptyList();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/SnapshotMetadataGeneratorFactory.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/SnapshotMetadataGeneratorFactory.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/SnapshotMetadataGeneratorFactory.java
deleted file mode 100644
index 79ffaad..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/SnapshotMetadataGeneratorFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.component.annotations.Component;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.deployment.DeployRequest;
-import org.eclipse.aether.impl.MetadataGenerator;
-import org.eclipse.aether.impl.MetadataGeneratorFactory;
-import org.eclipse.aether.installation.InstallRequest;
-
-/**
- * @author Benjamin Bentmann
- */
-@Component( role = MetadataGeneratorFactory.class, hint = "snapshot" )
-public class SnapshotMetadataGeneratorFactory
- implements MetadataGeneratorFactory
-{
-
- public MetadataGenerator newInstance( RepositorySystemSession session, InstallRequest request )
- {
- return new LocalSnapshotMetadataGenerator( session, request );
- }
-
- public MetadataGenerator newInstance( RepositorySystemSession session, DeployRequest request )
- {
- return new RemoteSnapshotMetadataGenerator( session, request );
- }
-
- public float getPriority()
- {
- return 10;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java
deleted file mode 100644
index f5e13be..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.artifact.repository.metadata.Versioning;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.ArtifactProperties;
-
-/**
- * @author Benjamin Bentmann
- */
-final class VersionsMetadata
- extends MavenMetadata
-{
-
- private final Artifact artifact;
-
- public VersionsMetadata( Artifact artifact )
- {
- super( createRepositoryMetadata( artifact ), null );
- this.artifact = artifact;
- }
-
- public VersionsMetadata( Artifact artifact, File file )
- {
- super( createRepositoryMetadata( artifact ), file );
- this.artifact = artifact;
- }
-
- private static Metadata createRepositoryMetadata( Artifact artifact )
- {
- Metadata metadata = new Metadata();
- metadata.setGroupId( artifact.getGroupId() );
- metadata.setArtifactId( artifact.getArtifactId() );
-
- Versioning versioning = new Versioning();
- versioning.addVersion( artifact.getBaseVersion() );
- if ( !artifact.isSnapshot() )
- {
- versioning.setRelease( artifact.getBaseVersion() );
- }
- if ( "maven-plugin".equals( artifact.getProperty( ArtifactProperties.TYPE, "" ) ) )
- {
- versioning.setLatest( artifact.getBaseVersion() );
- }
-
- metadata.setVersioning( versioning );
-
- return metadata;
- }
-
- @Override
- protected void merge( Metadata recessive )
- {
- Versioning versioning = metadata.getVersioning();
- versioning.updateTimestamp();
-
- if ( recessive.getVersioning() != null )
- {
- if ( versioning.getLatest() == null )
- {
- versioning.setLatest( recessive.getVersioning().getLatest() );
- }
- if ( versioning.getRelease() == null )
- {
- versioning.setRelease( recessive.getVersioning().getRelease() );
- }
-
- Collection<String> versions = new LinkedHashSet<>( recessive.getVersioning().getVersions() );
- versions.addAll( versioning.getVersions() );
- versioning.setVersions( new ArrayList<>( versions ) );
- }
- }
-
- public Object getKey()
- {
- return getGroupId() + ':' + getArtifactId();
- }
-
- public static Object getKey( Artifact artifact )
- {
- return artifact.getGroupId() + ':' + artifact.getArtifactId();
- }
-
- public MavenMetadata setFile( File file )
- {
- return new VersionsMetadata( artifact, file );
- }
-
- public String getGroupId()
- {
- return artifact.getGroupId();
- }
-
- public String getArtifactId()
- {
- return artifact.getArtifactId();
- }
-
- public String getVersion()
- {
- return "";
- }
-
- public Nature getNature()
- {
- return artifact.isSnapshot() ? Nature.RELEASE_OR_SNAPSHOT : Nature.RELEASE;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGenerator.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGenerator.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGenerator.java
deleted file mode 100644
index 5173001..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGenerator.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.deployment.DeployRequest;
-import org.eclipse.aether.impl.MetadataGenerator;
-import org.eclipse.aether.installation.InstallRequest;
-import org.eclipse.aether.metadata.Metadata;
-
-/**
- * @author Benjamin Bentmann
- */
-class VersionsMetadataGenerator
- implements MetadataGenerator
-{
-
- private Map<Object, VersionsMetadata> versions;
-
- private Map<Object, VersionsMetadata> processedVersions;
-
- public VersionsMetadataGenerator( RepositorySystemSession session, InstallRequest request )
- {
- this( session, request.getMetadata() );
- }
-
- public VersionsMetadataGenerator( RepositorySystemSession session, DeployRequest request )
- {
- this( session, request.getMetadata() );
- }
-
- private VersionsMetadataGenerator( RepositorySystemSession session, Collection<? extends Metadata> metadatas )
- {
- versions = new LinkedHashMap<>();
- processedVersions = new LinkedHashMap<>();
-
- /*
- * NOTE: This should be considered a quirk to support interop with Maven's legacy ArtifactDeployer which
- * processes one artifact at a time and hence cannot associate the artifacts from the same project to use the
- * same version index. Allowing the caller to pass in metadata from a previous deployment allows to re-establish
- * the association between the artifacts of the same project.
- */
- for ( Iterator<? extends Metadata> it = metadatas.iterator(); it.hasNext(); )
- {
- Metadata metadata = it.next();
- if ( metadata instanceof VersionsMetadata )
- {
- it.remove();
- VersionsMetadata versionsMetadata = (VersionsMetadata) metadata;
- processedVersions.put( versionsMetadata.getKey(), versionsMetadata );
- }
- }
- }
-
- public Collection<? extends Metadata> prepare( Collection<? extends Artifact> artifacts )
- {
- return Collections.emptyList();
- }
-
- public Artifact transformArtifact( Artifact artifact )
- {
- return artifact;
- }
-
- public Collection<? extends Metadata> finish( Collection<? extends Artifact> artifacts )
- {
- for ( Artifact artifact : artifacts )
- {
- Object key = VersionsMetadata.getKey( artifact );
- if ( processedVersions.get( key ) == null )
- {
- VersionsMetadata versionsMetadata = versions.get( key );
- if ( versionsMetadata == null )
- {
- versionsMetadata = new VersionsMetadata( artifact );
- versions.put( key, versionsMetadata );
- }
- }
- }
-
- return versions.values();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGeneratorFactory.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGeneratorFactory.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGeneratorFactory.java
deleted file mode 100644
index 47ef360..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadataGeneratorFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.maven.repository.internal;
-
-/*
- * 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.component.annotations.Component;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.deployment.DeployRequest;
-import org.eclipse.aether.impl.MetadataGenerator;
-import org.eclipse.aether.impl.MetadataGeneratorFactory;
-import org.eclipse.aether.installation.InstallRequest;
-
-/**
- * @author Benjamin Bentmann
- */
-@Component( role = MetadataGeneratorFactory.class, hint = "versions" )
-public class VersionsMetadataGeneratorFactory
- implements MetadataGeneratorFactory
-{
-
- public MetadataGenerator newInstance( RepositorySystemSession session, InstallRequest request )
- {
- return new VersionsMetadataGenerator( session, request );
- }
-
- public MetadataGenerator newInstance( RepositorySystemSession session, DeployRequest request )
- {
- return new VersionsMetadataGenerator( session, request );
- }
-
- public float getPriority()
- {
- return 5;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/package-info.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/package-info.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/package-info.java
deleted file mode 100644
index 5582cf7..0000000
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// CHECKSTYLE_OFF: RegexpHeader
-/**
- * <a href="http://www.eclipse.org/aether/">Aether</a> extensions for utilizing the Maven POM and Maven repository
- * metadata.
- */
-package org.apache.maven.repository.internal;
-
-/*
- * 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.
- */
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/site/apt/index.apt b/maven-aether-provider/src/site/apt/index.apt
deleted file mode 100644
index 600ec41..0000000
--- a/maven-aether-provider/src/site/apt/index.apt
+++ /dev/null
@@ -1,33 +0,0 @@
-~~ 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.
-
- -----
- Introduction
- -----
- Herv� Boutemy
- -----
- 2012-09-29
- -----
-
-Maven Aether Provider
-
- Maven Aether Provider is an {{{http://www.eclipse.org/aether/}Aether}} extension to support
- Maven POMs and local+remote repositories.
-
- Main component is <<<MavenRepositorySystemUtils>>>
- ({{{./apidocs/org/apache/maven/repository/internal/MavenRepositorySystemUtils.html}javadoc}},
- {{{./xref/org/apache/maven/repository/internal/MavenRepositorySystemUtils.html}source}}).
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-aether-provider/src/site/site.xml
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/site/site.xml b/maven-aether-provider/src/site/site.xml
deleted file mode 100644
index 3a16bf9..0000000
--- a/maven-aether-provider/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
[9/9] maven git commit: [MNG-5878] added project.directory property
to support module name != artifactId in every calculated URLs
Posted by hb...@apache.org.
[MNG-5878] added project.directory property to support module name !=
artifactId in every calculated URLs
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/9b763cc0
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/9b763cc0
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/9b763cc0
Branch: refs/heads/master
Commit: 9b763cc002e9a4e247baf7538727da5a29a6ce0b
Parents: 1cb2e92
Author: Herv� Boutemy <hb...@apache.org>
Authored: Sat Dec 5 23:44:20 2015 +0100
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Wed Feb 1 08:01:11 2017 +0100
----------------------------------------------------------------------
.../DefaultInheritanceAssembler.java | 66 +++++++++++++++-----
maven-model-builder/src/site/apt/index.apt | 37 ++++++++---
.../DefaultInheritanceAssemblerTest.java | 39 ++++++++++--
.../module-path-not-artifactId-child.xml | 43 +++++++++++++
.../module-path-not-artifactId-expected.xml | 58 +++++++++++++++++
.../module-path-not-artifactId-parent.xml | 48 ++++++++++++++
maven-model/src/main/mdo/maven.mdo | 10 +--
7 files changed, 270 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/9b763cc0/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java
index 6cf4760..8206da9 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java
@@ -19,14 +19,16 @@ package org.apache.maven.model.inheritance;
* under the License.
*/
-import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
+import org.apache.maven.model.InputLocation;
import org.apache.maven.model.Model;
+import org.apache.maven.model.ModelBase;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginContainer;
import org.apache.maven.model.ReportPlugin;
@@ -49,12 +51,18 @@ public class DefaultInheritanceAssembler
private InheritanceModelMerger merger = new InheritanceModelMerger();
+ private static final String CHILD_DIRECTORY = "child-directory";
+
+ private static final String CHILD_DIRECTORY_PROPERTY = "project.directory";
+
@Override
public void assembleModelInheritance( Model child, Model parent, ModelBuildingRequest request,
ModelProblemCollector problems )
{
Map<Object, Object> hints = new HashMap<>();
- hints.put( MavenModelMerger.CHILD_PATH_ADJUSTMENT, getChildPathAdjustment( child, parent ) );
+ String childPath = child.getProperties().getProperty( CHILD_DIRECTORY_PROPERTY, child.getArtifactId() );
+ hints.put( CHILD_DIRECTORY, childPath );
+ hints.put( MavenModelMerger.CHILD_PATH_ADJUSTMENT, getChildPathAdjustment( child, parent, childPath ) );
merger.merge( child, parent, false, hints );
}
@@ -74,9 +82,10 @@ public class DefaultInheritanceAssembler
*
* @param child The child model, must not be <code>null</code>.
* @param parent The parent model, may be <code>null</code>.
+ * @param childDirectory The directory defined in child model, may be <code>null</code>.
* @return The path adjustment, can be empty but never <code>null</code>.
*/
- private String getChildPathAdjustment( Model child, Model parent )
+ private String getChildPathAdjustment( Model child, Model parent, String childDirectory )
{
String adjustment = "";
@@ -91,10 +100,9 @@ public class DefaultInheritanceAssembler
* repository. In other words, modules where artifactId != moduleDirName will see different effective URLs
* depending on how the model was constructed (from filesystem or from repository).
*/
- File childDirectory = child.getProjectDirectory();
- if ( childDirectory != null )
+ if ( child.getProjectDirectory() != null )
{
- childName = childDirectory.getName();
+ childName = child.getProjectDirectory().getName();
}
for ( String module : parent.getModules() )
@@ -116,7 +124,7 @@ public class DefaultInheritanceAssembler
moduleName = moduleName.substring( lastSlash + 1 );
- if ( moduleName.equals( childName ) && lastSlash >= 0 )
+ if ( ( moduleName.equals( childName ) || ( moduleName.equals( childDirectory ) ) ) && lastSlash >= 0 )
{
adjustment = module.substring( 0, lastSlash );
break;
@@ -134,18 +142,16 @@ public class DefaultInheritanceAssembler
@Override
protected String extrapolateChildUrl( String parentUrl, Map<Object, Object> context )
{
- Object artifactId = context.get( ARTIFACT_ID );
+ Object childDirectory = context.get( CHILD_DIRECTORY );
Object childPathAdjustment = context.get( CHILD_PATH_ADJUSTMENT );
- if ( artifactId != null && childPathAdjustment != null && StringUtils.isNotBlank( parentUrl ) )
- {
- // append childPathAdjustment and artifactId to parent url
- return appendPath( parentUrl, artifactId.toString(), childPathAdjustment.toString() );
- }
- else
+ if ( StringUtils.isBlank( parentUrl ) || childDirectory == null || childPathAdjustment == null )
{
return parentUrl;
}
+
+ // append childPathAdjustment and childDirectory to parent url
+ return appendPath( parentUrl, childDirectory.toString(), childPathAdjustment.toString() );
}
private String appendPath( String parentUrl, String childPath, String pathAdjustment )
@@ -192,6 +198,38 @@ public class DefaultInheritanceAssembler
}
@Override
+ protected void mergeModelBase_Properties( ModelBase target, ModelBase source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ Properties merged = new Properties();
+ if ( sourceDominant )
+ {
+ merged.putAll( target.getProperties() );
+ putAll( merged, source.getProperties(), CHILD_DIRECTORY_PROPERTY );
+ }
+ else
+ {
+ putAll( merged, source.getProperties(), CHILD_DIRECTORY_PROPERTY );
+ merged.putAll( target.getProperties() );
+ }
+ target.setProperties( merged );
+ target.setLocation( "properties",
+ InputLocation.merge( target.getLocation( "properties" ),
+ source.getLocation( "properties" ), sourceDominant ) );
+ }
+
+ private void putAll( Map<Object, Object> s, Map<Object, Object> t, Object excludeKey )
+ {
+ for ( Map.Entry<Object, Object> e : t.entrySet() )
+ {
+ if ( !e.getKey().equals( excludeKey ) )
+ {
+ s.put( e.getKey(), e.getValue() );
+ }
+ }
+ }
+
+ @Override
protected void mergePluginContainer_Plugins( PluginContainer target, PluginContainer source,
boolean sourceDominant, Map<Object, Object> context )
{
http://git-wip-us.apache.org/repos/asf/maven/blob/9b763cc0/maven-model-builder/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/site/apt/index.apt b/maven-model-builder/src/site/apt/index.apt
index 9a645f4..03946e6 100644
--- a/maven-model-builder/src/site/apt/index.apt
+++ b/maven-model-builder/src/site/apt/index.apt
@@ -57,14 +57,15 @@ Maven Model Builder
** parent resolution until {{{./super-pom.html}super-pom}}
- ** inheritance assembly: <<<InheritanceAssembler>>> ({{{./apidocs/org/apache/maven/model/inheritance/InheritanceAssembler.html}javadoc}}),
- with its <<<DefaultInheritanceAssembler>>> implementation
- ({{{./xref/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.html}source}}). Notice that
- <<<project.url>>>, <<<project.scm.connection>>>, <<<project.scm.developerConnection>>>, <<<project.scm.url>>> and
- <<<project.distributionManagement.site.url>>> have a special treatment: if not overridden in child, the default value is parent's one
- with child artifact id appended
+ []
+
+ * phase 2, with optional plugin processing
- ** model interpolation (see below)
+ ** dependency management import (for dependencies of type <<<pom>>> in the <<<\<dependencyManagement\>>>> section)
+
+ ** inheritance assembly (see {{{./index.html#Inheritance_Assembly}below}})
+
+ ** model interpolation (see {{{./index.html#Model_Interpolation}below}})
** url normalization: <<<UrlNormalizer>>> ({{{./apidocs/org/apache/maven/model/path/UrlNormalizer.html}javadoc}}),
with its <<<DefaultUrlNormalizer>>> implementation
@@ -117,6 +118,28 @@ Maven Model Builder
[]
+* Inheritance Assembly
+
+ Inheritance Assembly consists in filling current model empty fields with values taken from parent model.
+ It is done in <<<InheritanceAssembler>>> ({{{./apidocs/org/apache/maven/model/inheritance/InheritanceAssembler.html}javadoc}}),
+ with its <<<DefaultInheritanceAssembler>>> implementation
+ ({{{./xref/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.html}source}}).
+
+ By default, every model field is inherited as-is from parent, with a few exceptions that are intentionally not inherited:
+ <<<modelVersion>>>, <<<artifactId>>>, <<<profiles>>> (injected in phase 1) and <<<prerequisites>>>.
+
+ Notice that the 5 URLs from the model (<<<project.url>>>, <<<project.scm.connection>>>, <<<project.scm.developerConnection>>>,
+ <<<project.scm.url>>> and <<<project.distributionManagement.site.url>>>) have a special inheritance handling:
+
+ ** if not configured in current model, the inherited value is the parent's one with current artifact id appended,
+
+ ** since Maven 3.5.0, if <<<project.directory>>> POM property value is defined, it is used instead of artifact id:
+ this permits default inheritance calculations when module directory name is not equal to artifact id. Notice that this
+ property is not inherited from a POM to its child: childs POM will use child artifact id if property is not
+ set.
+
+ []
+
* Model Interpolation
Model Interpolation consists in replacing <<<$\{...\}>>> with calculated value. It is done in <<<StringSearchModelInterpolator>>>
http://git-wip-us.apache.org/repos/asf/maven/blob/9b763cc0/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
index e477fde..96eed6f 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
@@ -35,6 +35,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
+import java.nio.charset.StandardCharsets;
/**
* @author Herv� Boutemy
@@ -112,12 +113,13 @@ public class DefaultInheritanceAssemblerTest
{
// build from disk expected to fail
testInheritance( "tricky-flat-artifactId-urls", false );
- fail( "should have failed since module reference == artifactId != directory name" );
+ //fail( "should have failed since module reference == artifactId != directory name" );
}
catch ( AssertionFailedError afe )
{
// expected failure: wrong relative path calculation
- assertTrue( afe.getMessage().contains( "http://www.apache.org/path/to/parent/child-artifact-id/" ) );
+ assertTrue( afe.getMessage(),
+ afe.getMessage().contains( "http://www.apache.org/path/to/parent/child-artifact-id/" ) );
}
// but ok from repo: local disk is ignored
testInheritance( "tricky-flat-artifactId-urls", true );
@@ -133,7 +135,8 @@ public class DefaultInheritanceAssemblerTest
catch ( AssertionFailedError afe )
{
// expected failure
- assertTrue( afe.getMessage().contains( "http://www.apache.org/path/to/parent/child-artifact-id/" ) );
+ assertTrue( afe.getMessage(),
+ afe.getMessage().contains( "http://www.apache.org/path/to/parent/child-artifact-id/" ) );
}
}
@@ -176,12 +179,38 @@ public class DefaultInheritanceAssemblerTest
// check with getPom( baseName + "-expected" )
File expected = getPom( baseName + "-expected" );
- try ( Reader control = new InputStreamReader( new FileInputStream( expected ), "UTF-8" );
- Reader test = new InputStreamReader( new FileInputStream( actual ), "UTF-8" ) )
+ try ( Reader control = new InputStreamReader( new FileInputStream( expected ), StandardCharsets.UTF_8 );
+ Reader test = new InputStreamReader( new FileInputStream( actual ), StandardCharsets.UTF_8 ) )
{
XMLUnit.setIgnoreComments( true );
XMLUnit.setIgnoreWhitespace( true );
XMLAssert.assertXMLEqual( control, test );
}
}
+
+ public void testModulePathNotArtifactId()
+ throws Exception
+ {
+ Model parent = getModel( "module-path-not-artifactId-parent" );
+
+ Model child = getModel( "module-path-not-artifactId-child" );
+
+ SimpleProblemCollector problems = new SimpleProblemCollector();
+
+ assembler.assembleModelInheritance( child, parent, null, problems );
+
+ File actual = getTestFile( "target/test-classes/poms/inheritance/module-path-not-artifactId-actual.xml" );
+
+ writer.write( actual, null, child );
+
+ // check with getPom( "module-path-not-artifactId-effective" )
+ File expected = getPom( "module-path-not-artifactId-expected" );
+ try ( Reader control = new InputStreamReader( new FileInputStream( expected ), StandardCharsets.UTF_8 );
+ Reader test = new InputStreamReader( new FileInputStream( actual ), StandardCharsets.UTF_8 ) )
+ {
+ XMLUnit.setIgnoreComments( true );
+ XMLUnit.setIgnoreWhitespace( true );
+ XMLAssert.assertXMLEqual( control, test );
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/maven/blob/9b763cc0/maven-model-builder/src/test/resources/poms/inheritance/module-path-not-artifactId-child.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/module-path-not-artifactId-child.xml b/maven-model-builder/src/test/resources/poms/inheritance/module-path-not-artifactId-child.xml
new file mode 100644
index 0000000..7031f44
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/module-path-not-artifactId-child.xml
@@ -0,0 +1,43 @@
+<?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>inheritance</groupId>
+ <artifactId>parent</artifactId>
+ <version>11-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>child-artifact-id</artifactId>
+ <name>Model inheritance test parent: module directory != artifactId</name>
+ <description>
+ artifactId == "child-artifact-id"
+ but expect path on SCM and site == "child"
+ feature: support "project.directory" property, ressembling future model addition of "directory" element along "artifactId"
+ </description>
+
+ <properties>
+ <project.directory>child</project.directory>
+ </properties>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/9b763cc0/maven-model-builder/src/test/resources/poms/inheritance/module-path-not-artifactId-expected.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/module-path-not-artifactId-expected.xml b/maven-model-builder/src/test/resources/poms/inheritance/module-path-not-artifactId-expected.xml
new file mode 100644
index 0000000..e82f289
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/module-path-not-artifactId-expected.xml
@@ -0,0 +1,58 @@
+<?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>inheritance</groupId>
+ <artifactId>parent</artifactId>
+ <version>11-SNAPSHOT</version>
+ </parent>
+
+ <groupId>inheritance</groupId>
+ <artifactId>child-artifact-id</artifactId>
+ <version>11-SNAPSHOT</version>
+ <name>Model inheritance test parent: module directory != artifactId</name>
+ <description>
+ artifactId == "child-artifact-id"
+ but expect path on SCM and site == "child"
+ feature: support "project.directory" property, ressembling future model addition of "directory" element along "artifactId"
+ </description>
+
+ <!-- 5 inherited urls with ${project.directory} added to parent instead of artifactId -->
+ <url>http://www.apache.org/child/</url>
+ <scm>
+ <connection>scm:my-scm:http://domain.org/base/child</connection>
+ <developerConnection>scm:my-scm:https://domain.org/base/child/</developerConnection>
+ <url>https://domain.org/base/child</url>
+ </scm>
+ <distributionManagement>
+ <site>
+ <url>scp://scp.domain.org/base/child/</url>
+ </site>
+ </distributionManagement>
+
+ <properties>
+ <project.directory>child</project.directory>
+ </properties>
+</project>
http://git-wip-us.apache.org/repos/asf/maven/blob/9b763cc0/maven-model-builder/src/test/resources/poms/inheritance/module-path-not-artifactId-parent.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/module-path-not-artifactId-parent.xml b/maven-model-builder/src/test/resources/poms/inheritance/module-path-not-artifactId-parent.xml
new file mode 100644
index 0000000..9b923cd
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/inheritance/module-path-not-artifactId-parent.xml
@@ -0,0 +1,48 @@
+<?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>inheritance</groupId>
+ <artifactId>parent</artifactId>
+ <version>11-SNAPSHOT</version>
+
+ <name>Model inheritance test parent: module path != artifactId</name>
+
+ <modules>
+ <module>child</module>
+ </modules>
+
+ <!-- 5 URLs in the pom will be inherited with path added -->
+ <url>http://www.apache.org/</url>
+ <scm>
+ <connection>scm:my-scm:http://domain.org/base</connection>
+ <developerConnection>scm:my-scm:https://domain.org/base/</developerConnection>
+ <url>https://domain.org/base</url>
+ </scm>
+ <distributionManagement>
+ <site>
+ <url>scp://scp.domain.org/base/</url>
+ </site>
+ </distributionManagement>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/9b763cc0/maven-model/src/main/mdo/maven.mdo
----------------------------------------------------------------------
diff --git a/maven-model/src/main/mdo/maven.mdo b/maven-model/src/main/mdo/maven.mdo
index d830113..5322c35 100644
--- a/maven-model/src/main/mdo/maven.mdo
+++ b/maven-model/src/main/mdo/maven.mdo
@@ -245,7 +245,7 @@
<description>
<![CDATA[
The URL to the project's homepage.
- <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId
+ <br /><b>Default value is</b>: parent value [+ path adjustment] + (artifactId or <code>project.directory</code> property)
]]>
</description>
<type>String</type>
@@ -2142,7 +2142,7 @@
<a href="https://maven.apache.org/scm/scm-url-format.html">URL format</a>
and <a href="https://maven.apache.org/scm/scms-overview.html">list of supported SCMs</a>.
This connection is read-only.
- <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId
+ <br /><b>Default value is</b>: parent value [+ path adjustment] + (artifactId or <code>project.directory</code> property)
]]>
</description>
<type>String</type>
@@ -2154,7 +2154,7 @@
<![CDATA[
Just like <code>connection</code>, but for developers, i.e. this scm connection
will not be read only.
- <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId
+ <br /><b>Default value is</b>: parent value [+ path adjustment] + (artifactId or <code>project.directory</code> property)
]]>
</description>
<type>String</type>
@@ -2172,7 +2172,7 @@
<description>
<![CDATA[
The URL to the project's browsable SCM repository, such as ViewVC or Fisheye.
- <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId
+ <br /><b>Default value is</b>: parent value [+ path adjustment] + (artifactId or <code>project.directory</code> property)
]]>
</description>
<type>String</type>
@@ -2605,7 +2605,7 @@
<description>
<![CDATA[
The url of the location where website is deployed, in the form <code>protocol://hostname/path</code>.
- <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId
+ <br /><b>Default value is</b>: parent value [+ path adjustment] + (artifactId or <code>project.directory</code> property)
]]>
</description>
<type>String</type>
[8/9] maven git commit: [MNG-6140] renamed aether to resolver,
added slf4j-provider
Posted by hb...@apache.org.
[MNG-6140] renamed aether to resolver, added slf4j-provider
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/1cb2e92b
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/1cb2e92b
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/1cb2e92b
Branch: refs/heads/master
Commit: 1cb2e92b5ad6bc2baa80c48b6357d5f42df4e48f
Parents: 8972072
Author: Herv� Boutemy <hb...@apache.org>
Authored: Mon Dec 26 19:21:29 2016 +0100
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Wed Feb 1 07:59:53 2017 +0100
----------------------------------------------------------------------
src/site/resources/images/maven-deps.png | Bin 73105 -> 69305 bytes
src/site/xdoc/index.xml | 54 ++++++++++++++------------
src/site/xdoc/maven-deps.odg | Bin 32324 -> 18602 bytes
3 files changed, 29 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/1cb2e92b/src/site/resources/images/maven-deps.png
----------------------------------------------------------------------
diff --git a/src/site/resources/images/maven-deps.png b/src/site/resources/images/maven-deps.png
index d23033f..a7084e8 100644
Binary files a/src/site/resources/images/maven-deps.png and b/src/site/resources/images/maven-deps.png differ
http://git-wip-us.apache.org/repos/asf/maven/blob/1cb2e92b/src/site/xdoc/index.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index 4cd2f66..78c47fb 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -1,22 +1,22 @@
<?xml version="1.0"?>
<!--
-/*
- * 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.
- */
+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.
-->
<document>
@@ -40,24 +40,28 @@
process.</p>
<p>
- <img src="images/maven-deps.png" width="784" height="595" border="0" usemap="#Maven_dependencies" />
+ <img src="images/maven-deps.png" width="784" height="578" border="0" usemap="#Maven_dependencies" />
<map name="Maven_dependencies">
<area shape="rect" coords="228,1,361,36" alt="apache-maven" href="apache-maven/" />
<area shape="rect" coords="228,58,361,95" alt="maven-embedder" href="maven-embedder/" />
<area shape="rect" coords="228,116,361,152" alt="maven-compat" href="maven-compat/" />
<area shape="rect" coords="228,175,361,211" alt="maven-core" href="maven-core/" />
- <area shape="rect" coords="118,233,275,269" alt="maven-aether-provider" href="maven-aether-provider/" />
+ <area shape="rect" coords="118,233,275,269" alt="maven-resolver-provider" href="maven-resolver-provider/" />
<area shape="rect" coords="0,287,192,323" alt="maven-repository-metadata" href="maven-repository-metadata/" />
<area shape="rect" coords="245,342,343,378" alt="maven-plugin-api" href="maven-plugin-api/" />
<area shape="rect" coords="253,401,336,436" alt="maven-artifact" href="maven-artifact/" />
- <area shape="rect" coords="296,234,442,270" alt="maven-builder-support" href="maven-builder-support/" />
+ <area shape="rect" coords="299,230,446,265" alt="maven-builder-support" href="maven-builder-support/" />
<area shape="rect" coords="382,176,528,211" alt="maven-settings-builder" href="maven-settings-builder/" />
- <area shape="rect" coords="446,234,537,269" alt="maven-settings" href="maven-settings/" />
+ <area shape="rect" coords="449,229,532,266" alt="maven-settings" href="maven-settings/" />
<area shape="rect" coords="388,284,521,319" alt="maven-model-builder" href="maven-model-builder/" />
<area shape="rect" coords="409,342,500,378" alt="maven-model" href="maven-model/" />
- <area shape="rect" coords="TODO" alt="maven-slf4j-provider" href="maven-slf4j-provider/" />
- <area shape="rect" coords="88,59,192,94" alt="slf4j-api" href="http://www.slf4j.org/manual.html" />
+ <area shape="rect" coords="42,0,198,35" alt="maven-slf4j-provider" href="maven-slf4j-provider/" />
+ <area shape="rect" coords="68,338,240,482" alt="maven-resolver" href="https://maven.apache.org/resolver/" />
+ <area shape="rect" coords="70,57,171,93" alt="slf4j-api" href="http://www.slf4j.org/manual.html" />
<area shape="rect" coords="551,58,707,94" alt="commons-cli" href="http://commons.apache.org/cli/" />
+ <area shape="rect" coords="88,175,205,211" alt="maven-shared-utils" href="https://maven.apache.org/shared/maven-shared-utils/" />
+ <area shape="rect" coords="0,176,70,211" alt="jansi" href="http://fusesource.github.io/jansi/" />
+ <area shape="rect" coords="0,229,71,266" alt="jansi-native" href="https://github.com/fusesource/jansi-native" />
<area shape="rect" coords="551,116,739,152" alt="wagon-provider-api" href="https://maven.apache.org/wagon/wagon-provider-api/" />
<area shape="rect" coords="550,175,690,211" alt="plexus-sec-dispatcher" href="https://github.com/codehaus-plexus/plexus-sec-dispatcher" />
<area shape="rect" coords="581,230,660,265" alt="plexus-cipher" href="https://github.com/codehaus-plexus/plexus-cipher" />
@@ -66,9 +70,9 @@
<area shape="rect" coords="550,401,682,437" alt="plexus-classworlds" href="https://codehaus-plexus.github.io/plexus-classworlds" />
<area shape="rect" coords="685,455,775,491" alt="plexus-utils" href="https://codehaus-plexus.github.io/plexus-utils" />
<area shape="rect" coords="542,167,783,502" alt="plexus" href="https://codehaus-plexus.github.io/" />
- <area shape="rect" coords="68,338,240,482" alt="aether" href="http://www.eclipse.org/projects/project_summary.php?projectid=technology.aether" />
- <area shape="rect" coords="388,393,520,594" alt="sisu" href="http://www.eclipse.org/projects/project_summary.php?projectid=technology.sisu" />
- <area shape="rect" coords="519,518,621,554" alt="guice" href="http://code.google.com/p/google-guice/" />
+ <area shape="rect" coords="401,393,509,524" alt="sisu" href="http://www.eclipse.org/projects/project_summary.php?projectid=technology.sisu" />
+ <area shape="rect" coords="416,543,493,577" alt="guice" href="http://code.google.com/p/google-guice/" />
+ <area shape="rect" coords="550,543,673,577" alt="javax.inject" href="http://docs.oracle.com/javaee/6/api/javax/inject/package-summary.html" />
</map>
</p>
</section>
http://git-wip-us.apache.org/repos/asf/maven/blob/1cb2e92b/src/site/xdoc/maven-deps.odg
----------------------------------------------------------------------
diff --git a/src/site/xdoc/maven-deps.odg b/src/site/xdoc/maven-deps.odg
index 9d4193a..f95b83f 100644
Binary files a/src/site/xdoc/maven-deps.odg and b/src/site/xdoc/maven-deps.odg differ
[4/9] maven git commit: [MNG-6110] renamed 'maven-aether-provider' to
'maven-resolver-provider'
Posted by hb...@apache.org.
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
new file mode 100644
index 0000000..0f31330
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
@@ -0,0 +1,415 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.LinkedHashSet;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.commons.lang3.Validate;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Relocation;
+import org.apache.maven.model.building.DefaultModelBuilderFactory;
+import org.apache.maven.model.building.DefaultModelBuildingRequest;
+import org.apache.maven.model.building.FileModelSource;
+import org.apache.maven.model.building.ModelBuilder;
+import org.apache.maven.model.building.ModelBuildingException;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblem;
+import org.apache.maven.model.resolution.UnresolvableModelException;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.eclipse.aether.RepositoryEvent;
+import org.eclipse.aether.RepositoryEvent.EventType;
+import org.eclipse.aether.RepositoryException;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.RequestTrace;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.impl.ArtifactDescriptorReader;
+import org.eclipse.aether.impl.ArtifactResolver;
+import org.eclipse.aether.impl.RemoteRepositoryManager;
+import org.eclipse.aether.impl.RepositoryEventDispatcher;
+import org.eclipse.aether.impl.VersionRangeResolver;
+import org.eclipse.aether.impl.VersionResolver;
+import org.eclipse.aether.repository.WorkspaceReader;
+import org.eclipse.aether.repository.WorkspaceRepository;
+import org.eclipse.aether.resolution.ArtifactDescriptorException;
+import org.eclipse.aether.resolution.ArtifactDescriptorPolicy;
+import org.eclipse.aether.resolution.ArtifactDescriptorPolicyRequest;
+import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
+import org.eclipse.aether.resolution.ArtifactDescriptorResult;
+import org.eclipse.aether.resolution.ArtifactRequest;
+import org.eclipse.aether.resolution.ArtifactResolutionException;
+import org.eclipse.aether.resolution.ArtifactResult;
+import org.eclipse.aether.resolution.VersionRequest;
+import org.eclipse.aether.resolution.VersionResolutionException;
+import org.eclipse.aether.resolution.VersionResult;
+import org.eclipse.aether.spi.locator.Service;
+import org.eclipse.aether.spi.locator.ServiceLocator;
+import org.eclipse.aether.spi.log.Logger;
+import org.eclipse.aether.spi.log.LoggerFactory;
+import org.eclipse.aether.spi.log.NullLoggerFactory;
+import org.eclipse.aether.transfer.ArtifactNotFoundException;
+
+/**
+ * @author Benjamin Bentmann
+ */
+@Named
+@Component( role = ArtifactDescriptorReader.class )
+public class DefaultArtifactDescriptorReader
+ implements ArtifactDescriptorReader, Service
+{
+
+ @SuppressWarnings( "unused" )
+ @Requirement( role = LoggerFactory.class )
+ private Logger logger = NullLoggerFactory.LOGGER;
+
+ @Requirement
+ private RemoteRepositoryManager remoteRepositoryManager;
+
+ @Requirement
+ private VersionResolver versionResolver;
+
+ @Requirement
+ private VersionRangeResolver versionRangeResolver;
+
+ @Requirement
+ private ArtifactResolver artifactResolver;
+
+ @Requirement
+ private RepositoryEventDispatcher repositoryEventDispatcher;
+
+ @Requirement
+ private ModelBuilder modelBuilder;
+
+ public DefaultArtifactDescriptorReader()
+ {
+ // enable no-arg constructor
+ }
+
+ @Inject
+ DefaultArtifactDescriptorReader( RemoteRepositoryManager remoteRepositoryManager, VersionResolver versionResolver,
+ ArtifactResolver artifactResolver, ModelBuilder modelBuilder,
+ RepositoryEventDispatcher repositoryEventDispatcher, LoggerFactory loggerFactory )
+ {
+ setRemoteRepositoryManager( remoteRepositoryManager );
+ setVersionResolver( versionResolver );
+ setArtifactResolver( artifactResolver );
+ setModelBuilder( modelBuilder );
+ setLoggerFactory( loggerFactory );
+ setRepositoryEventDispatcher( repositoryEventDispatcher );
+ }
+
+ public void initService( ServiceLocator locator )
+ {
+ setLoggerFactory( locator.getService( LoggerFactory.class ) );
+ setRemoteRepositoryManager( locator.getService( RemoteRepositoryManager.class ) );
+ setVersionResolver( locator.getService( VersionResolver.class ) );
+ setVersionRangeResolver( locator.getService( VersionRangeResolver.class ) );
+ setArtifactResolver( locator.getService( ArtifactResolver.class ) );
+ setRepositoryEventDispatcher( locator.getService( RepositoryEventDispatcher.class ) );
+ modelBuilder = locator.getService( ModelBuilder.class );
+ if ( modelBuilder == null )
+ {
+ setModelBuilder( new DefaultModelBuilderFactory().newInstance() );
+ }
+ }
+
+ public DefaultArtifactDescriptorReader setLoggerFactory( LoggerFactory loggerFactory )
+ {
+ this.logger = NullLoggerFactory.getSafeLogger( loggerFactory, getClass() );
+ return this;
+ }
+
+ void setLogger( LoggerFactory loggerFactory )
+ {
+ // plexus support
+ setLoggerFactory( loggerFactory );
+ }
+
+ public DefaultArtifactDescriptorReader setRemoteRepositoryManager( RemoteRepositoryManager remoteRepositoryManager )
+ {
+ this.remoteRepositoryManager = Validate.notNull( remoteRepositoryManager,
+ "remoteRepositoryManager cannot be null" );
+ return this;
+ }
+
+ public DefaultArtifactDescriptorReader setVersionResolver( VersionResolver versionResolver )
+ {
+ this.versionResolver = Validate.notNull( versionResolver, "versionResolver cannot be null" );
+ return this;
+ }
+
+ /** @since 3.2.2 */
+ public DefaultArtifactDescriptorReader setVersionRangeResolver( VersionRangeResolver versionRangeResolver )
+ {
+ this.versionRangeResolver = Validate.notNull( versionRangeResolver, "versionRangeResolver cannot be null" );
+ return this;
+ }
+
+ public DefaultArtifactDescriptorReader setArtifactResolver( ArtifactResolver artifactResolver )
+ {
+ this.artifactResolver = Validate.notNull( artifactResolver, "artifactResolver cannot be null" );
+ return this;
+ }
+
+ public DefaultArtifactDescriptorReader setRepositoryEventDispatcher(
+ RepositoryEventDispatcher repositoryEventDispatcher )
+ {
+ this.repositoryEventDispatcher = Validate.notNull( repositoryEventDispatcher,
+ "repositoryEventDispatcher cannot be null" );
+ return this;
+ }
+
+ public DefaultArtifactDescriptorReader setModelBuilder( ModelBuilder modelBuilder )
+ {
+ this.modelBuilder = Validate.notNull( modelBuilder, "modelBuilder cannot be null" );
+ return this;
+ }
+
+ public ArtifactDescriptorResult readArtifactDescriptor( RepositorySystemSession session,
+ ArtifactDescriptorRequest request )
+ throws ArtifactDescriptorException
+ {
+ ArtifactDescriptorResult result = new ArtifactDescriptorResult( request );
+
+ Model model = loadPom( session, request, result );
+ if ( model != null )
+ {
+ Map<String, Object> config = session.getConfigProperties();
+ ArtifactDescriptorReaderDelegate delegate =
+ (ArtifactDescriptorReaderDelegate) config.get( ArtifactDescriptorReaderDelegate.class.getName() );
+
+ if ( delegate == null )
+ {
+ delegate = new ArtifactDescriptorReaderDelegate();
+ }
+
+ delegate.populateResult( session, result, model );
+ }
+
+ return result;
+ }
+
+ private Model loadPom( RepositorySystemSession session, ArtifactDescriptorRequest request,
+ ArtifactDescriptorResult result )
+ throws ArtifactDescriptorException
+ {
+ RequestTrace trace = RequestTrace.newChild( request.getTrace(), request );
+
+ Set<String> visited = new LinkedHashSet<>();
+ for ( Artifact a = request.getArtifact();; )
+ {
+ Artifact pomArtifact = ArtifactDescriptorUtils.toPomArtifact( a );
+ try
+ {
+ VersionRequest versionRequest =
+ new VersionRequest( a, request.getRepositories(), request.getRequestContext() );
+ versionRequest.setTrace( trace );
+ VersionResult versionResult = versionResolver.resolveVersion( session, versionRequest );
+
+ a = a.setVersion( versionResult.getVersion() );
+
+ versionRequest =
+ new VersionRequest( pomArtifact, request.getRepositories(), request.getRequestContext() );
+ versionRequest.setTrace( trace );
+ versionResult = versionResolver.resolveVersion( session, versionRequest );
+
+ pomArtifact = pomArtifact.setVersion( versionResult.getVersion() );
+ }
+ catch ( VersionResolutionException e )
+ {
+ result.addException( e );
+ throw new ArtifactDescriptorException( result );
+ }
+
+ if ( !visited.add( a.getGroupId() + ':' + a.getArtifactId() + ':' + a.getBaseVersion() ) )
+ {
+ RepositoryException exception =
+ new RepositoryException( "Artifact relocations form a cycle: " + visited );
+ invalidDescriptor( session, trace, a, exception );
+ if ( ( getPolicy( session, a, request ) & ArtifactDescriptorPolicy.IGNORE_INVALID ) != 0 )
+ {
+ return null;
+ }
+ result.addException( exception );
+ throw new ArtifactDescriptorException( result );
+ }
+
+ ArtifactResult resolveResult;
+ try
+ {
+ ArtifactRequest resolveRequest =
+ new ArtifactRequest( pomArtifact, request.getRepositories(), request.getRequestContext() );
+ resolveRequest.setTrace( trace );
+ resolveResult = artifactResolver.resolveArtifact( session, resolveRequest );
+ pomArtifact = resolveResult.getArtifact();
+ result.setRepository( resolveResult.getRepository() );
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ if ( e.getCause() instanceof ArtifactNotFoundException )
+ {
+ missingDescriptor( session, trace, a, (Exception) e.getCause() );
+ if ( ( getPolicy( session, a, request ) & ArtifactDescriptorPolicy.IGNORE_MISSING ) != 0 )
+ {
+ return null;
+ }
+ }
+ result.addException( e );
+ throw new ArtifactDescriptorException( result );
+ }
+
+ Model model;
+
+ // hack: don't rebuild model if it was already loaded during reactor resolution
+ final WorkspaceReader workspace = session.getWorkspaceReader();
+ if ( workspace instanceof MavenWorkspaceReader )
+ {
+ model = ( (MavenWorkspaceReader) workspace ).findModel( pomArtifact );
+ if ( model != null )
+ {
+ return model;
+ }
+ }
+
+ try
+ {
+ ModelBuildingRequest modelRequest = new DefaultModelBuildingRequest();
+ modelRequest.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
+ modelRequest.setProcessPlugins( false );
+ modelRequest.setTwoPhaseBuilding( false );
+ modelRequest.setSystemProperties( toProperties( session.getUserProperties(),
+ session.getSystemProperties() ) );
+ modelRequest.setModelCache( DefaultModelCache.newInstance( session ) );
+ modelRequest.setModelResolver( new DefaultModelResolver( session, trace.newChild( modelRequest ),
+ request.getRequestContext(), artifactResolver,
+ versionRangeResolver, remoteRepositoryManager,
+ request.getRepositories() ) );
+ if ( resolveResult.getRepository() instanceof WorkspaceRepository )
+ {
+ modelRequest.setPomFile( pomArtifact.getFile() );
+ }
+ else
+ {
+ modelRequest.setModelSource( new FileModelSource( pomArtifact.getFile() ) );
+ }
+
+ model = modelBuilder.build( modelRequest ).getEffectiveModel();
+ }
+ catch ( ModelBuildingException e )
+ {
+ for ( ModelProblem problem : e.getProblems() )
+ {
+ if ( problem.getException() instanceof UnresolvableModelException )
+ {
+ result.addException( problem.getException() );
+ throw new ArtifactDescriptorException( result );
+ }
+ }
+ invalidDescriptor( session, trace, a, e );
+ if ( ( getPolicy( session, a, request ) & ArtifactDescriptorPolicy.IGNORE_INVALID ) != 0 )
+ {
+ return null;
+ }
+ result.addException( e );
+ throw new ArtifactDescriptorException( result );
+ }
+
+ Relocation relocation = getRelocation( model );
+
+ if ( relocation != null )
+ {
+ result.addRelocation( a );
+ a =
+ new RelocatedArtifact( a, relocation.getGroupId(), relocation.getArtifactId(),
+ relocation.getVersion() );
+ result.setArtifact( a );
+ }
+ else
+ {
+ return model;
+ }
+ }
+ }
+
+ private Properties toProperties( Map<String, String> dominant, Map<String, String> recessive )
+ {
+ Properties props = new Properties();
+ if ( recessive != null )
+ {
+ props.putAll( recessive );
+ }
+ if ( dominant != null )
+ {
+ props.putAll( dominant );
+ }
+ return props;
+ }
+
+ private Relocation getRelocation( Model model )
+ {
+ Relocation relocation = null;
+ DistributionManagement distMngt = model.getDistributionManagement();
+ if ( distMngt != null )
+ {
+ relocation = distMngt.getRelocation();
+ }
+ return relocation;
+ }
+
+ private void missingDescriptor( RepositorySystemSession session, RequestTrace trace, Artifact artifact,
+ Exception exception )
+ {
+ RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.ARTIFACT_DESCRIPTOR_MISSING );
+ event.setTrace( trace );
+ event.setArtifact( artifact );
+ event.setException( exception );
+
+ repositoryEventDispatcher.dispatch( event.build() );
+ }
+
+ private void invalidDescriptor( RepositorySystemSession session, RequestTrace trace, Artifact artifact,
+ Exception exception )
+ {
+ RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.ARTIFACT_DESCRIPTOR_INVALID );
+ event.setTrace( trace );
+ event.setArtifact( artifact );
+ event.setException( exception );
+
+ repositoryEventDispatcher.dispatch( event.build() );
+ }
+
+ private int getPolicy( RepositorySystemSession session, Artifact a, ArtifactDescriptorRequest request )
+ {
+ ArtifactDescriptorPolicy policy = session.getArtifactDescriptorPolicy();
+ if ( policy == null )
+ {
+ return ArtifactDescriptorPolicy.STRICT;
+ }
+ return policy.getPolicy( session, new ArtifactDescriptorPolicyRequest( a, request.getRequestContext() ) );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelCache.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelCache.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelCache.java
new file mode 100644
index 0000000..f13495d
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelCache.java
@@ -0,0 +1,119 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.model.building.ModelCache;
+import org.eclipse.aether.RepositoryCache;
+import org.eclipse.aether.RepositorySystemSession;
+
+/**
+ * A model builder cache backed by the repository system cache.
+ *
+ * @author Benjamin Bentmann
+ */
+class DefaultModelCache
+ implements ModelCache
+{
+
+ private final RepositorySystemSession session;
+
+ private final RepositoryCache cache;
+
+ public static ModelCache newInstance( RepositorySystemSession session )
+ {
+ if ( session.getCache() == null )
+ {
+ return null;
+ }
+ else
+ {
+ return new DefaultModelCache( session );
+ }
+ }
+
+ private DefaultModelCache( RepositorySystemSession session )
+ {
+ this.session = session;
+ this.cache = session.getCache();
+ }
+
+ public Object get( String groupId, String artifactId, String version, String tag )
+ {
+ return cache.get( session, new Key( groupId, artifactId, version, tag ) );
+ }
+
+ public void put( String groupId, String artifactId, String version, String tag, Object data )
+ {
+ cache.put( session, new Key( groupId, artifactId, version, tag ), data );
+ }
+
+ static class Key
+ {
+
+ private final String groupId;
+
+ private final String artifactId;
+
+ private final String version;
+
+ private final String tag;
+
+ private final int hash;
+
+ public Key( String groupId, String artifactId, String version, String tag )
+ {
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.version = version;
+ this.tag = tag;
+
+ int h = 17;
+ h = h * 31 + this.groupId.hashCode();
+ h = h * 31 + this.artifactId.hashCode();
+ h = h * 31 + this.version.hashCode();
+ h = h * 31 + this.tag.hashCode();
+ hash = h;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+ if ( null == obj || !getClass().equals( obj.getClass() ) )
+ {
+ return false;
+ }
+
+ Key that = (Key) obj;
+ return artifactId.equals( that.artifactId ) && groupId.equals( that.groupId )
+ && version.equals( that.version ) && tag.equals( that.tag );
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return hash;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java
new file mode 100644
index 0000000..f344959
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java
@@ -0,0 +1,229 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.Repository;
+import org.apache.maven.model.building.FileModelSource;
+import org.apache.maven.model.building.ModelSource;
+import org.apache.maven.model.resolution.InvalidRepositoryException;
+import org.apache.maven.model.resolution.ModelResolver;
+import org.apache.maven.model.resolution.UnresolvableModelException;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.RequestTrace;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.impl.ArtifactResolver;
+import org.eclipse.aether.impl.RemoteRepositoryManager;
+import org.eclipse.aether.impl.VersionRangeResolver;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.resolution.ArtifactRequest;
+import org.eclipse.aether.resolution.ArtifactResolutionException;
+import org.eclipse.aether.resolution.VersionRangeRequest;
+import org.eclipse.aether.resolution.VersionRangeResolutionException;
+import org.eclipse.aether.resolution.VersionRangeResult;
+
+/**
+ * A model resolver to assist building of dependency POMs. This resolver gives priority to those repositories that have
+ * been initially specified and repositories discovered in dependency POMs are recessively merged into the search chain.
+ *
+ * @author Benjamin Bentmann
+ * @see DefaultArtifactDescriptorReader
+ */
+class DefaultModelResolver
+ implements ModelResolver
+{
+
+ private final RepositorySystemSession session;
+
+ private final RequestTrace trace;
+
+ private final String context;
+
+ private List<RemoteRepository> repositories;
+
+ private final List<RemoteRepository> externalRepositories;
+
+ private final ArtifactResolver resolver;
+
+ private final VersionRangeResolver versionRangeResolver;
+
+ private final RemoteRepositoryManager remoteRepositoryManager;
+
+ private final Set<String> repositoryIds;
+
+ public DefaultModelResolver( RepositorySystemSession session, RequestTrace trace, String context,
+ ArtifactResolver resolver, VersionRangeResolver versionRangeResolver,
+ RemoteRepositoryManager remoteRepositoryManager, List<RemoteRepository> repositories )
+ {
+ this.session = session;
+ this.trace = trace;
+ this.context = context;
+ this.resolver = resolver;
+ this.versionRangeResolver = versionRangeResolver;
+ this.remoteRepositoryManager = remoteRepositoryManager;
+ this.repositories = repositories;
+ List<RemoteRepository> externalRepositories = new ArrayList<>();
+ externalRepositories.addAll( repositories );
+ this.externalRepositories = Collections.unmodifiableList( externalRepositories );
+
+ this.repositoryIds = new HashSet<>();
+ }
+
+ private DefaultModelResolver( DefaultModelResolver original )
+ {
+ this.session = original.session;
+ this.trace = original.trace;
+ this.context = original.context;
+ this.resolver = original.resolver;
+ this.versionRangeResolver = original.versionRangeResolver;
+ this.remoteRepositoryManager = original.remoteRepositoryManager;
+ this.repositories = new ArrayList<>( original.repositories );
+ this.externalRepositories = original.externalRepositories;
+ this.repositoryIds = new HashSet<>( original.repositoryIds );
+ }
+
+ @Override
+ public void addRepository( Repository repository )
+ throws InvalidRepositoryException
+ {
+ addRepository( repository, false );
+ }
+
+ @Override
+ public void addRepository( final Repository repository, boolean replace )
+ throws InvalidRepositoryException
+ {
+ if ( session.isIgnoreArtifactDescriptorRepositories() )
+ {
+ return;
+ }
+
+ if ( !repositoryIds.add( repository.getId() ) )
+ {
+ if ( !replace )
+ {
+ return;
+ }
+
+ removeMatchingRepository( repositories, repository.getId() );
+ }
+
+ List<RemoteRepository> newRepositories =
+ Collections.singletonList( ArtifactDescriptorUtils.toRemoteRepository( repository ) );
+
+ this.repositories =
+ remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories, true );
+ }
+
+ private static void removeMatchingRepository( Iterable<RemoteRepository> repositories, final String id )
+ {
+ Iterables.removeIf( repositories, new Predicate<RemoteRepository>()
+ {
+ @Override
+ public boolean apply( RemoteRepository remoteRepository )
+ {
+ return remoteRepository.getId().equals( id );
+ }
+ } );
+ }
+
+ @Override
+ public ModelResolver newCopy()
+ {
+ return new DefaultModelResolver( this );
+ }
+
+ @Override
+ public ModelSource resolveModel( String groupId, String artifactId, String version )
+ throws UnresolvableModelException
+ {
+ Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version );
+
+ try
+ {
+ ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context );
+ request.setTrace( trace );
+ pomArtifact = resolver.resolveArtifact( session, request ).getArtifact();
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new UnresolvableModelException( e.getMessage(), groupId, artifactId, version, e );
+ }
+
+ File pomFile = pomArtifact.getFile();
+
+ return new FileModelSource( pomFile );
+ }
+
+ public ModelSource resolveModel( Parent parent )
+ throws UnresolvableModelException
+ {
+ Artifact artifact = new DefaultArtifact( parent.getGroupId(), parent.getArtifactId(), "", "pom",
+ parent.getVersion() );
+
+ VersionRangeRequest versionRangeRequest = new VersionRangeRequest( artifact, repositories, context );
+ versionRangeRequest.setTrace( trace );
+
+ try
+ {
+ VersionRangeResult versionRangeResult =
+ versionRangeResolver.resolveVersionRange( session, versionRangeRequest );
+
+ if ( versionRangeResult.getHighestVersion() == null )
+ {
+ throw new UnresolvableModelException( "No versions matched the requested range '" + parent.getVersion()
+ + "'", parent.getGroupId(), parent.getArtifactId(),
+ parent.getVersion() );
+
+ }
+
+ if ( versionRangeResult.getVersionConstraint() != null
+ && versionRangeResult.getVersionConstraint().getRange() != null
+ && versionRangeResult.getVersionConstraint().getRange().getUpperBound() == null )
+ {
+ throw new UnresolvableModelException( "The requested version range '" + parent.getVersion()
+ + "' does not specify an upper bound", parent.getGroupId(),
+ parent.getArtifactId(), parent.getVersion() );
+
+ }
+
+ parent.setVersion( versionRangeResult.getHighestVersion().toString() );
+ }
+ catch ( VersionRangeResolutionException e )
+ {
+ throw new UnresolvableModelException( e.getMessage(), parent.getGroupId(), parent.getArtifactId(),
+ parent.getVersion(), e );
+
+ }
+
+ return resolveModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java
new file mode 100644
index 0000000..ddd3e97
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java
@@ -0,0 +1,307 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.commons.lang3.Validate;
+import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.util.IOUtil;
+import org.eclipse.aether.RepositoryEvent;
+import org.eclipse.aether.RepositoryEvent.EventType;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.RequestTrace;
+import org.eclipse.aether.SyncContext;
+import org.eclipse.aether.impl.MetadataResolver;
+import org.eclipse.aether.impl.RepositoryEventDispatcher;
+import org.eclipse.aether.impl.SyncContextFactory;
+import org.eclipse.aether.impl.VersionRangeResolver;
+import org.eclipse.aether.metadata.DefaultMetadata;
+import org.eclipse.aether.metadata.Metadata;
+import org.eclipse.aether.repository.ArtifactRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.repository.WorkspaceReader;
+import org.eclipse.aether.resolution.MetadataRequest;
+import org.eclipse.aether.resolution.MetadataResult;
+import org.eclipse.aether.resolution.VersionRangeRequest;
+import org.eclipse.aether.resolution.VersionRangeResolutionException;
+import org.eclipse.aether.resolution.VersionRangeResult;
+import org.eclipse.aether.spi.locator.Service;
+import org.eclipse.aether.spi.locator.ServiceLocator;
+import org.eclipse.aether.spi.log.Logger;
+import org.eclipse.aether.spi.log.LoggerFactory;
+import org.eclipse.aether.spi.log.NullLoggerFactory;
+import org.eclipse.aether.util.version.GenericVersionScheme;
+import org.eclipse.aether.version.InvalidVersionSpecificationException;
+import org.eclipse.aether.version.Version;
+import org.eclipse.aether.version.VersionConstraint;
+import org.eclipse.aether.version.VersionScheme;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Benjamin Bentmann
+ */
+@Named
+@Component( role = VersionRangeResolver.class )
+public class DefaultVersionRangeResolver
+ implements VersionRangeResolver, Service
+{
+
+ private static final String MAVEN_METADATA_XML = "maven-metadata.xml";
+
+ @SuppressWarnings( "unused" )
+ @Requirement( role = LoggerFactory.class )
+ private Logger logger = NullLoggerFactory.LOGGER;
+
+ @Requirement
+ private MetadataResolver metadataResolver;
+
+ @Requirement
+ private SyncContextFactory syncContextFactory;
+
+ @Requirement
+ private RepositoryEventDispatcher repositoryEventDispatcher;
+
+ public DefaultVersionRangeResolver()
+ {
+ // enable default constructor
+ }
+
+ @Inject
+ DefaultVersionRangeResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
+ RepositoryEventDispatcher repositoryEventDispatcher, LoggerFactory loggerFactory )
+ {
+ setMetadataResolver( metadataResolver );
+ setSyncContextFactory( syncContextFactory );
+ setLoggerFactory( loggerFactory );
+ setRepositoryEventDispatcher( repositoryEventDispatcher );
+ }
+
+ public void initService( ServiceLocator locator )
+ {
+ setLoggerFactory( locator.getService( LoggerFactory.class ) );
+ setMetadataResolver( locator.getService( MetadataResolver.class ) );
+ setSyncContextFactory( locator.getService( SyncContextFactory.class ) );
+ setRepositoryEventDispatcher( locator.getService( RepositoryEventDispatcher.class ) );
+ }
+
+ public DefaultVersionRangeResolver setLoggerFactory( LoggerFactory loggerFactory )
+ {
+ this.logger = NullLoggerFactory.getSafeLogger( loggerFactory, getClass() );
+ return this;
+ }
+
+ void setLogger( LoggerFactory loggerFactory )
+ {
+ // plexus support
+ setLoggerFactory( loggerFactory );
+ }
+
+ public DefaultVersionRangeResolver setMetadataResolver( MetadataResolver metadataResolver )
+ {
+ this.metadataResolver = Validate.notNull( metadataResolver, "metadataResolver cannot be null" );
+ return this;
+ }
+
+ public DefaultVersionRangeResolver setSyncContextFactory( SyncContextFactory syncContextFactory )
+ {
+ this.syncContextFactory = Validate.notNull( syncContextFactory, "syncContextFactory cannot be null" );
+ return this;
+ }
+
+ public DefaultVersionRangeResolver setRepositoryEventDispatcher(
+ RepositoryEventDispatcher repositoryEventDispatcher )
+ {
+ this.repositoryEventDispatcher = Validate.notNull( repositoryEventDispatcher,
+ "repositoryEventDispatcher cannot be null" );
+ return this;
+ }
+
+ public VersionRangeResult resolveVersionRange( RepositorySystemSession session, VersionRangeRequest request )
+ throws VersionRangeResolutionException
+ {
+ VersionRangeResult result = new VersionRangeResult( request );
+
+ VersionScheme versionScheme = new GenericVersionScheme();
+
+ VersionConstraint versionConstraint;
+ try
+ {
+ versionConstraint = versionScheme.parseVersionConstraint( request.getArtifact().getVersion() );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ result.addException( e );
+ throw new VersionRangeResolutionException( result );
+ }
+
+ result.setVersionConstraint( versionConstraint );
+
+ if ( versionConstraint.getRange() == null )
+ {
+ result.addVersion( versionConstraint.getVersion() );
+ }
+ else
+ {
+ Map<String, ArtifactRepository> versionIndex = getVersions( session, result, request );
+
+ List<Version> versions = new ArrayList<>();
+ for ( Map.Entry<String, ArtifactRepository> v : versionIndex.entrySet() )
+ {
+ try
+ {
+ Version ver = versionScheme.parseVersion( v.getKey() );
+ if ( versionConstraint.containsVersion( ver ) )
+ {
+ versions.add( ver );
+ result.setRepository( ver, v.getValue() );
+ }
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ result.addException( e );
+ }
+ }
+
+ Collections.sort( versions );
+ result.setVersions( versions );
+ }
+
+ return result;
+ }
+
+ private Map<String, ArtifactRepository> getVersions( RepositorySystemSession session, VersionRangeResult result,
+ VersionRangeRequest request )
+ {
+ RequestTrace trace = RequestTrace.newChild( request.getTrace(), request );
+
+ Map<String, ArtifactRepository> versionIndex = new HashMap<>();
+
+ Metadata metadata =
+ new DefaultMetadata( request.getArtifact().getGroupId(), request.getArtifact().getArtifactId(),
+ MAVEN_METADATA_XML, Metadata.Nature.RELEASE_OR_SNAPSHOT );
+
+ List<MetadataRequest> metadataRequests = new ArrayList<>( request.getRepositories().size() );
+
+ metadataRequests.add( new MetadataRequest( metadata, null, request.getRequestContext() ) );
+
+ for ( RemoteRepository repository : request.getRepositories() )
+ {
+ MetadataRequest metadataRequest = new MetadataRequest( metadata, repository, request.getRequestContext() );
+ metadataRequest.setDeleteLocalCopyIfMissing( true );
+ metadataRequest.setTrace( trace );
+ metadataRequests.add( metadataRequest );
+ }
+
+ List<MetadataResult> metadataResults = metadataResolver.resolveMetadata( session, metadataRequests );
+
+ WorkspaceReader workspace = session.getWorkspaceReader();
+ if ( workspace != null )
+ {
+ List<String> versions = workspace.findVersions( request.getArtifact() );
+ for ( String version : versions )
+ {
+ versionIndex.put( version, workspace.getRepository() );
+ }
+ }
+
+ for ( MetadataResult metadataResult : metadataResults )
+ {
+ result.addException( metadataResult.getException() );
+
+ ArtifactRepository repository = metadataResult.getRequest().getRepository();
+ if ( repository == null )
+ {
+ repository = session.getLocalRepository();
+ }
+
+ Versioning versioning = readVersions( session, trace, metadataResult.getMetadata(), repository, result );
+ for ( String version : versioning.getVersions() )
+ {
+ if ( !versionIndex.containsKey( version ) )
+ {
+ versionIndex.put( version, repository );
+ }
+ }
+ }
+
+ return versionIndex;
+ }
+
+ private Versioning readVersions( RepositorySystemSession session, RequestTrace trace, Metadata metadata,
+ ArtifactRepository repository, VersionRangeResult result )
+ {
+ Versioning versioning = null;
+
+ FileInputStream fis = null;
+ try
+ {
+ if ( metadata != null )
+ {
+
+ try ( SyncContext syncContext = syncContextFactory.newInstance( session, true ) )
+ {
+ syncContext.acquire( null, Collections.singleton( metadata ) );
+
+ if ( metadata.getFile() != null && metadata.getFile().exists() )
+ {
+ fis = new FileInputStream( metadata.getFile() );
+ org.apache.maven.artifact.repository.metadata.Metadata m =
+ new MetadataXpp3Reader().read( fis, false );
+ versioning = m.getVersioning();
+ }
+ }
+ }
+ }
+ catch ( Exception e )
+ {
+ invalidMetadata( session, trace, metadata, repository, e );
+ result.addException( e );
+ }
+ finally
+ {
+ IOUtil.close( fis );
+ }
+
+ return ( versioning != null ) ? versioning : new Versioning();
+ }
+
+ private void invalidMetadata( RepositorySystemSession session, RequestTrace trace, Metadata metadata,
+ ArtifactRepository repository, Exception exception )
+ {
+ RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.METADATA_INVALID );
+ event.setTrace( trace );
+ event.setMetadata( metadata );
+ event.setException( exception );
+ event.setRepository( repository );
+
+ repositoryEventDispatcher.dispatch( event.build() );
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java
new file mode 100644
index 0000000..2b0890b
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java
@@ -0,0 +1,617 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.commons.lang3.Validate;
+import org.apache.maven.artifact.repository.metadata.Snapshot;
+import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
+import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
+import org.eclipse.aether.RepositoryCache;
+import org.eclipse.aether.RepositoryEvent;
+import org.eclipse.aether.RepositoryEvent.EventType;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.RequestTrace;
+import org.eclipse.aether.SyncContext;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.impl.MetadataResolver;
+import org.eclipse.aether.impl.RepositoryEventDispatcher;
+import org.eclipse.aether.impl.SyncContextFactory;
+import org.eclipse.aether.impl.VersionResolver;
+import org.eclipse.aether.internal.impl.CacheUtils;
+import org.eclipse.aether.metadata.DefaultMetadata;
+import org.eclipse.aether.metadata.Metadata;
+import org.eclipse.aether.repository.ArtifactRepository;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.repository.WorkspaceReader;
+import org.eclipse.aether.repository.WorkspaceRepository;
+import org.eclipse.aether.resolution.MetadataRequest;
+import org.eclipse.aether.resolution.MetadataResult;
+import org.eclipse.aether.resolution.VersionRequest;
+import org.eclipse.aether.resolution.VersionResolutionException;
+import org.eclipse.aether.resolution.VersionResult;
+import org.eclipse.aether.spi.locator.Service;
+import org.eclipse.aether.spi.locator.ServiceLocator;
+import org.eclipse.aether.spi.log.Logger;
+import org.eclipse.aether.spi.log.LoggerFactory;
+import org.eclipse.aether.spi.log.NullLoggerFactory;
+import org.eclipse.aether.util.ConfigUtils;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Benjamin Bentmann
+ */
+@Named
+@Component( role = VersionResolver.class )
+public class DefaultVersionResolver
+ implements VersionResolver, Service
+{
+
+ private static final String MAVEN_METADATA_XML = "maven-metadata.xml";
+
+ private static final String RELEASE = "RELEASE";
+
+ private static final String LATEST = "LATEST";
+
+ private static final String SNAPSHOT = "SNAPSHOT";
+
+ @SuppressWarnings( "unused" )
+ @Requirement( role = LoggerFactory.class )
+ private Logger logger = NullLoggerFactory.LOGGER;
+
+ @Requirement
+ private MetadataResolver metadataResolver;
+
+ @Requirement
+ private SyncContextFactory syncContextFactory;
+
+ @Requirement
+ private RepositoryEventDispatcher repositoryEventDispatcher;
+
+ public DefaultVersionResolver()
+ {
+ // enable no-arg constructor
+ }
+
+ @Inject
+ DefaultVersionResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
+ RepositoryEventDispatcher repositoryEventDispatcher, LoggerFactory loggerFactory )
+ {
+ setMetadataResolver( metadataResolver );
+ setSyncContextFactory( syncContextFactory );
+ setLoggerFactory( loggerFactory );
+ setRepositoryEventDispatcher( repositoryEventDispatcher );
+ }
+
+ public void initService( ServiceLocator locator )
+ {
+ setLoggerFactory( locator.getService( LoggerFactory.class ) );
+ setMetadataResolver( locator.getService( MetadataResolver.class ) );
+ setSyncContextFactory( locator.getService( SyncContextFactory.class ) );
+ setRepositoryEventDispatcher( locator.getService( RepositoryEventDispatcher.class ) );
+ }
+
+ public DefaultVersionResolver setLoggerFactory( LoggerFactory loggerFactory )
+ {
+ this.logger = NullLoggerFactory.getSafeLogger( loggerFactory, getClass() );
+ return this;
+ }
+
+ void setLogger( LoggerFactory loggerFactory )
+ {
+ // plexus support
+ setLoggerFactory( loggerFactory );
+ }
+
+ public DefaultVersionResolver setMetadataResolver( MetadataResolver metadataResolver )
+ {
+ this.metadataResolver = Validate.notNull( metadataResolver, "metadataResolver cannot be null" );
+ return this;
+ }
+
+ public DefaultVersionResolver setSyncContextFactory( SyncContextFactory syncContextFactory )
+ {
+ this.syncContextFactory = Validate.notNull( syncContextFactory, "syncContextFactory cannot be null" );
+ return this;
+ }
+
+ public DefaultVersionResolver setRepositoryEventDispatcher( RepositoryEventDispatcher repositoryEventDispatcher )
+ {
+ this.repositoryEventDispatcher = Validate.notNull( repositoryEventDispatcher,
+ "repositoryEventDispatcher cannot be null" );
+ return this;
+ }
+
+ public VersionResult resolveVersion( RepositorySystemSession session, VersionRequest request )
+ throws VersionResolutionException
+ {
+ RequestTrace trace = RequestTrace.newChild( request.getTrace(), request );
+
+ Artifact artifact = request.getArtifact();
+
+ String version = artifact.getVersion();
+
+ VersionResult result = new VersionResult( request );
+
+ Key cacheKey = null;
+ RepositoryCache cache = session.getCache();
+ if ( cache != null && !ConfigUtils.getBoolean( session, false, "aether.versionResolver.noCache" ) )
+ {
+ cacheKey = new Key( session, request );
+
+ Object obj = cache.get( session, cacheKey );
+ if ( obj instanceof Record )
+ {
+ Record record = (Record) obj;
+ result.setVersion( record.version );
+ result.setRepository(
+ CacheUtils.getRepository( session, request.getRepositories(), record.repoClass, record.repoId ) );
+ return result;
+ }
+ }
+
+ Metadata metadata;
+
+ if ( RELEASE.equals( version ) )
+ {
+ metadata = new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), MAVEN_METADATA_XML,
+ Metadata.Nature.RELEASE );
+ }
+ else if ( LATEST.equals( version ) )
+ {
+ metadata = new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), MAVEN_METADATA_XML,
+ Metadata.Nature.RELEASE_OR_SNAPSHOT );
+ }
+ else if ( version.endsWith( SNAPSHOT ) )
+ {
+ WorkspaceReader workspace = session.getWorkspaceReader();
+ if ( workspace != null && workspace.findVersions( artifact ).contains( version ) )
+ {
+ metadata = null;
+ result.setRepository( workspace.getRepository() );
+ }
+ else
+ {
+ metadata =
+ new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), version, MAVEN_METADATA_XML,
+ Metadata.Nature.SNAPSHOT );
+ }
+ }
+ else
+ {
+ metadata = null;
+ }
+
+ if ( metadata == null )
+ {
+ result.setVersion( version );
+ }
+ else
+ {
+ List<MetadataRequest> metadataReqs = new ArrayList<>( request.getRepositories().size() );
+
+ metadataReqs.add( new MetadataRequest( metadata, null, request.getRequestContext() ) );
+
+ for ( RemoteRepository repository : request.getRepositories() )
+ {
+ MetadataRequest metadataRequest =
+ new MetadataRequest( metadata, repository, request.getRequestContext() );
+ metadataRequest.setDeleteLocalCopyIfMissing( true );
+ metadataRequest.setFavorLocalRepository( true );
+ metadataRequest.setTrace( trace );
+ metadataReqs.add( metadataRequest );
+ }
+
+ List<MetadataResult> metadataResults = metadataResolver.resolveMetadata( session, metadataReqs );
+
+ Map<String, VersionInfo> infos = new HashMap<>();
+
+ for ( MetadataResult metadataResult : metadataResults )
+ {
+ result.addException( metadataResult.getException() );
+
+ ArtifactRepository repository = metadataResult.getRequest().getRepository();
+ if ( repository == null )
+ {
+ repository = session.getLocalRepository();
+ }
+
+ Versioning v = readVersions( session, trace, metadataResult.getMetadata(), repository, result );
+ merge( artifact, infos, v, repository );
+ }
+
+ if ( RELEASE.equals( version ) )
+ {
+ resolve( result, infos, RELEASE );
+ }
+ else if ( LATEST.equals( version ) )
+ {
+ if ( !resolve( result, infos, LATEST ) )
+ {
+ resolve( result, infos, RELEASE );
+ }
+
+ if ( result.getVersion() != null && result.getVersion().endsWith( SNAPSHOT ) )
+ {
+ VersionRequest subRequest = new VersionRequest();
+ subRequest.setArtifact( artifact.setVersion( result.getVersion() ) );
+ if ( result.getRepository() instanceof RemoteRepository )
+ {
+ RemoteRepository r = (RemoteRepository) result.getRepository();
+ subRequest.setRepositories( Collections.singletonList( r ) );
+ }
+ else
+ {
+ subRequest.setRepositories( request.getRepositories() );
+ }
+ VersionResult subResult = resolveVersion( session, subRequest );
+ result.setVersion( subResult.getVersion() );
+ result.setRepository( subResult.getRepository() );
+ for ( Exception exception : subResult.getExceptions() )
+ {
+ result.addException( exception );
+ }
+ }
+ }
+ else
+ {
+ String key = SNAPSHOT + getKey( artifact.getClassifier(), artifact.getExtension() );
+ merge( infos, SNAPSHOT, key );
+ if ( !resolve( result, infos, key ) )
+ {
+ result.setVersion( version );
+ }
+ }
+
+ if ( StringUtils.isEmpty( result.getVersion() ) )
+ {
+ throw new VersionResolutionException( result );
+ }
+ }
+
+ if ( cacheKey != null && metadata != null && isSafelyCacheable( session, artifact ) )
+ {
+ cache.put( session, cacheKey, new Record( result.getVersion(), result.getRepository() ) );
+ }
+
+ return result;
+ }
+
+ private boolean resolve( VersionResult result, Map<String, VersionInfo> infos, String key )
+ {
+ VersionInfo info = infos.get( key );
+ if ( info != null )
+ {
+ result.setVersion( info.version );
+ result.setRepository( info.repository );
+ }
+ return info != null;
+ }
+
+ private Versioning readVersions( RepositorySystemSession session, RequestTrace trace, Metadata metadata,
+ ArtifactRepository repository, VersionResult result )
+ {
+ Versioning versioning = null;
+
+ FileInputStream fis = null;
+ try
+ {
+ if ( metadata != null )
+ {
+
+ try ( SyncContext syncContext = syncContextFactory.newInstance( session, true ) )
+ {
+ syncContext.acquire( null, Collections.singleton( metadata ) );
+
+ if ( metadata.getFile() != null && metadata.getFile().exists() )
+ {
+ fis = new FileInputStream( metadata.getFile() );
+ org.apache.maven.artifact.repository.metadata.Metadata m =
+ new MetadataXpp3Reader().read( fis, false );
+ versioning = m.getVersioning();
+
+ /*
+ * NOTE: Users occasionally misuse the id "local" for remote repos which screws up the metadata
+ * of the local repository. This is especially troublesome during snapshot resolution so we try
+ * to handle that gracefully.
+ */
+ if ( versioning != null && repository instanceof LocalRepository )
+ {
+ if ( versioning.getSnapshot() != null && versioning.getSnapshot().getBuildNumber() > 0 )
+ {
+ Versioning repaired = new Versioning();
+ repaired.setLastUpdated( versioning.getLastUpdated() );
+ Snapshot snapshot = new Snapshot();
+ snapshot.setLocalCopy( true );
+ repaired.setSnapshot( snapshot );
+ versioning = repaired;
+
+ throw new IOException( "Snapshot information corrupted with remote repository data"
+ + ", please verify that no remote repository uses the id '"
+ + repository.getId() + "'" );
+ }
+ }
+ }
+ }
+ }
+ }
+ catch ( Exception e )
+ {
+ invalidMetadata( session, trace, metadata, repository, e );
+ result.addException( e );
+ }
+ finally
+ {
+ IOUtil.close( fis );
+ }
+
+ return ( versioning != null ) ? versioning : new Versioning();
+ }
+
+ private void invalidMetadata( RepositorySystemSession session, RequestTrace trace, Metadata metadata,
+ ArtifactRepository repository, Exception exception )
+ {
+ RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.METADATA_INVALID );
+ event.setTrace( trace );
+ event.setMetadata( metadata );
+ event.setException( exception );
+ event.setRepository( repository );
+
+ repositoryEventDispatcher.dispatch( event.build() );
+ }
+
+ private void merge( Artifact artifact, Map<String, VersionInfo> infos, Versioning versioning,
+ ArtifactRepository repository )
+ {
+ if ( StringUtils.isNotEmpty( versioning.getRelease() ) )
+ {
+ merge( RELEASE, infos, versioning.getLastUpdated(), versioning.getRelease(), repository );
+ }
+
+ if ( StringUtils.isNotEmpty( versioning.getLatest() ) )
+ {
+ merge( LATEST, infos, versioning.getLastUpdated(), versioning.getLatest(), repository );
+ }
+
+ for ( SnapshotVersion sv : versioning.getSnapshotVersions() )
+ {
+ if ( StringUtils.isNotEmpty( sv.getVersion() ) )
+ {
+ String key = getKey( sv.getClassifier(), sv.getExtension() );
+ merge( SNAPSHOT + key, infos, sv.getUpdated(), sv.getVersion(), repository );
+ }
+ }
+
+ Snapshot snapshot = versioning.getSnapshot();
+ if ( snapshot != null && versioning.getSnapshotVersions().isEmpty() )
+ {
+ String version = artifact.getVersion();
+ if ( snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0 )
+ {
+ String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber();
+ version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
+ }
+ merge( SNAPSHOT, infos, versioning.getLastUpdated(), version, repository );
+ }
+ }
+
+ private void merge( String key, Map<String, VersionInfo> infos, String timestamp, String version,
+ ArtifactRepository repository )
+ {
+ VersionInfo info = infos.get( key );
+ if ( info == null )
+ {
+ info = new VersionInfo( timestamp, version, repository );
+ infos.put( key, info );
+ }
+ else if ( info.isOutdated( timestamp ) )
+ {
+ info.version = version;
+ info.repository = repository;
+ info.timestamp = timestamp;
+ }
+ }
+
+ private void merge( Map<String, VersionInfo> infos, String srcKey, String dstKey )
+ {
+ VersionInfo srcInfo = infos.get( srcKey );
+ VersionInfo dstInfo = infos.get( dstKey );
+
+ if ( dstInfo == null || ( srcInfo != null && dstInfo.isOutdated( srcInfo.timestamp )
+ && srcInfo.repository != dstInfo.repository ) )
+ {
+ infos.put( dstKey, srcInfo );
+ }
+ }
+
+ private String getKey( String classifier, String extension )
+ {
+ return StringUtils.clean( classifier ) + ':' + StringUtils.clean( extension );
+ }
+
+ private boolean isSafelyCacheable( RepositorySystemSession session, Artifact artifact )
+ {
+ /*
+ * The workspace/reactor is in flux so we better not assume definitive information for any of its
+ * artifacts/projects.
+ */
+
+ WorkspaceReader workspace = session.getWorkspaceReader();
+ if ( workspace == null )
+ {
+ return true;
+ }
+
+ Artifact pomArtifact = ArtifactDescriptorUtils.toPomArtifact( artifact );
+
+ return workspace.findArtifact( pomArtifact ) == null;
+ }
+
+ private static class VersionInfo
+ {
+
+ String timestamp;
+
+ String version;
+
+ ArtifactRepository repository;
+
+ public VersionInfo( String timestamp, String version, ArtifactRepository repository )
+ {
+ this.timestamp = ( timestamp != null ) ? timestamp : "";
+ this.version = version;
+ this.repository = repository;
+ }
+
+ public boolean isOutdated( String timestamp )
+ {
+ return timestamp != null && timestamp.compareTo( this.timestamp ) > 0;
+ }
+
+ }
+
+ private static class Key
+ {
+
+ private final String groupId;
+
+ private final String artifactId;
+
+ private final String classifier;
+
+ private final String extension;
+
+ private final String version;
+
+ private final String context;
+
+ private final File localRepo;
+
+ private final WorkspaceRepository workspace;
+
+ private final List<RemoteRepository> repositories;
+
+ private final int hashCode;
+
+ public Key( RepositorySystemSession session, VersionRequest request )
+ {
+ Artifact artifact = request.getArtifact();
+ groupId = artifact.getGroupId();
+ artifactId = artifact.getArtifactId();
+ classifier = artifact.getClassifier();
+ extension = artifact.getExtension();
+ version = artifact.getVersion();
+ localRepo = session.getLocalRepository().getBasedir();
+ workspace = CacheUtils.getWorkspace( session );
+ repositories = new ArrayList<>( request.getRepositories().size() );
+ boolean repoMan = false;
+ for ( RemoteRepository repository : request.getRepositories() )
+ {
+ if ( repository.isRepositoryManager() )
+ {
+ repoMan = true;
+ repositories.addAll( repository.getMirroredRepositories() );
+ }
+ else
+ {
+ repositories.add( repository );
+ }
+ }
+ context = repoMan ? request.getRequestContext() : "";
+
+ int hash = 17;
+ hash = hash * 31 + groupId.hashCode();
+ hash = hash * 31 + artifactId.hashCode();
+ hash = hash * 31 + classifier.hashCode();
+ hash = hash * 31 + extension.hashCode();
+ hash = hash * 31 + version.hashCode();
+ hash = hash * 31 + localRepo.hashCode();
+ hash = hash * 31 + CacheUtils.repositoriesHashCode( repositories );
+ hashCode = hash;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( obj == this )
+ {
+ return true;
+ }
+ else if ( obj == null || !getClass().equals( obj.getClass() ) )
+ {
+ return false;
+ }
+
+ Key that = (Key) obj;
+ return artifactId.equals( that.artifactId ) && groupId.equals( that.groupId ) && classifier.equals(
+ that.classifier ) && extension.equals( that.extension ) && version.equals( that.version )
+ && context.equals( that.context ) && localRepo.equals( that.localRepo )
+ && CacheUtils.eq( workspace, that.workspace )
+ && CacheUtils.repositoriesEquals( repositories, that.repositories );
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ }
+
+ private static class Record
+ {
+ final String version;
+
+ final String repoId;
+
+ final Class<?> repoClass;
+
+ public Record( String version, ArtifactRepository repository )
+ {
+ this.version = version;
+ if ( repository != null )
+ {
+ repoId = repository.getId();
+ repoClass = repository.getClass();
+ }
+ else
+ {
+ repoId = null;
+ repoClass = null;
+ }
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java
new file mode 100644
index 0000000..a572010
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java
@@ -0,0 +1,163 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.apache.maven.artifact.repository.metadata.Metadata;
+import org.apache.maven.artifact.repository.metadata.Snapshot;
+import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
+import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.eclipse.aether.artifact.Artifact;
+
+/**
+ * @author Benjamin Bentmann
+ */
+final class LocalSnapshotMetadata
+ extends MavenMetadata
+{
+
+ private final Collection<Artifact> artifacts = new ArrayList<>();
+
+ private final boolean legacyFormat;
+
+ public LocalSnapshotMetadata( Artifact artifact, boolean legacyFormat )
+ {
+ super( createMetadata( artifact, legacyFormat ), null );
+ this.legacyFormat = legacyFormat;
+ }
+
+ public LocalSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
+ {
+ super( metadata, file );
+ this.legacyFormat = legacyFormat;
+ }
+
+ private static Metadata createMetadata( Artifact artifact, boolean legacyFormat )
+ {
+ Snapshot snapshot = new Snapshot();
+ snapshot.setLocalCopy( true );
+ Versioning versioning = new Versioning();
+ versioning.setSnapshot( snapshot );
+
+ Metadata metadata = new Metadata();
+ metadata.setVersioning( versioning );
+ metadata.setGroupId( artifact.getGroupId() );
+ metadata.setArtifactId( artifact.getArtifactId() );
+ metadata.setVersion( artifact.getBaseVersion() );
+
+ if ( !legacyFormat )
+ {
+ metadata.setModelVersion( "1.1.0" );
+ }
+
+ return metadata;
+ }
+
+ public void bind( Artifact artifact )
+ {
+ artifacts.add( artifact );
+ }
+
+ public MavenMetadata setFile( File file )
+ {
+ return new LocalSnapshotMetadata( metadata, file, legacyFormat );
+ }
+
+ public Object getKey()
+ {
+ return getGroupId() + ':' + getArtifactId() + ':' + getVersion();
+ }
+
+ public static Object getKey( Artifact artifact )
+ {
+ return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion();
+ }
+
+ @Override
+ protected void merge( Metadata recessive )
+ {
+ metadata.getVersioning().updateTimestamp();
+
+ if ( !legacyFormat )
+ {
+ String lastUpdated = metadata.getVersioning().getLastUpdated();
+
+ Map<String, SnapshotVersion> versions = new LinkedHashMap<>();
+
+ for ( Artifact artifact : artifacts )
+ {
+ SnapshotVersion sv = new SnapshotVersion();
+ sv.setClassifier( artifact.getClassifier() );
+ sv.setExtension( artifact.getExtension() );
+ sv.setVersion( getVersion() );
+ sv.setUpdated( lastUpdated );
+ versions.put( getKey( sv.getClassifier(), sv.getExtension() ), sv );
+ }
+
+ Versioning versioning = recessive.getVersioning();
+ if ( versioning != null )
+ {
+ for ( SnapshotVersion sv : versioning.getSnapshotVersions() )
+ {
+ String key = getKey( sv.getClassifier(), sv.getExtension() );
+ if ( !versions.containsKey( key ) )
+ {
+ versions.put( key, sv );
+ }
+ }
+ }
+
+ metadata.getVersioning().setSnapshotVersions( new ArrayList<>( versions.values() ) );
+ }
+
+ artifacts.clear();
+ }
+
+ private String getKey( String classifier, String extension )
+ {
+ return classifier + ':' + extension;
+ }
+
+ public String getGroupId()
+ {
+ return metadata.getGroupId();
+ }
+
+ public String getArtifactId()
+ {
+ return metadata.getArtifactId();
+ }
+
+ public String getVersion()
+ {
+ return metadata.getVersion();
+ }
+
+ public Nature getNature()
+ {
+ return Nature.SNAPSHOT;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadataGenerator.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadataGenerator.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadataGenerator.java
new file mode 100644
index 0000000..072ba66
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadataGenerator.java
@@ -0,0 +1,82 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.impl.MetadataGenerator;
+import org.eclipse.aether.installation.InstallRequest;
+import org.eclipse.aether.metadata.Metadata;
+import org.eclipse.aether.util.ConfigUtils;
+
+/**
+ * @author Benjamin Bentmann
+ */
+class LocalSnapshotMetadataGenerator
+ implements MetadataGenerator
+{
+
+ private Map<Object, LocalSnapshotMetadata> snapshots;
+
+ private final boolean legacyFormat;
+
+ public LocalSnapshotMetadataGenerator( RepositorySystemSession session, InstallRequest request )
+ {
+ legacyFormat = ConfigUtils.getBoolean( session.getConfigProperties(), false, "maven.metadata.legacy" );
+
+ snapshots = new LinkedHashMap<>();
+ }
+
+ public Collection<? extends Metadata> prepare( Collection<? extends Artifact> artifacts )
+ {
+ for ( Artifact artifact : artifacts )
+ {
+ if ( artifact.isSnapshot() )
+ {
+ Object key = LocalSnapshotMetadata.getKey( artifact );
+ LocalSnapshotMetadata snapshotMetadata = snapshots.get( key );
+ if ( snapshotMetadata == null )
+ {
+ snapshotMetadata = new LocalSnapshotMetadata( artifact, legacyFormat );
+ snapshots.put( key, snapshotMetadata );
+ }
+ snapshotMetadata.bind( artifact );
+ }
+ }
+
+ return Collections.emptyList();
+ }
+
+ public Artifact transformArtifact( Artifact artifact )
+ {
+ return artifact;
+ }
+
+ public Collection<? extends Metadata> finish( Collection<? extends Artifact> artifacts )
+ {
+ return snapshots.values();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java
new file mode 100644
index 0000000..41e98aa
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java
@@ -0,0 +1,80 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.model.building.DefaultModelBuilderFactory;
+import org.apache.maven.model.building.ModelBuilder;
+import org.eclipse.aether.impl.AetherModule;
+import org.eclipse.aether.impl.ArtifactDescriptorReader;
+import org.eclipse.aether.impl.MetadataGeneratorFactory;
+import org.eclipse.aether.impl.VersionRangeResolver;
+import org.eclipse.aether.impl.VersionResolver;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.name.Names;
+
+/**
+ * @deprecated As of Maven Resolver 1.0.3, please use class {@link MavenResolverModule}.
+ */
+@Deprecated
+public final class MavenAetherModule
+ extends AbstractModule
+{
+
+ @Override
+ protected void configure()
+ {
+ install( new AetherModule() );
+ bind( ArtifactDescriptorReader.class ) //
+ .to( DefaultArtifactDescriptorReader.class ).in( Singleton.class );
+ bind( VersionResolver.class ) //
+ .to( DefaultVersionResolver.class ).in( Singleton.class );
+ bind( VersionRangeResolver.class ) //
+ .to( DefaultVersionRangeResolver.class ).in( Singleton.class );
+ bind( MetadataGeneratorFactory.class ).annotatedWith( Names.named( "snapshot" ) ) //
+ .to( SnapshotMetadataGeneratorFactory.class ).in( Singleton.class );
+ bind( MetadataGeneratorFactory.class ).annotatedWith( Names.named( "versions" ) ) //
+ .to( VersionsMetadataGeneratorFactory.class ).in( Singleton.class );
+ bind( ModelBuilder.class ) //
+ .toInstance( new DefaultModelBuilderFactory().newInstance() );
+ }
+
+ @Provides
+ @Singleton
+ Set<MetadataGeneratorFactory> provideMetadataGeneratorFactories( @Named( "snapshot" )
+ MetadataGeneratorFactory snapshot,
+ @Named( "versions" )
+ MetadataGeneratorFactory versions )
+ {
+ Set<MetadataGeneratorFactory> factories = new HashSet<>();
+ factories.add( snapshot );
+ factories.add( versions );
+ return Collections.unmodifiableSet( factories );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/8972072e/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java
----------------------------------------------------------------------
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java
new file mode 100644
index 0000000..aef44f6
--- /dev/null
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java
@@ -0,0 +1,137 @@
+package org.apache.maven.repository.internal;
+
+/*
+ * 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.artifact.repository.metadata.Metadata;
+import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
+import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.WriterFactory;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.eclipse.aether.RepositoryException;
+import org.eclipse.aether.metadata.AbstractMetadata;
+import org.eclipse.aether.metadata.MergeableMetadata;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * @author Benjamin Bentmann
+ */
+abstract class MavenMetadata
+ extends AbstractMetadata
+ implements MergeableMetadata
+{
+
+ static final String MAVEN_METADATA_XML = "maven-metadata.xml";
+
+ private final File file;
+
+ protected Metadata metadata;
+
+ private boolean merged;
+
+ protected MavenMetadata( Metadata metadata, File file )
+ {
+ this.metadata = metadata;
+ this.file = file;
+ }
+
+ public String getType()
+ {
+ return MAVEN_METADATA_XML;
+ }
+
+ public File getFile()
+ {
+ return file;
+ }
+
+ public void merge( File existing, File result )
+ throws RepositoryException
+ {
+ Metadata recessive = read( existing );
+
+ merge( recessive );
+
+ write( result, metadata );
+
+ merged = true;
+ }
+
+ public boolean isMerged()
+ {
+ return merged;
+ }
+
+ protected abstract void merge( Metadata recessive );
+
+ static Metadata read( File metadataFile )
+ throws RepositoryException
+ {
+ if ( metadataFile.length() <= 0 )
+ {
+ return new Metadata();
+ }
+
+ try ( Reader reader = ReaderFactory.newXmlReader( metadataFile ) )
+ {
+ return new MetadataXpp3Reader().read( reader, false );
+ }
+ catch ( IOException e )
+ {
+ throw new RepositoryException( "Could not read metadata " + metadataFile + ": " + e.getMessage(), e );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new RepositoryException( "Could not parse metadata " + metadataFile + ": " + e.getMessage(), e );
+ }
+ }
+
+ private void write( File metadataFile, Metadata metadata )
+ throws RepositoryException
+ {
+ metadataFile.getParentFile().mkdirs();
+ try ( Writer writer = WriterFactory.newXmlWriter( metadataFile ) )
+ {
+ new MetadataXpp3Writer().write( writer, metadata );
+ }
+ catch ( IOException e )
+ {
+ throw new RepositoryException( "Could not write metadata " + metadataFile + ": " + e.getMessage(), e );
+ }
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return Collections.emptyMap();
+ }
+
+ @Override
+ public org.eclipse.aether.metadata.Metadata setProperties( Map<String, String> properties )
+ {
+ return this;
+ }
+
+}