You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2010/08/25 00:46:12 UTC

svn commit: r988749 [8/9] - in /maven/maven-3/trunk: ./ apache-maven/ maven-aether-provider/ maven-aether-provider/src/ maven-aether-provider/src/main/ maven-aether-provider/src/main/java/ maven-aether-provider/src/main/java/org/ maven-aether-provider/...

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java Tue Aug 24 22:46:07 2010
@@ -1,22 +1,18 @@
 package org.apache.maven.project;
 
 /*
- * 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.
  */
 
 import java.io.File;
@@ -35,6 +31,7 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 
+import org.apache.maven.RepositoryUtils;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
@@ -75,6 +72,8 @@ import org.codehaus.plexus.classworlds.r
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.sonatype.aether.graph.DependencyFilter;
+import org.sonatype.aether.repository.RemoteRepository;
 
 /**
  * The concern of the project is provide runtime values based on the model.
@@ -119,6 +118,10 @@ public class MavenProject
 
     private List<ArtifactRepository> pluginArtifactRepositories;
 
+    private List<RemoteRepository> remoteProjectRepositories;
+
+    private List<RemoteRepository> remotePluginRepositories;
+
     private List<Artifact> attachedArtifacts;
 
     private MavenProject executionProject;
@@ -171,14 +174,14 @@ public class MavenProject
     private ProjectBuildingRequest projectBuilderConfiguration;
 
     private RepositorySystem repositorySystem;
-
+    
     private File parentFile;
 
     private Map<String, Object> context;
 
     private ClassRealm classRealm;
 
-    private ArtifactFilter extensionArtifactFilter;
+    private DependencyFilter extensionDependencyFilter;
 
     private final Set<String> lifecyclePhases = Collections.synchronizedSet( new LinkedHashSet<String>() );
 
@@ -208,10 +211,10 @@ public class MavenProject
     {
         deepCopy( project );
     }
-
+    
     @Deprecated
     public MavenProject( Model model, RepositorySystem repositorySystem )
-    {
+    {        
         this.repositorySystem = repositorySystem;
         setModel( model );
     }
@@ -228,7 +231,7 @@ public class MavenProject
 
     /**
      * Constructor
-     *
+     * 
      * @param repositorySystem - may not be null
      * @param mavenProjectBuilder
      * @param projectBuilderConfiguration
@@ -377,7 +380,7 @@ public class MavenProject
     {
         this.parent = parent;
     }
-
+    
     public boolean hasParent()
     {
         return getParent() != null;
@@ -498,12 +501,11 @@ public class MavenProject
         list.add( getBuild().getOutputDirectory() );
 
         for ( Artifact a : getArtifacts() )
-        {
+        {                        
             if ( a.getArtifactHandler().isAddedToClasspath() )
             {
                 // TODO: let the scope handler deal with this
-                if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() )
-                    || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
+                if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
                 {
                     addArtifactPath( a, list );
                 }
@@ -524,8 +526,7 @@ public class MavenProject
             if ( a.getArtifactHandler().isAddedToClasspath() )
             {
                 // TODO: let the scope handler deal with this
-                if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() )
-                    || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
+                if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
                 {
                     list.add( a );
                 }
@@ -549,8 +550,7 @@ public class MavenProject
         for ( Artifact a : getArtifacts()  )
         {
             // TODO: let the scope handler deal with this
-            if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() )
-                || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
+            if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
             {
                 Dependency dependency = new Dependency();
 
@@ -577,11 +577,11 @@ public class MavenProject
         list.add( getBuild().getTestOutputDirectory() );
 
         list.add( getBuild().getOutputDirectory() );
-
+        
         for ( Artifact a : getArtifacts() )
-        {
+        {            
             if ( a.getArtifactHandler().isAddedToClasspath() )
-            {
+            {                
                 addArtifactPath( a, list );
             }
         }
@@ -1069,7 +1069,7 @@ public class MavenProject
      * All dependencies that this project has, including transitive ones. Contents are lazily
      * populated, so depending on what phases have run dependencies in some scopes won't be
      * included. eg. if only compile phase has run, dependencies with scope test won't be included.
-     *
+     * 
      * @return {@link Set} &lt; {@link Artifact} >
      * @see #getDependencyArtifacts() to get only direct dependencies
      */
@@ -1243,8 +1243,7 @@ public class MavenProject
                     version = ext.getVersion();
                 }
 
-                Artifact artifact =
-                    repositorySystem.createArtifact( ext.getGroupId(), ext.getArtifactId(), version, null, "jar" );
+                Artifact artifact = repositorySystem.createArtifact( ext.getGroupId(), ext.getArtifactId(), version, null, "jar" );
 
                 if ( artifact != null )
                 {
@@ -1345,6 +1344,7 @@ public class MavenProject
     public void setRemoteArtifactRepositories( List<ArtifactRepository> remoteArtifactRepositories )
     {
         this.remoteArtifactRepositories = remoteArtifactRepositories;
+        this.remoteProjectRepositories = RepositoryUtils.toRepos( getRemoteArtifactRepositories() );
     }
 
     public List<ArtifactRepository> getRemoteArtifactRepositories()
@@ -1360,6 +1360,7 @@ public class MavenProject
     public void setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories )
     {
         this.pluginArtifactRepositories = pluginArtifactRepositories;
+        this.remotePluginRepositories = RepositoryUtils.toRepos( getPluginArtifactRepositories() );
     }
 
     /**
@@ -1378,8 +1379,7 @@ public class MavenProject
 
     public ArtifactRepository getDistributionManagementArtifactRepository()
     {
-        return getArtifact().isSnapshot() && ( getSnapshotArtifactRepository() != null ) ? getSnapshotArtifactRepository()
-                        : getReleaseArtifactRepository();
+        return getArtifact().isSnapshot() && ( getSnapshotArtifactRepository() != null ) ? getSnapshotArtifactRepository() : getReleaseArtifactRepository();
     }
 
     public List<Repository> getPluginRepositories()
@@ -1387,6 +1387,16 @@ public class MavenProject
         return getModel().getRepositories();
     }
 
+    public List<RemoteRepository> getRemoteProjectRepositories()
+    {
+        return remoteProjectRepositories;
+    }
+
+    public List<RemoteRepository> getRemotePluginRepositories()
+    {
+        return remotePluginRepositories;
+    }
+
     public void setActiveProfiles( List<Profile> activeProfiles )
     {
         this.activeProfiles.addAll( activeProfiles );
@@ -1415,7 +1425,7 @@ public class MavenProject
      * settings.xml}. The profile identifiers are grouped by the identifier of their source, e.g. {@code
      * <groupId>:<artifactId>:<version>} for a POM profile or {@code external} for profiles from the {@code
      * settings.xml}.
-     *
+     * 
      * @return The identifiers of all injected profiles, indexed by the source from which the profiles originated, never
      *         {@code null}.
      */
