You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by og...@apache.org on 2009/04/28 03:53:23 UTC
svn commit: r769219 - in
/maven/components/branches/maven-3.0-mercury-763966: ./ apache-maven/
maven-compat/src/main/java/org/apache/maven/artifact/repository/
maven-mercury/ maven-project/
maven-project/src/test/java/org/apache/maven/repository/ maven...
Author: ogusakov
Date: Tue Apr 28 01:53:22 2009
New Revision: 769219
URL: http://svn.apache.org/viewvc?rev=769219&view=rev
Log:
adjusted this branch for mercury alpha-8 snapshot
Added:
maven/components/branches/maven-3.0-mercury-763966/maven-compat/src/main/java/org/apache/maven/artifact/repository/ReactorArtifactRepository.java (with props)
Removed:
maven/components/branches/maven-3.0-mercury-763966/maven-project/src/test/java/org/apache/maven/repository/LegacyMavenRepositorySystemTest.java
maven/components/branches/maven-3.0-mercury-763966/maven-repository/src/test/java/org/apache/maven/repository/AbstractMavenRepositorySystemTest.java
Modified:
maven/components/branches/maven-3.0-mercury-763966/apache-maven/pom.xml
maven/components/branches/maven-3.0-mercury-763966/build-mercury.xml
maven/components/branches/maven-3.0-mercury-763966/maven-mercury/pom.xml
maven/components/branches/maven-3.0-mercury-763966/maven-project/pom.xml
maven/components/branches/maven-3.0-mercury-763966/maven-repository-mercury/src/main/java/org/apache/maven/repository/mercury/MercuryAdaptor.java
maven/components/branches/maven-3.0-mercury-763966/maven-repository-mercury/src/main/java/org/apache/maven/repository/mercury/MercuryRepositorySystem.java
maven/components/branches/maven-3.0-mercury-763966/maven-repository/pom.xml
maven/components/branches/maven-3.0-mercury-763966/pom.xml
Modified: maven/components/branches/maven-3.0-mercury-763966/apache-maven/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-3.0-mercury-763966/apache-maven/pom.xml?rev=769219&r1=769218&r2=769219&view=diff
==============================================================================
--- maven/components/branches/maven-3.0-mercury-763966/apache-maven/pom.xml (original)
+++ maven/components/branches/maven-3.0-mercury-763966/apache-maven/pom.xml Tue Apr 28 01:53:22 2009
@@ -68,19 +68,12 @@
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
</dependency>
- <!--Mercury MP3-->
+ <!--Mercury MP3
<dependency>
<groupId>org.sonatype.mercury</groupId>
<artifactId>mercury-mp3-cli</artifactId>
</dependency>
- <dependency>
- <!--
- FIXME: org.sonatype.mercury:mercury-mp3:1.0-alpha-1:pom depends on a snapshot version of mercury-event.
- -->
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-event</artifactId>
- <version>${mercuryVersion}</version>
- </dependency>
+-->
</dependencies>
<build>
<plugins>
Modified: maven/components/branches/maven-3.0-mercury-763966/build-mercury.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-3.0-mercury-763966/build-mercury.xml?rev=769219&r1=769218&r2=769219&view=diff
==============================================================================
--- maven/components/branches/maven-3.0-mercury-763966/build-mercury.xml (original)
+++ maven/components/branches/maven-3.0-mercury-763966/build-mercury.xml Tue Apr 28 01:53:22 2009
@@ -71,9 +71,9 @@
<property name="maven.repo.update.policy" value="always"/>
-->
<property name="maven.repo.update.policy" value="daily"/>
-
+
<property name="maven.repo.system" value="don.t"/>
-
+
<condition property="do.not.clean.local.repo">
<not>
<isset property="clean.local.repo"/>
@@ -110,13 +110,13 @@
<replacefilter token='@Component( role = RepositorySystem.class, hint = "default" )'
value='@Component( role = RepositorySystem.class, hint = "${mercury-hint}" )'/>
</replace>
-
+
<echo>maven.repo.system is ${maven.repo.system}, flip: legacy-hint=${legacy-hint}, mercury-hint=${mercury-hint}</echo>
</target>
<target name="flip-default-repository-system" description="flips repository system impl">
-
+
<condition property="legacy-hint" value="default">
<equals arg1="${maven.repo.system}" arg2="legacy"/>
</condition>
@@ -130,11 +130,11 @@
<condition property="mercury-hint" value="default">
<equals arg1="${maven.repo.system}" arg2="mercury"/>
</condition>
-
+
<condition property="do.not.flip.repository" value="default">
<equals arg1="${maven.repo.system}" arg2="don.t"/>
</condition>
-
+
<antcall target="flip-default-repository"/>
</target>
@@ -143,8 +143,8 @@
<property name="verbose" value="false"/>
<!-- Pull the dependencies that Maven needs to build -->
<copy file="pom.xml" tofile="dependencies.xml"/>
- <replace file="${basedir}/dependencies.xml" token="<!--start-->" value="<!--"/>
- <replace file="${basedir}/dependencies.xml" token="<!--end-->" value="-->"/>
+ <replace file="${basedir}/dependencies.xml" token="<!--bootstrap-start-comment-->" value="<!--"/>
+ <replace file="${basedir}/dependencies.xml" token="<!--bootstrap-end-comment-->" value="-->"/>
<mercury:local-repository location="${maven.repo.local}"/>
<mercury:remote-repository id="central" location="${maven.repo.central}" updatePolicy="${maven.repo.update.policy}"/>
@@ -152,7 +152,10 @@
<property name="tsFormat" value="HH:mm:ss"/>
<tstamp><format property="start.time" pattern="${tsFormat}"/></tstamp>
- <!-- classpaths with default names: mercury.classpath, mercury.classpath.test, mercury.classpath.runtime -->
+ <!--
+ == classpaths with default names: mercury.classpath, mercury.classpath.test, mercury.classpath.runtime
+ == only compile one is created because of explicit scope
+ -->
<mercury:resolve-dependencies scope="compile">
<mercury:dependency source="maven:${basedir}/dependencies.xml"/>
<mercury:dependency id="org.codehaus.plexus:plexus-component-metadata:${pom.properties.plexusVersion}"/>
@@ -161,6 +164,39 @@
<mercury:exclusion id="org.sonatype.mercury:mercury-mp3-cli"/>
<mercury:exclusion id="org.sonatype.mercury:mercury-mp3-delta"/>
<mercury:exclusion id="org.sonatype.mercury:mercury-mp3-api"/>
+
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-repo-remote-m2"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-repo-api"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-external"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-transport-http"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-transport-api"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-repo-local-m2"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-repo-virtual"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-repo-cache-fs"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-md-sat"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-md-shared"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-artifact"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-util"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-crypto-basic"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-crypto-api"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-event"/>
+ <mercury:exclusion id="org.apache.maven.mercury:mercury-logging"/>
+
+ <mercury:exclusion id="classworlds:classworlds"/>
+
+ <mercury:exclusion id="org.codehaus.plexus:plexus-component-api"/>
+<!--
+ <mercury:exclusion id="org.apache.maven:maven-artifact-manager"/>
+ <mercury:exclusion id="org.apache.maven:maven-artifact"/>
+ <mercury:exclusion id="org.apache.maven:maven-model"/>
+ <mercury:exclusion id="org.apache.maven:maven-plugin-api"/>
+ <mercury:exclusion id="org.apache.maven:maven-plugin-registry"/>
+ <mercury:exclusion id="org.apache.maven:maven-profile"/>
+ <mercury:exclusion id="org.apache.maven:maven-project"/>
+ <mercury:exclusion id="org.apache.maven:maven-repository-metadata"/>
+ <mercury:exclusion id="org.apache.maven:maven-settings"/>
+-->
+
</mercury:exclusions>
</mercury:resolve-dependencies>
@@ -280,7 +316,14 @@
<mkdir dir="bootstrap/target/classes"/>
- <javac destdir="bootstrap/target/classes" encoding="UTF-8" source="1.5" target="1.5" debug="true">
+ <javac destdir="bootstrap/target/classes" encoding="UTF-8" source="1.5" target="1.5" debug="true"
+ >
+<!--
+listfiles="true"
+includeAntRuntime="false"
+verbose="true"
+
+-->
<src refid="sources"/>
<classpath refid="mercury.classpath"/>
</javac>
@@ -301,16 +344,17 @@
<arg value="-B"/>
<arg value="clean"/>
<arg value="install"/>
- <arg value="-Dmaven.repo.local=${maven.repo.local}"/>
- <arg value="-Dsurefire.useFile=${surefire.useFile}"/>
+
+ <jvmarg value="-Dmaven.repo.local=${maven.repo.local}"/>
+ <jvmarg value="-Dsurefire.useFile=${surefire.useFile}"/>
<!--
<debug-the-bootstrap>
-
+-->
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>
-
+<!--
</debug-the-bootstrap>
-->
</java>
Added: maven/components/branches/maven-3.0-mercury-763966/maven-compat/src/main/java/org/apache/maven/artifact/repository/ReactorArtifactRepository.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-3.0-mercury-763966/maven-compat/src/main/java/org/apache/maven/artifact/repository/ReactorArtifactRepository.java?rev=769219&view=auto
==============================================================================
--- maven/components/branches/maven-3.0-mercury-763966/maven-compat/src/main/java/org/apache/maven/artifact/repository/ReactorArtifactRepository.java (added)
+++ maven/components/branches/maven-3.0-mercury-763966/maven-compat/src/main/java/org/apache/maven/artifact/repository/ReactorArtifactRepository.java Tue Apr 28 01:53:22 2009
@@ -0,0 +1,251 @@
+/*
+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.
+*/
+
+package org.apache.maven.artifact.repository;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+/**
+ *
+ *
+ * @author Oleg Gusakov
+ * @version $Id$
+ *
+ */
+
+@Component( role=ArtifactRepository.class,hint="reactor")
+public class ReactorArtifactRepository
+//extends Repository
+implements ArtifactRepository
+{
+ private static final ArtifactRepositoryPolicy SNAPSHOTS_POLICY = new ArtifactRepositoryPolicy(true, ArtifactRepositoryPolicy.UPDATE_POLICY_NEVER, ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE);
+
+ private static final ArtifactRepositoryPolicy RELEASES_POLICY = new ArtifactRepositoryPolicy(true, ArtifactRepositoryPolicy.UPDATE_POLICY_NEVER, ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE);
+
+ private static final String ID = "reactorRepository";
+
+ private static final String PROTOCOL = "file";
+
+ private String url;
+
+ private String baseDir;
+
+ @Requirement(role=ArtifactRepositoryLayout.class, hint="default")
+ private static ArtifactRepositoryLayout layout;
+
+ private Map<String, String> storage = new HashMap<String, String>(32);
+
+ public static String calculateKey( Artifact artifact )
+ {
+ // GAV only
+ return artifact.getGroupId()+":"+artifact.getArtifactId()+":"+artifact.getVersion();
+ }
+
+ private static String calculateBinaryName( Artifact artifact )
+ {
+ String type = artifact.getType();
+
+ String classifier = artifact.getClassifier();
+
+ if( "test-jar".equals( type ) )
+ {
+ type = "jar";
+ classifier = "tests";
+ }
+ else if( "maven-plugin".equals( type ) )
+ {
+ type = "jar";
+ classifier = null;
+ }
+
+ boolean hasClassifier = classifier != null && classifier.length() > 0;
+
+ return artifact.getArtifactId()+"-"+artifact.getVersion()
+ + (hasClassifier ? "-"+classifier : "" )
+ + "." + type
+ ;
+ }
+
+ /**
+ * initialize this repository with the top level project. No need to add it as an Artifact because
+ * it will be added from a sorted artifact list
+ *
+ * @param artifact
+ * @param baseDir
+ * @param outputPath
+ */
+ public void setReactorRoot( Artifact artifact, File baseDir, String outputPath )
+ {
+ try
+ {
+ this.baseDir = baseDir.getCanonicalPath();
+
+ this.url = baseDir.toURL().toString();
+ }
+ catch ( IOException e )
+ {
+ throw new IllegalArgumentException( "top level project's directory \""+baseDir+"\" error: "+e.getMessage() );
+ }
+ }
+
+ public void addArtifact( Artifact artifact, String outputPath )
+ {
+ String key = calculateKey( artifact );
+
+ String relTarget = calculateRelativePath( baseDir, outputPath );
+
+ storage.put( key, relTarget );
+ }
+
+ /**
+ * calculate the diff of basedir
+ *
+ * @param baseDir parent folder
+ * @param outputPath full path of the child
+ * @return
+ */
+ private String calculateRelativePath( String baseDir, String outputPath )
+ {
+ int len = baseDir.length();
+
+ return outputPath.substring( len+1 );
+ }
+
+ public String pathOf( Artifact artifact )
+ {
+ String key = calculateKey( artifact );
+
+ String relTarget = storage.get( key );
+
+ if( relTarget == null )
+ return null;
+
+ String targetBinaryName = calculateBinaryName( artifact );
+
+ String path = relTarget+"/"+targetBinaryName;
+
+ File binary = new File( baseDir, path );
+
+ if( binary.exists() )
+ return path;
+
+ return null;
+ }
+
+ public String getKey()
+ {
+ return getId();
+ }
+
+ public ArtifactRepositoryLayout getLayout()
+ {
+ return layout;
+ }
+
+ public ArtifactRepositoryPolicy getReleases()
+ {
+ return RELEASES_POLICY;
+ }
+
+ public ArtifactRepositoryPolicy getSnapshots()
+ {
+ return SNAPSHOTS_POLICY;
+ }
+
+ public boolean isBlacklisted()
+ {
+ return false;
+ }
+
+ public boolean isUniqueVersion()
+ {
+ return true;
+ }
+
+ public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setBlacklisted( boolean blackListed )
+ {
+ // noop
+ }
+
+ public void setLayout( ArtifactRepositoryLayout layout )
+ {
+ // noop
+ }
+
+ public void setReleaseUpdatePolicy( ArtifactRepositoryPolicy policy )
+ {
+ // noop
+ }
+
+ public void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy policy )
+ {
+ // noop
+ }
+
+ public String getBasedir()
+ {
+ return baseDir;
+ }
+
+ public String getId()
+ {
+ return ID;
+ }
+
+ public String getProtocol()
+ {
+ return PROTOCOL;
+ }
+
+ public String getUrl()
+ {
+ return url;
+ }
+
+ public void setId( String id )
+ {
+ // noop
+ }
+
+ public void setUrl( String url )
+ {
+ // noop
+ }
+}
Propchange: maven/components/branches/maven-3.0-mercury-763966/maven-compat/src/main/java/org/apache/maven/artifact/repository/ReactorArtifactRepository.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-3.0-mercury-763966/maven-compat/src/main/java/org/apache/maven/artifact/repository/ReactorArtifactRepository.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/components/branches/maven-3.0-mercury-763966/maven-mercury/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-3.0-mercury-763966/maven-mercury/pom.xml?rev=769219&r1=769218&r2=769219&view=diff
==============================================================================
--- maven/components/branches/maven-3.0-mercury-763966/maven-mercury/pom.xml (original)
+++ maven/components/branches/maven-3.0-mercury-763966/maven-mercury/pom.xml Tue Apr 28 01:53:22 2009
@@ -24,12 +24,7 @@
<dependency>
<groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-artifact</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-external</artifactId>
+ <artifactId>mercury-core</artifactId>
</dependency>
<dependency>
@@ -48,39 +43,10 @@
</dependency>
<!-- test dependencies -->
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-util</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-repo-local-m2</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-repo-remote-m2</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-md-sat</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-transport-http</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-transport-http</artifactId>
+ <artifactId>mercury-core</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
Modified: maven/components/branches/maven-3.0-mercury-763966/maven-project/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-3.0-mercury-763966/maven-project/pom.xml?rev=769219&r1=769218&r2=769219&view=diff
==============================================================================
--- maven/components/branches/maven-3.0-mercury-763966/maven-project/pom.xml (original)
+++ maven/components/branches/maven-3.0-mercury-763966/maven-project/pom.xml Tue Apr 28 01:53:22 2009
@@ -76,14 +76,6 @@
<groupId>commons-jxpath</groupId>
<artifactId>commons-jxpath</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-repository</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.sonatype.plexus</groupId>
@@ -99,20 +91,7 @@
<dependency>
<groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-util</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-logging</artifactId>
- <version>${mercuryVersion}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-event</artifactId>
+ <artifactId>mercury-core</artifactId>
<version>${mercuryVersion}</version>
<scope>test</scope>
</dependency>
@@ -123,13 +102,6 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-crypto-basic</artifactId>
- <version>${mercuryVersion}</version>
- <scope>test</scope>
- </dependency>
-
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http-lightweight</artifactId>
Modified: maven/components/branches/maven-3.0-mercury-763966/maven-repository-mercury/src/main/java/org/apache/maven/repository/mercury/MercuryAdaptor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-3.0-mercury-763966/maven-repository-mercury/src/main/java/org/apache/maven/repository/mercury/MercuryAdaptor.java?rev=769219&r1=769218&r2=769219&view=diff
==============================================================================
--- maven/components/branches/maven-3.0-mercury-763966/maven-repository-mercury/src/main/java/org/apache/maven/repository/mercury/MercuryAdaptor.java (original)
+++ maven/components/branches/maven-3.0-mercury-763966/maven-repository-mercury/src/main/java/org/apache/maven/repository/mercury/MercuryAdaptor.java Tue Apr 28 01:53:22 2009
@@ -35,6 +35,8 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ReactorArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
import org.apache.maven.artifact.resolver.filter.IncludesArtifactFilter;
@@ -45,9 +47,13 @@
import org.apache.maven.mercury.builder.api.DependencyProcessor;
import org.apache.maven.mercury.repository.api.Repository;
import org.apache.maven.mercury.repository.local.m2.LocalRepositoryM2;
+import org.apache.maven.mercury.repository.local.map.DefaultStorage;
+import org.apache.maven.mercury.repository.local.map.LocalRepositoryMap;
+import org.apache.maven.mercury.repository.local.map.StorageException;
import org.apache.maven.mercury.repository.remote.m2.RemoteRepositoryM2;
import org.apache.maven.mercury.transport.api.Server;
import org.apache.maven.mercury.util.Util;
+import org.apache.maven.model.Dependency;
import org.apache.maven.repository.MavenArtifactMetadata;
import org.apache.maven.repository.MetadataGraph;
import org.apache.maven.repository.MetadataGraphNode;
@@ -61,6 +67,26 @@
private static Map<String, Repository> _repos = Collections.synchronizedMap( new HashMap<String, Repository>() );
+ private static LocalRepositoryMap _reactorRepository;
+
+ /**
+ * @param repository
+ * @throws StorageException
+ */
+ public static void initializeReactor( ReactorArtifactRepository repository, DependencyProcessor dependencyProcessor )
+ {
+ try
+ {
+ _reactorRepository = new LocalRepositoryMap( dependencyProcessor, new DefaultStorage() );
+
+// repository.
+ }
+ catch ( StorageException e )
+ {
+ throw new IllegalArgumentException( e );
+ }
+
+ }
public static List<Repository> toMercuryRepos( ArtifactRepository localRepository,
List<?> remoteRepositories,
DependencyProcessor dependencyProcessor
@@ -69,6 +95,21 @@
if ( localRepository == null && Util.isEmpty( remoteRepositories ) )
return null;
+ if( "legacy".equals( localRepository.getLayout().getId() ) )
+ return null;
+
+ if( !Util.isEmpty( remoteRepositories ) )
+ for( Object ro : remoteRepositories )
+ {
+ if( ArtifactRepository.class.isAssignableFrom( ro.getClass() ) )
+ {
+ ArtifactRepository ar = (ArtifactRepository) ro;
+
+ if( "legacy".equals( ar.getLayout().getId() ) )
+ return null;
+ }
+ }
+
int nRepos =
( localRepository == null ? 0 : 1 ) + ( Util.isEmpty( remoteRepositories ) ? 0 : remoteRepositories.size() );
@@ -90,6 +131,8 @@
lr = new LocalRepositoryM2( localRepository.getId(), localRepoDir, dependencyProcessor );
+// lr.setSnapshotAlwaysWins( true );
+
_repos.put( url, lr );
}
catch ( URISyntaxException e )
@@ -176,6 +219,7 @@
md.setVersion( a.getVersion() );
md.setType( a.getType() );
md.setScope( a.getScope() );
+ md.setOptional( a.isOptional() );
if( "test-jar".equals( a.getType() ) )
{
@@ -205,7 +249,7 @@
String type = isTestJar ? "jar" : a.getType();
- String classifier = isTestJar ? "tests" : a.getType();
+ String classifier = isTestJar ? "tests" : a.getClassifier();
Artifact ma = classifier == null
? af.createArtifact( a.getGroupId(), a.getArtifactId(), a.getVersion(), a.getScope(), type )
@@ -221,29 +265,60 @@
return ma;
}
+
+ public static Artifact toMavenArtifact( ArtifactFactory af, Artifact a )
+ {
+ // MavenProject likes this one - replaces it with an actual test jar is available
+ // bad idea - embedder tests don't like it
+// boolean isTestJar = "jar".equals( a.getType() ) && "tests".equals( a.getClassifier() );
+//
+// String type = isTestJar ? "test-jar" : a.getType();
+
+ Artifact ma = af.createArtifactWithClassifier( a.getGroupId(), a.getArtifactId(), a.getVersion(), a.getType(), a.getClassifier() );
+ ma.setScope( a.getScope() );
+
+ ma.setFile( a.getFile() );
+
+ ma.setResolved( a.getFile() != null );
+
+ ma.setResolvedVersion( a.getVersion() );
+
+ return ma;
+ }
public static Artifact toMavenArtifact( ArtifactFactory af, org.apache.maven.mercury.artifact.ArtifactMetadata a )
{
+ // MavenProject likes this one - replaces it with an actual test jar is available
+ // bad idea - embedder tests don't like it
+// boolean isTestJar = "jar".equals( a.getType() ) && "tests".equals( a.getClassifier() );
+//
+// String type = isTestJar ? "test-jar" : a.getType();
+
+ Artifact ma = af.createArtifactWithClassifier( a.getGroupId(), a.getArtifactId(), a.getVersion(), a.getType(), a.getClassifier() );
+ ma.setScope( a.getScope() );
+
+ return ma;
+ }
+
+ /**
+ * @param factory
+ * @param d
+ * @return
+ */
+ public static Artifact toMavenArtifact( ArtifactFactory af, Dependency a )
+ {
boolean isTestJar = "test-jar".equals( a.getType() );
String type = isTestJar ? "jar" : a.getType();
- String classifier = isTestJar ? "tests" : a.getType();
+ String classifier = isTestJar ? "tests" : a.getClassifier();
- Artifact ma = classifier == null
- ? af.createArtifact( a.getGroupId(), a.getArtifactId(), a.getVersion(), a.getScope(), type )
- : af.createArtifactWithClassifier( a.getGroupId(), a.getArtifactId(), a.getVersion(), type, classifier )
- ;
+ Artifact ma = af.createArtifactWithClassifier( a.getGroupId(), a.getArtifactId(), a.getVersion(), type, classifier );
ma.setScope( a.getScope() );
return ma;
}
- public static Artifact toMavenArtifact( ArtifactFactory af, String name )
- {
- return toMavenArtifact( af, new ArtifactMetadata(name) );
- }
-
public static ArtifactMetadata toMercuryArtifactMetadata( MavenArtifactMetadata md )
{
ArtifactMetadata mmd = new ArtifactMetadata();
@@ -341,19 +416,16 @@
*/
public static ArtifactScopeEnum extractScope( Artifact reqArtifact, boolean isPlugin, ArtifactFilter filter )
{
- String scopeStr = reqArtifact.getScope(); //org.apache.maven.mercury.artifact.Artifact.SCOPE_COMPILE;
+ String scopeStr = reqArtifact.getScope() == null
+ ? org.apache.maven.mercury.artifact.Artifact.SCOPE_COMPILE
+ : reqArtifact.getScope()
+ ;
if( filter != null )
{
if( ScopeArtifactFilter.class.isAssignableFrom( filter.getClass() ) )
scopeStr = ((ScopeArtifactFilter)filter).getScope();
}
-
-// if( "org.apache.maven.plugins:maven-remote-resources-plugin".equals(
-// reqArtifact.getGroupId()+":"+reqArtifact.getArtifactId()
-// )
-// ) scopeStr = null;
-
// else if( isPlugin )
// scopeStr = org.apache.maven.mercury.artifact.Artifact.SCOPE_RUNTIME;
@@ -375,17 +447,39 @@
return null;
}
-
- public static Map<String,ArtifactMetadata> toMercuryVersionMap(Map<String,Artifact> map )
+ static Map<String,ArtifactMetadata> _hackMap = new HashMap<String, ArtifactMetadata>();
+ static int _hackMapSize = 0;
+ static
+ {
+ ArtifactMetadata md;
+
+ md = new ArtifactMetadata( "cglib-nodep:cglib-nodep:2.1_3" );
+ md.setOptional( true );
+ _hackMap.put( md.toManagementString(), md );
+
+ md = new ArtifactMetadata( "javax:j2ee:1.4" );
+ md.setOptional( true );
+ _hackMap.put( md.toManagementString(), md );
+
+ _hackMapSize = _hackMap.size();
+ }
+
+ public static Map<String,ArtifactMetadata> toMercuryVersionMap(ArtifactResolutionRequest request )
{
- if( Util.isEmpty( map ) )
+ Map<String,Artifact> vmap = (Map<String,Artifact>)request.getManagedVersionMap();
+
+ if( Util.isEmpty( vmap ) )
return null;
- Map<String,ArtifactMetadata> res = new HashMap<String, ArtifactMetadata>( map.size() );
+ Map<String,ArtifactMetadata> res = new HashMap<String, ArtifactMetadata>( vmap.size()+_hackMapSize );
+
+// res.putAll( _hackMap );
- for( Entry<String, Artifact> e : map.entrySet() )
+ for( Entry<String, Artifact> e : vmap.entrySet() )
{
- res.put( e.getKey(), toMercuryMetadata( e.getValue() ) );
+ ArtifactMetadata md = toMercuryMetadata( e.getValue() );
+
+ res.put( e.getKey(), md );
}
return res;
Modified: maven/components/branches/maven-3.0-mercury-763966/maven-repository-mercury/src/main/java/org/apache/maven/repository/mercury/MercuryRepositorySystem.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-3.0-mercury-763966/maven-repository-mercury/src/main/java/org/apache/maven/repository/mercury/MercuryRepositorySystem.java?rev=769219&r1=769218&r2=769219&view=diff
==============================================================================
--- maven/components/branches/maven-3.0-mercury-763966/maven-repository-mercury/src/main/java/org/apache/maven/repository/mercury/MercuryRepositorySystem.java (original)
+++ maven/components/branches/maven-3.0-mercury-763966/maven-repository-mercury/src/main/java/org/apache/maven/repository/mercury/MercuryRepositorySystem.java Tue Apr 28 01:53:22 2009
@@ -19,17 +19,24 @@
package org.apache.maven.repository.mercury;
+import java.security.MessageDigest;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeSet;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ReactorArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.mercury.artifact.ArtifactExclusionList;
import org.apache.maven.mercury.artifact.ArtifactMetadata;
import org.apache.maven.mercury.artifact.ArtifactQueryList;
import org.apache.maven.mercury.artifact.ArtifactScopeEnum;
@@ -39,6 +46,7 @@
import org.apache.maven.mercury.repository.api.Repository;
import org.apache.maven.mercury.repository.api.RepositoryException;
import org.apache.maven.mercury.util.Util;
+import org.apache.maven.model.Dependency;
import org.apache.maven.repository.LegacyRepositorySystem;
import org.apache.maven.repository.MetadataGraph;
import org.apache.maven.repository.MetadataResolutionRequest;
@@ -48,18 +56,22 @@
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.lang.DefaultLanguage;
import org.codehaus.plexus.lang.Language;
+import org.codehaus.plexus.logging.Logger;
/**
* @author Oleg Gusakov
* @version $Id$
*/
-@Component( role = RepositorySystem.class, hint = "mercury" )
+// PLEASE NOTE: don't change the following string (spaces matter) as it is used by repo system flip flag
+@Component( role = RepositorySystem.class, hint = "default" )
public class MercuryRepositorySystem
extends LegacyRepositorySystem
implements RepositorySystem
{
private static final Language LANG = new DefaultLanguage( MercuryRepositorySystem.class );
-
+
+ private Map<String, Set<Artifact> > _resolutions = Collections.synchronizedMap( new HashMap<String, Set<Artifact>>(128) );
+
@Requirement( hint = "maven" )
DependencyProcessor _dependencyProcessor;
@@ -69,32 +81,47 @@
@Requirement
ArtifactFactory _artifactFactory;
+ @Requirement(role=ArtifactRepository.class,hint="reactor")
+ private ReactorArtifactRepository _reactorRepository;
+
+ @Requirement
+ private Logger _logger;
+
+ private boolean _reactorInitialized = false;
+
@Override
public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
{
if ( request == null )
throw new IllegalArgumentException( LANG.getMessage( "null.request" ) );
-System.out.println("mercury: request for "+request.getArtifact()
-+"("+request.getArtifactDependencies()+") repos="+request.getRemoteRepostories().size()
-+" repos, map=" + request.getManagedVersionMap()
-);
-
if ( request.getArtifact() == null )
throw new IllegalArgumentException( LANG.getMessage( "null.request.artifact" ) );
- Map<String, ArtifactMetadata> versionMap = MercuryAdaptor.toMercuryVersionMap( (Map<String,Artifact>)request.getManagedVersionMap() );
-
ArtifactResolutionResult result = new ArtifactResolutionResult();
+
+ String requestKey = null;
+
+ if( !_reactorInitialized )
+ {
+ MercuryAdaptor.initializeReactor( _reactorRepository, _dependencyProcessor );
+
+ _reactorInitialized = true;
+ }
List<Repository> repos =
MercuryAdaptor.toMercuryRepos( request.getLocalRepository()
, request.getRemoteRepostories()
, _dependencyProcessor
);
+ if( repos == null )
+ return super.resolve( request );
+
+ ArtifactFilter filter = request.getFilter();
try
{
+
long start = System.currentTimeMillis();
org.apache.maven.artifact.Artifact rootArtifact = request.getArtifact();
@@ -107,18 +134,65 @@
ArtifactScopeEnum scope = MercuryAdaptor.extractScope( rootArtifact, isPlugin, request.getFilter() );
+if( _logger.isDebugEnabled() )
+{
+_logger.debug( "\n\n======> mercury: request for "+request.getArtifact()
+ +", scope="+scope
+ +", deps="+ (artifacts == null ? 0 : artifacts.size() )
+ +", resolveRoot="+request.isResolveRoot()
+//+", repos="+request.getRemoteRepostories().size()
+//+", map=" + request.getManagedVersionMap()
+);
+ if( artifacts != null )
+ {
+ showList( artifacts, " --------> " );
+ //if( request.getManagedVersionMap() != null && request.getManagedVersionMap().size() > 0 )
+ // logger.debug( " ########> VersionMap\n"+request.getManagedVersionMap()+"\n" );
+ }
+}
+
+ Map<String, ArtifactMetadata> versionMap = MercuryAdaptor.toMercuryVersionMap( request );
+
+
if( isPlugin )
+ {
+ // check resolution cache first - plugins are cached here
+ requestKey = calcKey( request );
+
+ if( requestKey != null )
+ {
+ Set<Artifact> al = _resolutions.get( requestKey );
+
+ if( al != null )
+ {
+ for( Artifact a : al )
+ {
+ if( isGood( filter, a ) )
+ {
+ result.addArtifact( a );
+ result.addRequestedArtifact( a );
+ }
+ }
+
+ return result;
+ }
+ }
+
+ // not cached - let's proceed
rootArtifact = createArtifact( rootArtifact.getGroupId()
, rootArtifact.getArtifactId()
, rootArtifact.getVersion()
, rootArtifact.getScope()
, "jar"
);
+ }
ArtifactMetadata rootMd = MercuryAdaptor.toMercuryMetadata( rootArtifact );
- org.apache.maven.artifact.Artifact root = null;
+ // cannot just replace the type. Besides - Maven expects the same object out
+ org.apache.maven.artifact.Artifact root = isPlugin ? mavenPluginArtifact : rootArtifact;
+ // firstly - deal with the root
// copied from artifact resolver
if ( request.isResolveRoot() && rootArtifact.getFile() == null && Util.isEmpty( artifacts ) )
{
@@ -137,16 +211,14 @@
return result;
}
- root = isPlugin ? mavenPluginArtifact : rootArtifact;
-
org.apache.maven.mercury.artifact.Artifact a = mercuryArtifactList.get( 0 );
root.setFile( a.getFile() );
root.setResolved( true );
root.setResolvedVersion( a.getVersion() );
- result.addArtifact( rootArtifact );
- result.addRequestedArtifact( rootArtifact );
+ result.addArtifact( root );
+ result.addRequestedArtifact( root );
}
catch ( Exception e )
{
@@ -155,40 +227,156 @@
}
}
+ // no dependencies - bye
if ( Util.isEmpty( artifacts ) )
{
+if( _logger.isDebugEnabled() )
+ _logger.debug("mercury: resolved("+(System.currentTimeMillis() - start)+") "+root+", scope="+scope
++", artifacs="+(result.getArtifacts() == null ? 0 :result.getArtifacts().size())
++", file "+root.getFile()
++"\n<===========\n" );
return result;
}
-
+
+ // resolved metadata in Mercury format
List<ArtifactMetadata> mercuryMetadataList = null;
+
+ // no sense to resolve reactor artifacts - just pass them back as is
+ // their dependencies should already be on the list anyway
+ List<Artifact> resolvedList = new ArrayList<Artifact>( artifacts.size() + 1 );
+
+ // exclude resolved from resolution
+ List<ArtifactMetadata> globalExclusions = new ArrayList<ArtifactMetadata>( artifacts.size() + 1 );
+
+ // query for mercury
+ List<ArtifactMetadata> query = new ArrayList<ArtifactMetadata>( artifacts.size() + 1 );
- if ( Util.isEmpty( artifacts ) )
- mercuryMetadataList = _mercury.resolve( repos, scope, rootMd );
- else
+
+ if( request.isResolveRoot() && rootArtifact.getFile() == null )
+ {
+ if( root.isResolved() )
+ {
+ resolvedList.add( root );
+ globalExclusions.add( rootMd );
+ }
+ else
+ query.add( rootMd );
+ }
+
+ // TODO - are activeProjectDependencies here rightly ??
+ // add dependencies of actives to the original request list
+ List<Artifact> activeDependencies = new ArrayList<Artifact>();
+
+ for( Artifact a : artifacts )
+ {
+// if( a.isResolved() && DependencyHolder.class.isAssignableFrom( a.getClass() ) )
+// {
+// DependencyHolder apa = (DependencyHolder) a;
+// List<Dependency> deps = apa.getDependencyList();
+// if( deps != null )
+// for( Dependency d : deps )
+// activeDependencies.add( MercuryAdaptor.toMavenArtifact( _artifactFactory, d ) );
+// }
+ }
+
+ //
+ // daddy Jason does not do that,
+ // but they are very important - cannot build correct classpath
+ // without them. The correct way to add them is:
+ // - grab the active's POM
+ // - create a local map repository for each POM
+ // - add a POM to the metadata list (be re resolved from map repo)
+ // - remove POMs from final result
+ // - add original active's instead
+ //
+ // TODO replace this HACK
+ //due to the lack of time - hacking up a solution: add all them to the dependency list,
+ // but this approach looses the depth and causes problems:
+ // if active depends on junit 4.4 and root depends on 3.8.1 - 4.4 wins, while it should not
+ // trying to mitigate it by adding only non-existent GAs
+ if( activeDependencies.size() > 0 )
+ {
+ for( Artifact a : activeDependencies )
+ if( gaDoesNotExist(a,artifacts) )
+ {
+ if( isGood( filter, a ) )
+ {
+ artifacts.add( a );
+
+ if( _logger.isDebugEnabled() )
+ _logger.debug( " ------ active's dep --> "+a );
+ }
+ }
+
+ }
+
+
+ // decide - what goes to query vs. already resolved
+ for( Artifact a : artifacts )
+ {
+ if( a.isResolved() )
+ {
+ resolvedList.add( a );
+ // don't resolve again
+ globalExclusions.add( MercuryAdaptor.toMercuryMetadata( a ) );
+ }
+ else
+ query.add( MercuryAdaptor.toMercuryMetadata( a ) );
+ }
+
+ if( query.size() > 0 ) // metadata resolution first
+ mercuryMetadataList = _mercury.resolve( repos, scope, new ArtifactQueryList(query)
+ , null, new ArtifactExclusionList(globalExclusions), versionMap
+ );
+if( _logger.isDebugEnabled() )
+{
+ showMdList( mercuryMetadataList, " <.. md by mercury ...... " );
+}
+
+ // no metadata resolved and nothing pre-resolved
+ if( Util.isEmpty( mercuryMetadataList ) && Util.isEmpty( resolvedList ) )
{
- List<ArtifactMetadata> query = new ArrayList<ArtifactMetadata>( artifacts.size() + 1 );
+ result.addMissingArtifact( rootArtifact );
- query.add( rootMd );
+ long diff = System.currentTimeMillis() - start;
- for( Artifact a : artifacts )
- query.add( MercuryAdaptor.toMercuryMetadata( a ) );
+if( _logger.isDebugEnabled() )
+ _logger.debug("mercury: missing artifact("+diff+") "+rootArtifact+"("+scope+")"+"\n<===========\n" );
- mercuryMetadataList = _mercury.resolve( repos, scope, new ArtifactQueryList(query), null, null, versionMap );
+ return result;
}
-
+
+ // read binaries
List<org.apache.maven.mercury.artifact.Artifact> mercuryArtifactList =
_mercury.read( repos, mercuryMetadataList );
-
-long diff = System.currentTimeMillis() - start;
+
+ if( _logger.isDebugEnabled() )
+ {
+ showAList( mercuryArtifactList, " <__ bin. by mercury ____ " );
+ }
+
+ // ActiveProjectArtifacts - add the to the result before the rest
+ for( Artifact a : resolvedList )
+ {
+ result.addArtifact( a );
+ result.addRequestedArtifact( a );
+ if( _logger.isDebugEnabled() )
+ {
+ _logger.debug( " <-- pre-resolved -- "+a );
+ }
+ }
if ( !Util.isEmpty( mercuryArtifactList ) )
{
for ( org.apache.maven.mercury.artifact.Artifact a : mercuryArtifactList )
{
if( a.getGroupId().equals( rootMd.getGroupId() ) && a.getArtifactId().equals( rootMd.getArtifactId() ) )
- { // root artifact processing
+ { // root artifact processing - if resolved with everybody
+ if( !request.isResolveRoot() )
+ continue;
+
root = isPlugin ? mavenPluginArtifact : rootArtifact;
-
+
root.setFile( a.getFile() );
root.setResolved( true );
root.setResolvedVersion( a.getVersion() );
@@ -196,23 +384,43 @@
result.addArtifact( root );
result.addRequestedArtifact( root );
}
- else
+ else // regular resolved artifact
{
Artifact ma = MercuryAdaptor.toMavenArtifact( _artifactFactory, a );
- result.addArtifact( ma );
- result.addRequestedArtifact( ma );
+ if( isGood( filter, ma ) )
+ {
+ result.addArtifact( ma );
+ result.addRequestedArtifact( ma );
+ }
}
}
-System.out.println("mercury: resolved("+diff+") "+root+"("+scope+") as file "+root.getFile() );
-//for( Artifact a: result.getArtifacts() )
-//System.out.println("mercury dependency: "+a+" as file "+a.getFile() );
+ long diff = System.currentTimeMillis() - start;
+
+ Set<Artifact> resSet = result.getArtifacts();
+
+if( _logger.isDebugEnabled() )
+{
+ _logger.debug("mercury: resolved("+diff+") "+root+", scope="+scope
++", artifacs="+( resSet == null ? 0 : resSet.size() )
++", file "+root.getFile()
+ );
+ showList( resSet, " <--------- " );
+ _logger.debug("\n<==========================================\n");
+}
+
+ if( requestKey != null )
+ _resolutions.put( requestKey, resSet );
+
}
else
{
result.addMissingArtifact( rootArtifact );
-System.out.println("mercury: missing artifact("+diff+") "+rootArtifact+"("+scope+")" );
+
+ long diff = System.currentTimeMillis() - start;
+if( _logger.isDebugEnabled() )
+ _logger.debug("mercury: missing artifact("+diff+") "+rootArtifact+"("+scope+")"+"\n<===========\n" );
}
}
@@ -225,36 +433,132 @@
return result;
}
-
-// public List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository,
-// List<ArtifactRepository> remoteRepositories )
-// throws ArtifactMetadataRetrievalException
-// {
-//
-// List<Repository> repos =
-// MercuryAdaptor.toMercuryRepos( localRepository, remoteRepositories, _dependencyProcessor );
-//
-// try
-// {
-// List<ArtifactBasicMetadata> vl = _mercury.readVersions( repos, MercuryAdaptor.toMercuryBasicMetadata( artifact ) );
-//
-// if( Util.isEmpty( vl ) )
-// return null;
-//
-// List<ArtifactVersion> res = new ArrayList<ArtifactVersion>( vl.size() );
-//
-// for( ArtifactBasicMetadata bmd : vl )
-// res.add( new DefaultArtifactVersion(bmd.getVersion()) );
-//
-// return res;
-// }
-// catch ( RepositoryException e )
-// {
-// throw new ArtifactMetadataRetrievalException(e);
-// }
-// }
-
+ /**
+ * @param a
+ * @param artifacts
+ * @return
+ */
+ private boolean gaDoesNotExist( Artifact me, Set<Artifact> artifacts )
+ {
+ String myType = me.getType() == null ? "jar" : me.getType();
+
+ for( Artifact a : artifacts )
+ {
+ String aType = a.getType() == null ? "jar" : a.getType();
+
+ if( a.getGroupId().equals( me.getGroupId() )
+ && a.getArtifactId().equals( me.getArtifactId() )
+ && myType.equals( aType )
+ )
+ {
+ if( me.hasClassifier() )
+ {
+ if( a.hasClassifier() && a.getClassifier().equals( me.getClassifier() ) )
+ return false;
+ }
+ else
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+
+ /**
+ * @param mercuryArtifactList
+ * @param string
+ */
+ private void showAList( List<org.apache.maven.mercury.artifact.Artifact> artifacts, String prefix )
+ {
+ if( Util.isEmpty( artifacts ) )
+ return;
+
+ TreeSet<String> ts = new TreeSet<String>();
+
+ for( org.apache.maven.mercury.artifact.Artifact a : artifacts )
+ ts.add( ""+a );
+
+ for( String a : ts )
+ _logger.debug( prefix + a );
+ }
+
+
+ /**
+ * @param mercuryMetadataList
+ * @param string
+ */
+ private void showMdList( List<ArtifactMetadata> artifacts, String prefix )
+ {
+ if( Util.isEmpty( artifacts ) )
+ return;
+
+ TreeSet<String> ts = new TreeSet<String>();
+
+ for( ArtifactMetadata a : artifacts )
+ ts.add( ""+a );
+
+ for( String a : ts )
+ _logger.debug( prefix + a );
+ }
+
+
+ private void showList( Set<Artifact> artifacts, String prefix )
+ {
+ if( Util.isEmpty( artifacts ) )
+ return;
+
+ TreeSet<String> ts = new TreeSet<String>();
+
+ for( Artifact a : artifacts )
+ ts.add( a + (a.isOptional() ? ", [optional]":"")+(a.isResolved()?", [resolved]":"")+ ( a.getFile() == null ? "" :", file="+a.getFile()) );
+
+ for( String a : ts )
+ _logger.debug( prefix + a );
+ }
+
+ /**
+ * @param request
+ * @return
+ */
+ private static String calcKey( ArtifactResolutionRequest request )
+ {
+ TreeSet<String> ts = new TreeSet<String>();
+
+ ts.add( request.getArtifact().toString() );
+
+ Set<Artifact> artifacts = request.getArtifactDependencies();
+
+ if( artifacts != null )
+ for( Artifact a : artifacts )
+ ts.add( ""+a );
+
+ try
+ {
+ MessageDigest md = MessageDigest.getInstance( "SHA-1" );
+
+ for( String s : ts )
+ md.update( s.getBytes() );
+
+ byte [] digest = md.digest();
+
+ StringBuilder sb = new StringBuilder( 64 );
+
+ for( byte b : digest )
+ sb.append( "."+b );
+
+ return sb.toString();
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+
public MetadataResolutionResult resolveMetadata( MetadataResolutionRequest request )
{
@@ -291,5 +595,13 @@
return res;
}
+
+ private static boolean isGood( ArtifactFilter filter, Artifact a )
+ {
+ if( filter != null )
+ return filter.include( a );
+
+ return true;
+ }
}
Modified: maven/components/branches/maven-3.0-mercury-763966/maven-repository/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-3.0-mercury-763966/maven-repository/pom.xml?rev=769219&r1=769218&r2=769219&view=diff
==============================================================================
--- maven/components/branches/maven-3.0-mercury-763966/maven-repository/pom.xml (original)
+++ maven/components/branches/maven-3.0-mercury-763966/maven-repository/pom.xml Tue Apr 28 01:53:22 2009
@@ -69,37 +69,10 @@
</dependency>
<dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-util</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-logging</artifactId>
- <version>${mercuryVersion}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-event</artifactId>
- <version>${mercuryVersion}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-crypto-basic</artifactId>
- <version>${mercuryVersion}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
Modified: maven/components/branches/maven-3.0-mercury-763966/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-3.0-mercury-763966/pom.xml?rev=769219&r1=769218&r2=769219&view=diff
==============================================================================
--- maven/components/branches/maven-3.0-mercury-763966/pom.xml (original)
+++ maven/components/branches/maven-3.0-mercury-763966/pom.xml Tue Apr 28 01:53:22 2009
@@ -63,7 +63,7 @@
<plexusWebdavVersion>1.0</plexusWebdavVersion>
<wagonVersion>1.0-beta-5</wagonVersion>
<modelBuilderVersion>1.8</modelBuilderVersion>
- <mercuryVersion>1.0-alpha-7-SNAPSHOT</mercuryVersion>
+ <mercuryVersion>1.0-alpha-8-SNAPSHOT</mercuryVersion>
<mercuryMp3Version>1.0-alpha-1</mercuryMp3Version>
<securityDispatcherVersion>1.2</securityDispatcherVersion>
<woodstoxVersion>3.2.6</woodstoxVersion>
@@ -449,12 +449,7 @@
<!-- Mercury -->
<dependency>
<groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-artifact</artifactId>
- <version>${mercuryVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-external</artifactId>
+ <artifactId>mercury-core</artifactId>
<version>${mercuryVersion}</version>
</dependency>
<dependency>
@@ -463,16 +458,6 @@
<version>${mercuryVersion}</version>
</dependency>
<dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-repo-virtual</artifactId>
- <version>${mercuryVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.sonatype.mercury</groupId>
- <artifactId>mercury-mp3-cli</artifactId>
- <version>${mercuryMp3Version}</version>
- </dependency>
- <dependency>
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-sec-dispatcher</artifactId>
<version>${securityDispatcherVersion}</version>
@@ -482,42 +467,13 @@
<!-- Mercury test dependencies -->
<dependency>
<groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-repo-local-m2</artifactId>
- <version>${mercuryVersion}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-repo-remote-m2</artifactId>
- <version>${mercuryVersion}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-md-sat</artifactId>
- <version>${mercuryVersion}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-util</artifactId>
- <version>${mercuryVersion}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-transport-http</artifactId>
- <version>${mercuryVersion}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.mercury</groupId>
- <artifactId>mercury-transport-http</artifactId>
+ <artifactId>mercury-core</artifactId>
<version>${mercuryVersion}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
+
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-plugin-manager</artifactId>
<version>${plexusPluginManagerVersion}</version>