@@ -1557,7 +1567,7 @@ public class MavenProject
 
     /**
      * Direct dependencies that this project has.
-     *
+     * 
      * @return {@link Set} &lt; {@link Artifact} >
      * @see #getArtifacts() to get all transitive dependencies
      */
@@ -1609,8 +1619,7 @@ public class MavenProject
 
             List<Dependency> deps;
             DependencyManagement dependencyManagement = getDependencyManagement();
-            if ( ( dependencyManagement != null ) && ( ( deps = dependencyManagement.getDependencies() ) != null )
-                && ( deps.size() > 0 ) )
+            if ( ( dependencyManagement != null ) && ( ( deps = dependencyManagement.getDependencies() ) != null ) && ( deps.size() > 0 ) )
             {
                 map = new HashMap<String, Artifact>();
                 for ( Iterator<Dependency> i = dependencyManagement.getDependencies().iterator(); i.hasNext(); )
@@ -1685,8 +1694,7 @@ public class MavenProject
 
     public void addProjectReference( MavenProject project )
     {
-        projectReferences.put( getProjectReferenceId( project.getGroupId(), project.getArtifactId(),
-                                                      project.getVersion() ), project );
+        projectReferences.put( getProjectReferenceId( project.getGroupId(), project.getArtifactId(), project.getVersion() ), project );
     }
 
     /**
@@ -1844,7 +1852,7 @@ public class MavenProject
             {
             }
         }
-
+        
         return releaseArtifactRepository;
     }
 
@@ -1864,7 +1872,7 @@ public class MavenProject
             {
             }
         }
-
+        
         return snapshotArtifactRepository;
     }
 
@@ -1992,9 +2000,9 @@ public class MavenProject
      * Sets the value of the context value of this project identified
      * by the given key. If the supplied value is <code>null</code>,
      * the context value is removed from this project.
-     *
+     * 
      * Context values are intended to allow core extensions to associate
-     * derived state with project instances.
+     * derived state with project instances. 
      */
     public void setContextValue( String key, Object value )
     {
@@ -2013,8 +2021,8 @@ public class MavenProject
     }
 
     /**
-     * Returns context value of this project associated with the given key
-     * or null if this project has no such value.
+     * Returns context value of this project associated with the given key 
+     * or null if this project has no such value. 
      */
     public Object getContextValue( String key )
     {
@@ -2029,7 +2037,7 @@ public class MavenProject
      * Sets the project's class realm. <strong>Warning:</strong> This is an internal utility method that is only public
      * for technical reasons, it is not part of the public API. In particular, this method can be changed or deleted
      * without prior notice and must not be used by plugins.
-     *
+     * 
      * @param classRealm The class realm hosting the build extensions of this project, may be {@code null}.
      */
     public void setClassRealm( ClassRealm classRealm )
@@ -2042,7 +2050,7 @@ public class MavenProject
      * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not
      * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be
      * used by plugins.
-     *
+     * 
      * @return The project's class realm or {@code null}.
      */
     public ClassRealm getClassRealm()
@@ -2054,24 +2062,25 @@ public class MavenProject
      * Sets the artifact filter used to exclude shared extension artifacts from plugin realms. <strong>Warning:</strong>
      * This is an internal utility method that is only public for technical reasons, it is not part of the public API.
      * In particular, this method can be changed or deleted without prior notice and must not be used by plugins.
-     *
-     * @param extensionArtifactFilter The artifact filter to apply to plugins, may be {@code null}.
+     * 
+     * @param extensionDependencyFilter The dependency filter to apply to plugins, may be {@code null}.
      */
-    public void setExtensionArtifactFilter( ArtifactFilter extensionArtifactFilter )
+    public void setExtensionDependencyFilter( DependencyFilter extensionDependencyFilter )
     {
-        this.extensionArtifactFilter = extensionArtifactFilter;
+        this.extensionDependencyFilter = extensionDependencyFilter;
     }
 
     /**
-     * Gets the artifact filter used to exclude shared extension artifacts from plugin realms. <strong>Warning:</strong>
-     * This is an internal utility method that is only public for technical reasons, it is not part of the public API.
-     * In particular, this method can be changed or deleted without prior notice and must not be used by plugins.
-     *
-     * @return The artifact filter or {@code null}.
+     * Gets the dependency filter used to exclude shared extension artifacts from plugin realms.
+     * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not
+     * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be
+     * used by plugins.
+     * 
+     * @return The dependency filter or {@code null}.
      */
-    public ArtifactFilter getExtensionArtifactFilter()
+    public DependencyFilter getExtensionDependencyFilter()
     {
-        return extensionArtifactFilter;
+        return extensionDependencyFilter;
     }
 
     /**
@@ -2079,7 +2088,7 @@ public class MavenProject
      * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not
      * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be
      * used by plugins.
-     *
+     * 
      * @param artifacts The set of artifacts, may be {@code null}.
      */
     public void setResolvedArtifacts( Set<Artifact> artifacts )
@@ -2094,7 +2103,7 @@ public class MavenProject
      * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not
      * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be
      * used by plugins.
-     *
+     * 
      * @param artifactFilter The artifact filter, may be {@code null} to exclude all artifacts.
      */
     public void setArtifactFilter( ArtifactFilter artifactFilter )
@@ -2120,7 +2129,7 @@ public class MavenProject
      * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not
      * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be
      * used by plugins.
-     *
+     * 
      * @param lifecyclePhase The lifecycle phase to add, must not be {@code null}.
      */
     public void addLifecyclePhase( String lifecyclePhase )

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java Tue Aug 24 22:46:07 2010
@@ -24,12 +24,12 @@ import java.util.List;
 import java.util.Properties;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.RepositoryCache;
 import org.apache.maven.model.Profile;
-import org.apache.maven.repository.ArtifactTransferListener;
+import org.apache.maven.model.building.ModelBuildingRequest;
 import org.apache.maven.settings.Mirror;
 import org.apache.maven.settings.Proxy;
 import org.apache.maven.settings.Server;
+import org.sonatype.aether.RepositorySystemSession;
 
 public interface ProjectBuildingRequest
 {
@@ -42,12 +42,8 @@ public interface ProjectBuildingRequest
 
     boolean isForceUpdate();
 
-    ProjectBuildingRequest setRepositoryCache( RepositoryCache repositoryCache );
-
-    RepositoryCache getRepositoryCache();
-
     ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository );
-
+    
     ArtifactRepository getLocalRepository();
 
     ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
@@ -73,7 +69,7 @@ public interface ProjectBuildingRequest
     /**
      * Sets the system properties to use for interpolation and profile activation. The system properties are collected
      * from the runtime environment like {@link System#getProperties()} and environment variables.
-     *
+     * 
      * @param systemProperties The system properties, may be {@code null}.
      * @return This request, never {@code null}.
      */
@@ -82,7 +78,7 @@ public interface ProjectBuildingRequest
     /**
      * Gets the system properties to use for interpolation and profile activation. The system properties are collected
      * from the runtime environment like {@link System#getProperties()} and environment variables.
-     *
+     * 
      * @return The system properties, never {@code null}.
      */
     Properties getSystemProperties();
@@ -91,7 +87,7 @@ public interface ProjectBuildingRequest
      * Sets the user properties to use for interpolation and profile activation. The user properties have been
      * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
      * line.
-     *
+     * 
      * @param userProperties The user properties, may be {@code null}.
      * @return This request, never {@code null}.
      */
@@ -101,12 +97,12 @@ public interface ProjectBuildingRequest
      * Gets the user properties to use for interpolation and profile activation. The user properties have been
      * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
      * line.
-     *
+     * 
      * @return The user properties, never {@code null}.
      */
     Properties getUserProperties();
 
-    void setProject( MavenProject mavenProject );
+    void setProject(MavenProject mavenProject);
 
     MavenProject getProject();
 
@@ -120,7 +116,7 @@ public interface ProjectBuildingRequest
 
     /**
      * Controls the level of validation to perform on processed models. By default, models are validated in strict mode.
-     *
+     * 
      * @param validationLevel The level of validation to perform on processed models, e.g.
      *            {@link ModelBuildingRequest#VALIDATION_LEVEL_STRICT}.
      * @return This configuration, never {@code null}.
@@ -129,53 +125,53 @@ public interface ProjectBuildingRequest
 
     /**
      * Gets the level of validation to perform on processed models.
-     *
+     * 
      * @return The level of validation to perform on processed models.
      */
     int getValidationLevel();
 
     // Profiles
-
+    
     /**
      * Set any active profiles that the {@link ProjectBuilder} should consider while constructing
      * a {@link MavenProject}.
      */
     void setActiveProfileIds( List<String> activeProfileIds );
-
+        
     List<String> getActiveProfileIds();
 
     void setInactiveProfileIds( List<String> inactiveProfileIds );
 
     List<String> getInactiveProfileIds();
-
+    
     /**
-     * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom
-     * configuration like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse.
+     * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom configuration
+     * like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse.
      * @param profile
      */
     void addProfile( Profile profile );
-
+    
     void setProfiles( List<Profile> profiles );
-
+    
     List<Profile> getProfiles();
 
     /**
      * Gets the start time of the build.
-     *
+     * 
      * @return The start time of the build or {@code null} if unknown.
      */
     Date getBuildStartTime();
 
     /**
      * Sets the start time of the build.
-     *
+     * 
      * @param buildStartTime The start time of the build, may be {@code null}.
      * @return This request, never {@code null}.
      */
     void setBuildStartTime( Date buildStartTime );
 
-    ArtifactTransferListener getTransferListener();
+    RepositorySystemSession getRepositorySession();
 
-    void setTransferListener( ArtifactTransferListener transferListener );
+    ProjectBuildingRequest setRepositorySession( RepositorySystemSession repositorySession );
 
 }

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingResult.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingResult.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingResult.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingResult.java Tue Aug 24 22:46:07 2010
@@ -22,7 +22,6 @@ package org.apache.maven.project;
 import java.io.File;
 import java.util.List;
 
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.model.building.ModelProblem;
 
 /**
@@ -70,6 +69,6 @@ public interface ProjectBuildingResult
      * @return The result of the dependency resolution for the project or {@code null} if the project dependencies were
      *         not requested.
      */
-    ArtifactResolutionResult getArtifactResolutionResult();
+    DependencyResolutionResult getDependencyResolutionResult();
 
 }

Added: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java?rev=988749&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java (added)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java Tue Aug 24 22:46:07 2010
@@ -0,0 +1,40 @@
+package org.apache.maven.project;
+
+/*
+ * 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.
+ */
+
+/**
+ * Resolves the transitive dependencies of a project.
+ * 
+ * @author Benjamin Bentmann
+ */
+public interface ProjectDependenciesResolver
+{
+
+    /**
+     * Resolves the transitive dependencies of a project.
+     * 
+     * @param request The resolution request holding the parameters, must not be {@code null}.
+     * @return The resolution result, never {@code null}.
+     * @throws DependencyResolutionException If any project dependency could not be resolved.
+     */
+    DependencyResolutionResult resolve( DependencyResolutionRequest request )
+        throws DependencyResolutionException;
+
+}

Propchange: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java Tue Aug 24 22:46:07 2010
@@ -21,8 +21,8 @@ package org.apache.maven.project;
 
 import java.util.List;
 
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.sonatype.aether.graph.DependencyFilter;
 
 /**
  * Caches project class realms. <strong>Warning:</strong> This is an internal utility interface that is only public for
@@ -40,9 +40,9 @@ public interface ProjectRealmCache
 
         public final ClassRealm realm;
 
-        public final ArtifactFilter extensionArtifactFilter;
+        public final DependencyFilter extensionArtifactFilter;
 
-        public CacheRecord( ClassRealm realm, ArtifactFilter extensionArtifactFilter )
+        public CacheRecord( ClassRealm realm, DependencyFilter extensionArtifactFilter )
         {
             this.realm = realm;
             this.extensionArtifactFilter = extensionArtifactFilter;
@@ -53,7 +53,7 @@ public interface ProjectRealmCache
     CacheRecord get( List<? extends ClassRealm> extensionRealms );
 
     CacheRecord put( List<? extends ClassRealm> extensionRealms, ClassRealm projectRealm,
-                     ArtifactFilter extensionArtifactFilter );
+                     DependencyFilter extensionArtifactFilter );
 
     void flush();
 

Added: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ReactorModelResolver.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ReactorModelResolver.java?rev=988749&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ReactorModelResolver.java (added)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ReactorModelResolver.java Tue Aug 24 22:46:07 2010
@@ -0,0 +1,182 @@
+package org.apache.maven.project;
+
+/*
+ * 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 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.sonatype.aether.RepositorySystemSession;
+import org.sonatype.aether.artifact.Artifact;
+import org.sonatype.aether.impl.ArtifactResolver;
+import org.sonatype.aether.impl.RemoteRepositoryManager;
+import org.sonatype.aether.repository.RemoteRepository;
+import org.sonatype.aether.repository.RepositoryPolicy;
+import org.sonatype.aether.resolution.ArtifactRequest;
+import org.sonatype.aether.resolution.ArtifactResolutionException;
+import org.sonatype.aether.util.artifact.DefaultArtifact;
+
+/**
+ * A model resolver to assist building of projects. This resolver gives priority to those repositories that have been
+ * declared in the POM.
+ * 
+ * @author Benjamin Bentmann
+ */
+class ReactorModelResolver
+    implements ModelResolver
+{
+
+    private final RepositorySystemSession session;
+
+    private final String context = "project";
+
+    private List<RemoteRepository> repositories;
+
+    private List<RemoteRepository> pomRepositories;
+
+    private final List<RemoteRepository> defaultRepositories;
+
+    private final ArtifactResolver resolver;
+
+    private final RemoteRepositoryManager remoteRepositoryManager;
+
+    private final Set<String> repositoryIds;
+
+    private final ReactorModelPool modelPool;
+
+    public ReactorModelResolver( RepositorySystemSession session, ArtifactResolver resolver,
+                                 RemoteRepositoryManager remoteRepositoryManager, List<RemoteRepository> repositories,
+                                 ReactorModelPool modelPool )
+    {
+        this.session = session;
+        this.resolver = resolver;
+        this.remoteRepositoryManager = remoteRepositoryManager;
+        this.pomRepositories = new ArrayList<RemoteRepository>();
+        this.defaultRepositories = repositories;
+        this.repositories = repositories;
+        this.repositoryIds = new HashSet<String>();
+        this.modelPool = modelPool;
+    }
+
+    private ReactorModelResolver( ReactorModelResolver original )
+    {
+        this.session = original.session;
+        this.resolver = original.resolver;
+        this.remoteRepositoryManager = original.remoteRepositoryManager;
+        this.pomRepositories = original.pomRepositories;
+        this.defaultRepositories = original.defaultRepositories;
+        this.repositories = original.repositories;
+        this.repositoryIds = new HashSet<String>( original.repositoryIds );
+        this.modelPool = original.modelPool;
+    }
+
+    public void addRepository( Repository repository )
+        throws InvalidRepositoryException
+    {
+        if ( !repositoryIds.add( repository.getId() ) )
+        {
+            return;
+        }
+
+        List<RemoteRepository> newRepositories = Collections.singletonList( convert( repository ) );
+
+        pomRepositories =
+            remoteRepositoryManager.aggregateRepositories( session, pomRepositories, newRepositories, true );
+        repositories =
+            remoteRepositoryManager.aggregateRepositories( session, pomRepositories, defaultRepositories, false );
+    }
+
+    private static RemoteRepository convert( Repository repository )
+    {
+        RemoteRepository result =
+            new RemoteRepository( repository.getId(), repository.getLayout(), repository.getUrl() );
+        result.setPolicy( true, convert( repository.getSnapshots() ) );
+        result.setPolicy( false, convert( repository.getReleases() ) );
+        return result;
+    }
+
+    private static RepositoryPolicy convert( 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 );
+    }
+
+    public ModelResolver newCopy()
+    {
+        return new ReactorModelResolver( this );
+    }
+
+    public ModelSource resolveModel( String groupId, String artifactId, String version )
+        throws UnresolvableModelException
+    {
+        File pomFile = null;
+
+        if ( modelPool != null )
+        {
+            pomFile = modelPool.get( groupId, artifactId, version );
+        }
+
+        if ( pomFile == null )
+        {
+            Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version );
+
+            try
+            {
+                ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context );
+                pomArtifact = resolver.resolveArtifact( session, request ).getArtifact();
+            }
+            catch ( ArtifactResolutionException e )
+            {
+                throw new UnresolvableModelException( "Failed to resolve POM for " + groupId + ":" + artifactId + ":"
+                    + version + " due to " + e.getMessage(), groupId, artifactId, version, e );
+            }
+
+            pomFile = pomArtifact.getFile();
+        }
+
+        return new FileModelSource( pomFile );
+    }
+
+}

Propchange: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ReactorModelResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ReactorModelResolver.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java Tue Aug 24 22:46:07 2010
@@ -76,6 +76,7 @@ import org.codehaus.plexus.component.ann
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 import org.codehaus.plexus.logging.Logger;
+import org.sonatype.aether.transfer.ArtifactNotFoundException;
 
 /**
  * @author Jason van Zyl
@@ -116,7 +117,6 @@ public class MavenMetadataSource
             request.setServers( session.getRequest().getServers() );
             request.setMirrors( session.getRequest().getMirrors() );
             request.setProxies( session.getRequest().getProxies() );
-            request.setTransferListener( session.getRequest().getTransferListener() );
         }
     }
 
@@ -569,7 +569,6 @@ public class MavenMetadataSource
                 try
                 {
                     ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
-                    configuration.setRepositoryCache( repositoryRequest.getCache() );
                     configuration.setLocalRepository( repositoryRequest.getLocalRepository() );
                     configuration.setRemoteRepositories( repositoryRequest.getRemoteRepositories() );
                     configuration.setOffline( repositoryRequest.isOffline() );
@@ -577,10 +576,10 @@ public class MavenMetadataSource
                     configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
                     configuration.setProcessPlugins( false );
                     configuration.setSystemProperties( getSystemProperties() );
-                    configuration.setTransferListener( repositoryRequest.getTransferListener() );
                     configuration.setServers( repositoryRequest.getServers() );
                     configuration.setMirrors( repositoryRequest.getMirrors() );
                     configuration.setProxies( repositoryRequest.getProxies() );
+                    configuration.setRepositorySession( legacySupport.getRepositorySession() );
 
                     project = getProjectBuilder().build( pomArtifact, configuration ).getProject();
                 }
@@ -597,11 +596,11 @@ public class MavenMetadataSource
 
                     String message;
 
-                    if ( e.getCause() instanceof MultipleArtifactsNotFoundException )
+                    if ( isMissingPom( e ) )
                     {
                         message = "Missing POM for " + artifact.getId();
                     }
-                    else if ( e.getCause() instanceof ArtifactResolutionException )
+                    else if ( isNonTransferrablePom( e ) )
                     {
                         throw new ArtifactMetadataRetrievalException( "Failed to retrieve POM for "
                             + artifact.getId() + ": " + e.getCause().getMessage(), e.getCause(),
@@ -735,6 +734,34 @@ public class MavenMetadataSource
         return null;
     }
 
+    private boolean isMissingPom( Exception e )
+    {
+        if ( e.getCause() instanceof MultipleArtifactsNotFoundException )
+        {
+            return true;
+        }
+        if ( e.getCause() instanceof org.sonatype.aether.resolution.ArtifactResolutionException
+            && e.getCause().getCause() instanceof ArtifactNotFoundException )
+        {
+            return true;
+        }
+        return false;
+    }
+
+    private boolean isNonTransferrablePom( Exception e )
+    {
+        if ( e.getCause() instanceof ArtifactResolutionException )
+        {
+            return true;
+        }
+        if ( e.getCause() instanceof org.sonatype.aether.resolution.ArtifactResolutionException
+            && !( e.getCause().getCause() instanceof ArtifactNotFoundException ) )
+        {
+            return true;
+        }
+        return false;
+    }
+
     private Properties getSystemProperties()
     {
         Properties props = new Properties();

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java Tue Aug 24 22:46:07 2010
@@ -51,6 +51,11 @@ public class ProjectArtifactMetadata
         this.file = file;
     }
 
+    public File getFile()
+    {
+        return file;
+    }
+
     public String getRemoteFilename()
     {
         return getFilename();

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java Tue Aug 24 22:46:07 2010
@@ -125,7 +125,7 @@ public class DelegatingLocalArtifactRepo
     @Override
     public String getBasedir()
     {
-        return userLocalArtifactRepository.getBasedir();
+        return ( userLocalArtifactRepository != null ) ? userLocalArtifactRepository.getBasedir() : null;
     }
 
     @Override

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/DefaultMetadataResolutionRequest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/DefaultMetadataResolutionRequest.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/DefaultMetadataResolutionRequest.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/DefaultMetadataResolutionRequest.java Tue Aug 24 22:46:07 2010
@@ -25,10 +25,8 @@ import java.util.List;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
-import org.apache.maven.artifact.repository.RepositoryCache;
 import org.apache.maven.artifact.repository.RepositoryRequest;
 import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
-import org.apache.maven.repository.ArtifactTransferListener;
 import org.apache.maven.settings.Mirror;
 import org.apache.maven.settings.Proxy;
 import org.apache.maven.settings.Server;
@@ -120,18 +118,6 @@ public class DefaultMetadataResolutionRe
         return this;
     }
 
-    public RepositoryCache getCache()
-    {
-        return repositoryRequest.getCache();
-    }
-
-    public DefaultMetadataResolutionRequest setCache( RepositoryCache cache )
-    {
-        repositoryRequest.setCache( cache );
-
-        return this;
-    }
-
     public boolean isOffline()
     {
         return repositoryRequest.isOffline();
@@ -156,18 +142,6 @@ public class DefaultMetadataResolutionRe
         return this;
     }
 
-    public ArtifactTransferListener getTransferListener()
-    {
-        return repositoryRequest.getTransferListener();
-    }
-
-    public DefaultMetadataResolutionRequest setTransferListener( ArtifactTransferListener transferListener )
-    {
-        repositoryRequest.setTransferListener( transferListener );
-
-        return this;
-    }
-
     public MetadataResolutionRequest setServers( List<Server> servers )
     {
         this.servers = servers;

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest.java Tue Aug 24 22:46:07 2010
@@ -23,7 +23,6 @@ import java.util.List;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.RepositoryCache;
 import org.apache.maven.artifact.repository.RepositoryRequest;
 import org.apache.maven.settings.Mirror;
 import org.apache.maven.settings.Proxy;
@@ -99,21 +98,6 @@ public interface MetadataResolutionReque
     MetadataResolutionRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
 
     /**
-     * Gets the repository cache to use.
-     * 
-     * @return The repository cache to use or {@code null} if none.
-     */
-    RepositoryCache getCache();
-
-    /**
-     * Sets the repository cache to use.
-     * 
-     * @param cache The repository cache to use, may be {@code null}.
-     * @return This request, never {@code null}.
-     */
-    MetadataResolutionRequest setCache( RepositoryCache cache );
-
-    /**
      * Determines whether the managed version information should be retrieved.
      * 
      * @return {@code true} if the dependency management information should be retrieved, {@code false} otherwise.

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java Tue Aug 24 22:46:07 2010
@@ -1,5 +1,24 @@
 package org.apache.maven;
 
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 import java.io.File;
 import java.util.Arrays;
 import java.util.List;
@@ -23,10 +42,12 @@ import org.apache.maven.project.DefaultP
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.repository.RepositorySystem;
+import org.apache.maven.repository.internal.MavenRepositorySystemSession;
 import org.codehaus.plexus.ContainerConfiguration;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
 
 public abstract class AbstractCoreMavenComponentTestCase
     extends PlexusTestCase
@@ -128,11 +149,24 @@ public abstract class AbstractCoreMavenC
             project.setPluginArtifactRepositories( request.getPluginArtifactRepositories() );
         }
 
-        MavenSession session = new MavenSession( getContainer(), request, new DefaultMavenExecutionResult(), project );
+        initRepoSession( configuration );
+
+        MavenSession session =
+            new MavenSession( getContainer(), configuration.getRepositorySession(), request,
+                              new DefaultMavenExecutionResult() );
+        session.setProjects( Arrays.asList( project ) );
 
         return session;
     }
 
+    protected void initRepoSession( ProjectBuildingRequest request )
+    {
+        File localRepo = new File( request.getLocalRepository().getBasedir() );
+        MavenRepositorySystemSession session = new MavenRepositorySystemSession();
+        session.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) );
+        request.setRepositorySession( session );
+    }
+
     protected MavenProject createStubMavenProject()
     {
         Model model = new Model();

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/MavenLifecycleParticipantTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/MavenLifecycleParticipantTest.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/MavenLifecycleParticipantTest.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/MavenLifecycleParticipantTest.java Tue Aug 24 22:46:07 2010
@@ -99,7 +99,7 @@ public class MavenLifecycleParticipantTe
         request.setGoals( Arrays.asList( "validate" ) );
         MavenExecutionResult result = maven.execute( request );
 
-        assertFalse( result.hasExceptions() );
+        assertFalse( result.getExceptions().toString(), result.hasExceptions() );
 
         MavenProject project = result.getProject();
         

Added: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/EmptyLifecyclePluginAnalyzer.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/EmptyLifecyclePluginAnalyzer.java?rev=988749&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/EmptyLifecyclePluginAnalyzer.java (added)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/EmptyLifecyclePluginAnalyzer.java Tue Aug 24 22:46:07 2010
@@ -0,0 +1,77 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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.LinkedHashSet;
+import java.util.Set;
+
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginExecution;
+
+/**
+ * @author Benjamin Bentmann
+ */
+public class EmptyLifecyclePluginAnalyzer
+    implements LifeCyclePluginAnalyzer
+{
+    public Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging )
+    {
+        Set<Plugin> plugins;
+
+        // NOTE: The upper-case packaging name is intentional, that's a special hinting mode used for certain tests
+        if ( "JAR".equals( packaging ) )
+        {
+            plugins = new LinkedHashSet<Plugin>();
+
+            plugins.add( newPlugin( "maven-compiler-plugin", "compile", "testCompile" ) );
+            plugins.add( newPlugin( "maven-resources-plugin", "resources", "testResources" ) );
+            plugins.add( newPlugin( "maven-surefire-plugin", "test" ) );
+            plugins.add( newPlugin( "maven-jar-plugin", "jar" ) );
+            plugins.add( newPlugin( "maven-install-plugin", "install" ) );
+            plugins.add( newPlugin( "maven-deploy-plugin", "deploy" ) );
+        }
+        else
+        {
+            plugins = Collections.emptySet();
+        }
+
+        return plugins;
+    }
+
+    private Plugin newPlugin( String artifactId, String... goals )
+    {
+        Plugin plugin = new Plugin();
+
+        plugin.setGroupId( "org.apache.maven.plugins" );
+        plugin.setArtifactId( artifactId );
+
+        for ( String goal : goals )
+        {
+            PluginExecution pluginExecution = new PluginExecution();
+            pluginExecution.setId( "default-" + goal );
+            pluginExecution.addGoal( goal );
+            plugin.addExecution( pluginExecution );
+        }
+
+        return plugin;
+    }
+
+}

Propchange: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/EmptyLifecyclePluginAnalyzer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/EmptyLifecyclePluginAnalyzer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java Tue Aug 24 22:46:07 2010
@@ -26,16 +26,8 @@ import org.apache.maven.lifecycle.intern
 import org.apache.maven.lifecycle.internal.MojoDescriptorCreator;
 import org.apache.maven.lifecycle.internal.TaskSegment;
 import org.apache.maven.model.Plugin;
-import org.apache.maven.plugin.InvalidPluginDescriptorException;
 import org.apache.maven.plugin.MojoExecution;
-import org.apache.maven.plugin.MojoNotFoundException;
-import org.apache.maven.plugin.PluginDescriptorParsingException;
-import org.apache.maven.plugin.PluginManagerException;
-import org.apache.maven.plugin.PluginNotFoundException;
-import org.apache.maven.plugin.PluginResolutionException;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
-import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
-import org.apache.maven.plugin.version.PluginVersionResolutionException;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 
@@ -306,10 +298,7 @@ public class LifecycleExecutorTest
     }
 
     MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
-        throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
-        MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
-        PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
-        PluginVersionResolutionException
+        throws Exception
     {
         List<TaskSegment> taskSegments =
             lifeCycleTaskSegmentCalculator.calculateTaskSegments( session, Arrays.asList( tasks ) );

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/BuildPluginManagerStub.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/BuildPluginManagerStub.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/BuildPluginManagerStub.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/BuildPluginManagerStub.java Tue Aug 24 22:46:07 2010
@@ -1,3 +1,5 @@
+package org.apache.maven.lifecycle.internal.stub;
+
 /*
  * 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
@@ -13,25 +15,17 @@
  * the License.
  */
 
-package org.apache.maven.lifecycle.internal.stub;
+import java.util.List;
 
-import org.apache.maven.artifact.repository.RepositoryRequest;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.plugin.BuildPluginManager;
-import org.apache.maven.plugin.InvalidPluginDescriptorException;
 import org.apache.maven.plugin.MojoExecution;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.MojoNotFoundException;
-import org.apache.maven.plugin.PluginConfigurationException;
-import org.apache.maven.plugin.PluginDescriptorParsingException;
-import org.apache.maven.plugin.PluginManagerException;
-import org.apache.maven.plugin.PluginNotFoundException;
-import org.apache.maven.plugin.PluginResolutionException;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.sonatype.aether.RepositorySystemSession;
+import org.sonatype.aether.repository.RemoteRepository;
 
 /**
  * @author Kristian Rosenvold
@@ -40,28 +34,23 @@ public class BuildPluginManagerStub
     implements BuildPluginManager
 {
 
-    public PluginDescriptor loadPlugin( Plugin plugin, RepositoryRequest repositoryRequest )
-        throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
-        InvalidPluginDescriptorException
+    public PluginDescriptor loadPlugin( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session )
     {
         return null;
     }
 
-    public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, RepositoryRequest repositoryRequest )
-        throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
-        MojoNotFoundException, InvalidPluginDescriptorException
+    public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, List<RemoteRepository> repositories,
+                                             RepositorySystemSession session )
     {
         return MojoExecutorStub.createMojoDescriptor( plugin.getKey() );
     }
 
     public ClassRealm getPluginRealm( MavenSession session, PluginDescriptor pluginDescriptor )
-        throws PluginResolutionException, PluginManagerException
     {
         return null;
     }
 
     public void executeMojo( MavenSession session, MojoExecution execution )
-        throws MojoFailureException, MojoExecutionException, PluginConfigurationException, PluginManagerException
     {
     }
 }

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/PluginPrefixResolverStub.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/PluginPrefixResolverStub.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/PluginPrefixResolverStub.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/PluginPrefixResolverStub.java Tue Aug 24 22:46:07 2010
@@ -15,11 +15,11 @@
 
 package org.apache.maven.lifecycle.internal.stub;
 
-import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
 import org.apache.maven.plugin.prefix.PluginPrefixRequest;
 import org.apache.maven.plugin.prefix.PluginPrefixResolver;
 import org.apache.maven.plugin.prefix.PluginPrefixResult;
+import org.sonatype.aether.repository.ArtifactRepository;
 
 /**
  * @author Kristian Rosenvold

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/PluginVersionResolverStub.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/PluginVersionResolverStub.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/PluginVersionResolverStub.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/PluginVersionResolverStub.java Tue Aug 24 22:46:07 2010
@@ -15,11 +15,11 @@
 
 package org.apache.maven.lifecycle.internal.stub;
 
-import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.plugin.version.PluginVersionRequest;
 import org.apache.maven.plugin.version.PluginVersionResolutionException;
 import org.apache.maven.plugin.version.PluginVersionResolver;
 import org.apache.maven.plugin.version.PluginVersionResult;
+import org.sonatype.aether.repository.ArtifactRepository;
 
 /**
  * @author Kristian Rosenvold

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependenciesResolverStub.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependenciesResolverStub.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependenciesResolverStub.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependenciesResolverStub.java Tue Aug 24 22:46:07 2010
@@ -20,17 +20,25 @@ import org.apache.maven.artifact.Artifac
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.execution.MavenSession;
+import org.apache.maven.project.DependencyResolutionException;
+import org.apache.maven.project.DependencyResolutionRequest;
+import org.apache.maven.project.DependencyResolutionResult;
 import org.apache.maven.project.MavenProject;
+import org.sonatype.aether.graph.Dependency;
+import org.sonatype.aether.graph.DependencyNode;
+import org.sonatype.aether.util.graph.DefaultDependencyNode;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 /**
  * @author Kristian Rosenvold
  */
 public class ProjectDependenciesResolverStub
-    implements ProjectDependenciesResolver
+    implements ProjectDependenciesResolver, org.apache.maven.project.ProjectDependenciesResolver
 {
     public Set<Artifact> resolve( MavenProject project, Collection<String> scopesToResolve, MavenSession session )
         throws ArtifactResolutionException, ArtifactNotFoundException
@@ -59,4 +67,43 @@ public class ProjectDependenciesResolver
     {
         return new HashSet<Artifact>();
     }
+
+    public DependencyResolutionResult resolve( DependencyResolutionRequest request )
+        throws DependencyResolutionException
+    {
+        return new DependencyResolutionResult()
+        {
+
+            public List<Dependency> getUnresolvedDependencies()
+            {
+                return Collections.emptyList();
+            }
+
+            public List<Dependency> getResolvedDependencies()
+            {
+                return Collections.emptyList();
+            }
+
+            public List<Exception> getResolutionErrors( Dependency dependency )
+            {
+                return Collections.emptyList();
+            }
+
+            public DependencyNode getDependencyGraph()
+            {
+                return new DefaultDependencyNode( (Dependency) null );
+            }
+
+            public List<Dependency> getDependencies()
+            {
+                return Collections.emptyList();
+            }
+
+            public List<Exception> getCollectionErrors()
+            {
+                return Collections.emptyList();
+            }
+        };
+    }
+
 }

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStub.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStub.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStub.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStub.java Tue Aug 24 22:46:07 2010
@@ -216,7 +216,7 @@ public class ProjectDependencyGraphStub
         MavenExecutionRequest mavenExecutionRequest = new DefaultMavenExecutionRequest();
         mavenExecutionRequest.setExecutionListener( new AbstractExecutionListener() );
         mavenExecutionRequest.setGoals( Arrays.asList( "clean", "aggr", "install" ) );
-        final MavenSession session = new MavenSession( null, mavenExecutionRequest, defaultMavenExecutionResult );
+        final MavenSession session = new MavenSession( null, null, mavenExecutionRequest, defaultMavenExecutionResult );
         final ProjectDependencyGraphStub dependencyGraphStub = new ProjectDependencyGraphStub();
         session.setProjectDependencyGraph( dependencyGraphStub );
         session.setProjects( dependencyGraphStub.getSortedProjects() );

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java Tue Aug 24 22:46:07 2010
@@ -1,5 +1,24 @@
 package org.apache.maven.plugin;
 
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 import java.util.List;
 
 import org.apache.maven.AbstractCoreMavenComponentTestCase;
@@ -39,16 +58,6 @@ public class PluginManagerTest
         return "src/test/projects/plugin-manager";
     }
 
-    private RepositoryRequest getRepositoryRequest( MavenSession session )
-    {
-        RepositoryRequest request = new DefaultRepositoryRequest();
-
-        request.setLocalRepository( session.getLocalRepository() );
-        request.setRemoteRepositories( session.getCurrentProject().getPluginArtifactRepositories() );
-
-        return request;
-    }
-
     public void testPluginLoading()
         throws Exception
     {
@@ -57,7 +66,9 @@ public class PluginManagerTest
         plugin.setGroupId( "org.apache.maven.its.plugins" );
         plugin.setArtifactId( "maven-it-plugin" );
         plugin.setVersion( "0.1" );
-        PluginDescriptor pluginDescriptor = pluginManager.loadPlugin( plugin, getRepositoryRequest( session ) );
+        PluginDescriptor pluginDescriptor =
+            pluginManager.loadPlugin( plugin, session.getCurrentProject().getRemotePluginRepositories(),
+                                      session.getRepositorySession() );
         assertNotNull( pluginDescriptor );
     }
     
@@ -71,7 +82,9 @@ public class PluginManagerTest
         plugin.setArtifactId( "maven-it-plugin" );
         plugin.setVersion( "0.1" );
         
-        MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, getRepositoryRequest( session ) );        
+        MojoDescriptor mojoDescriptor =
+            pluginManager.getMojoDescriptor( plugin, goal, session.getCurrentProject().getRemotePluginRepositories(),
+                                             session.getRepositorySession() );
         assertNotNull( mojoDescriptor );
         assertEquals( goal, mojoDescriptor.getGoal() );
         // igorf: plugin realm comes later
@@ -229,7 +242,9 @@ public class PluginManagerTest
         repositoryRequest.setLocalRepository( getLocalRepository() );
         repositoryRequest.setRemoteRepositories( getPluginArtifactRepositories() );
 
-        PluginDescriptor pluginDescriptor = pluginManager.loadPlugin( plugin, getRepositoryRequest( session ) );
+        PluginDescriptor pluginDescriptor =
+            pluginManager.loadPlugin( plugin, session.getCurrentProject().getRemotePluginRepositories(),
+                                      session.getRepositorySession() );
         pluginManager.getPluginRealm( session, pluginDescriptor );
         List<Artifact> artifacts = pluginDescriptor.getArtifacts();
 

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java Tue Aug 24 22:46:07 2010
@@ -27,6 +27,7 @@ import org.apache.maven.artifact.reposit
 import org.apache.maven.model.building.ModelBuildingException;
 import org.apache.maven.model.building.ModelProblem;
 import org.apache.maven.repository.RepositorySystem;
+import org.apache.maven.repository.internal.MavenRepositorySystemSession;
 import org.codehaus.plexus.PlexusTestCase;
 
 /**
@@ -129,6 +130,7 @@ public abstract class AbstractMavenProje
         configuration.setRemoteRepositories( Arrays.asList( new ArtifactRepository[] {} ) );
         configuration.setProcessPlugins( false );
         configuration.setResolveDependencies( true );
+        initRepoSession( configuration );
 
         try
         {
@@ -157,8 +159,17 @@ public abstract class AbstractMavenProje
     {
         ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
         configuration.setLocalRepository( getLocalRepository() );
+        initRepoSession( configuration );
 
         return projectBuilder.build( pom, configuration ).getProject();
     }
 
+    protected void initRepoSession( ProjectBuildingRequest request )
+    {
+        File localRepo = new File( request.getLocalRepository().getBasedir() );
+        MavenRepositorySystemSession repoSession = new MavenRepositorySystemSession();
+        repoSession.setLocalRepositoryManager( new LegacyLocalRepositoryManager( localRepo ) );
+        request.setRepositorySession( repoSession );
+    }
+
 }

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java Tue Aug 24 22:46:07 2010
@@ -83,6 +83,7 @@ public class DefaultMavenProjectBuilderT
     {
         ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
         configuration.setLocalRepository( getLocalRepository() );
+        initRepoSession( configuration );
 
         return projectBuilder.build( pom, allowStub, configuration ).getProject();
     }

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java Tue Aug 24 22:46:07 2010
@@ -25,21 +25,11 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.lifecycle.LifecycleExecutionException;
 import org.apache.maven.lifecycle.LifecycleExecutor;
-import org.apache.maven.lifecycle.LifecycleNotFoundException;
-import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
 import org.apache.maven.lifecycle.MavenExecutionPlan;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.PluginExecution;
-import org.apache.maven.plugin.InvalidPluginDescriptorException;
 import org.apache.maven.plugin.MojoExecution;
-import org.apache.maven.plugin.MojoNotFoundException;
-import org.apache.maven.plugin.PluginDescriptorParsingException;
-import org.apache.maven.plugin.PluginNotFoundException;
-import org.apache.maven.plugin.PluginResolutionException;
-import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
-import org.apache.maven.plugin.version.PluginVersionResolutionException;
 
 /**
  * A stub implementation that assumes an empty lifecycle to bypass interaction with the plugin manager and to avoid
@@ -52,8 +42,6 @@ public class EmptyLifecycleExecutor
 {
 
     public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
-        throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
-        MojoNotFoundException
     {
         return new MavenExecutionPlan(null, null, null, null );
     }
@@ -105,14 +93,10 @@ public class EmptyLifecycleExecutor
     }
 
     public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
-        throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
-        PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
-        LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
     {
     }
 
     public List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session )
-        throws LifecycleExecutionException
     {
         return Collections.emptyList();
     }

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyProjectBuildingHelper.java Tue Aug 24 22:46:07 2010
@@ -49,8 +49,8 @@ public class EmptyProjectBuildingHelper
         }
     }
 
-    public ProjectRealmCache.CacheRecord createProjectRealm( MavenProject proejct, Model model,
-                                                             ProjectBuildingRequest request )
+    public ProjectRealmCache.CacheRecord createProjectRealm( MavenProject proejct,
+                                                             Model model, ProjectBuildingRequest request )
     {
         return new ProjectRealmCache.CacheRecord( null, null );
     }

Added: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java?rev=988749&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java (added)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java Tue Aug 24 22:46:07 2010
@@ -0,0 +1,59 @@
+package org.apache.maven.project;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+
+import org.sonatype.aether.artifact.Artifact;
+import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
+
+/**
+ * @author Benjamin Bentmann
+ */
+public class LegacyLocalRepositoryManager
+    extends SimpleLocalRepositoryManager
+{
+
+    public LegacyLocalRepositoryManager( File basedir )
+    {
+        super( basedir );
+    }
+
+    public String getPathForLocalArtifact( Artifact artifact )
+    {
+        StringBuilder path = new StringBuilder( 128 );
+
+        path.append( artifact.getGroupId() ).append( '/' );
+
+        path.append( artifact.getExtension() ).append( 's' ).append( '/' );
+
+        path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
+
+        if ( artifact.getClassifier().length() > 0 )
+        {
+            path.append( '-' ).append( artifact.getClassifier() );
+        }
+
+        path.append( '.' ).append( artifact.getExtension() );
+
+        return path.toString();
+    }
+
+}

Propchange: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java?rev=988749&r1=988748&r2=988749&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java Tue Aug 24 22:46:07 2010
@@ -32,7 +32,9 @@ import org.apache.maven.model.PluginExec
 import org.apache.maven.model.building.ModelBuildingRequest;
 import org.apache.maven.project.harness.PomTestWrapper;
 import org.apache.maven.repository.RepositorySystem;
+import org.apache.maven.repository.internal.MavenRepositorySystemSession;
 import org.codehaus.plexus.PlexusTestCase;
+import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
 
 public class PomConstructionTest
     extends PlexusTestCase
@@ -1816,6 +1818,11 @@ public class PomConstructionTest
         config.setUserProperties( executionProperties );
         config.setValidationLevel( lenientValidation ? ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0
                         : ModelBuildingRequest.VALIDATION_LEVEL_STRICT );
+        MavenRepositorySystemSession repoSession = new MavenRepositorySystemSession();
+        repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager(
+                                                                                 new File(
+                                                                                           config.getLocalRepository().getBasedir() ) ) );
+        config.setRepositorySession( repoSession );
 
         return new PomTestWrapper( pomFile, projectBuilder.build( pomFile, config ).getProject() );
     }

Added: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java?rev=988749&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java (added)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java Tue Aug 24 22:46:07 2010
@@ -0,0 +1,115 @@
+package org.apache.maven.repository;
+
+/*
+ * 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.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.codehaus.plexus.util.FileUtils;
+import org.sonatype.aether.artifact.Artifact;
+import org.sonatype.aether.repository.RemoteRepository;
+import org.sonatype.aether.spi.connector.ArtifactDownload;
+import org.sonatype.aether.spi.connector.ArtifactUpload;
+import org.sonatype.aether.spi.connector.MetadataDownload;
+import org.sonatype.aether.spi.connector.MetadataUpload;
+import org.sonatype.aether.spi.connector.RepositoryConnector;
+import org.sonatype.aether.transfer.ArtifactTransferException;
+
+/**
+ * @author Benjamin Bentmann
+ */
+public class TestRepositoryConnector
+    implements RepositoryConnector
+{
+
+    private RemoteRepository repository;
+
+    private File basedir;
+
+    public TestRepositoryConnector( RemoteRepository repository )
+    {
+        this.repository = repository;
+        try
+        {
+            basedir = FileUtils.toFile( new URL( repository.getUrl() ) );
+        }
+        catch ( MalformedURLException e )
+        {
+            throw new IllegalStateException( e );
+        }
+    }
+
+    public void close()
+    {
+    }
+
+    public void get( Collection<? extends ArtifactDownload> artifactDownloads,
+                     Collection<? extends MetadataDownload> metadataDownloads )
+    {
+        if ( artifactDownloads != null )
+        {
+            for ( ArtifactDownload download : artifactDownloads )
+            {
+                File remoteFile = new File( basedir, path( download.getArtifact() ) );
+                try
+                {
+                    FileUtils.copyFile( remoteFile, download.getFile() );
+                }
+                catch ( IOException e )
+                {
+                    download.setException( new ArtifactTransferException( download.getArtifact(), repository, e ) );
+                }
+            }
+        }
+    }
+
+    private String path( Artifact artifact )
+    {
+        StringBuilder path = new StringBuilder( 128 );
+
+        path.append( artifact.getGroupId().replace( '.', '/' ) ).append( '/' );
+
+        path.append( artifact.getArtifactId() ).append( '/' );
+
+        path.append( artifact.getBaseVersion() ).append( '/' );
+
+        path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
+
+        if ( artifact.getClassifier().length() > 0 )
+        {
+            path.append( '-' ).append( artifact.getClassifier() );
+        }
+
+        path.append( '.' ).append( artifact.getExtension() );
+
+        return path.toString();
+    }
+
+    public void put( Collection<? extends ArtifactUpload> artifactUploads,
+                     Collection<? extends MetadataUpload> metadataUploads )
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+}

Propchange: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision