maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r773769 - in /maven/components/branches/MNG-2766: ./ maven-compat/src/main/java/org/apache/maven/artifact/repository/ maven-compat/src/test/java/org/apache/maven/artifact/resolver/ maven-core/src/main/java/org/apache/maven/ maven-core/src/m...
Date Tue, 12 May 2009 02:43:26 GMT
Author: jvanzyl
Date: Tue May 12 02:43:26 2009
New Revision: 773769

URL: http://svn.apache.org/viewvc?rev=773769&view=rev
Log:
o implement the find(Artifact) method in the default local repository

Modified:
    maven/components/branches/MNG-2766/build.xml
    maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java
    maven/components/branches/MNG-2766/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
    maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DelegatingLocalArtifactRepository.java
    maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
    maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
    maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProject.java

Modified: maven/components/branches/MNG-2766/build.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/build.xml?rev=773769&r1=773768&r2=773769&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/build.xml (original)
+++ maven/components/branches/MNG-2766/build.xml Tue May 12 02:43:26 2009
@@ -65,7 +65,7 @@
     <property name="maven.assembly" location="apache-maven/target/${maven.home.basename.expected}-bin.zip"/>
     <property name="maven.repo.local" value="${user.home}/.m2/repository"/>
     <property name="maven.debug" value="-e"/>
-    <property name="maven.test.skip" value="true"/> <!-- TODO: Change this default
back to false once we're done -->
+    <property name="maven.test.skip" value="false"/> <!-- TODO: Change this default
back to false once we're done -->
     <property name="surefire.useFile" value="true"/>
     <echo>maven.home = ${maven.home.effective}</echo>
     <echo>maven.repo.local = ${maven.repo.local}</echo>

Modified: maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java?rev=773769&r1=773768&r2=773769&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java
(original)
+++ maven/components/branches/MNG-2766/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java
Tue May 12 02:43:26 2009
@@ -19,6 +19,8 @@
  * under the License.
  */
 
+import java.io.File;
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
@@ -192,6 +194,17 @@
 
     public Artifact find( Artifact artifact )
     {
-        return null;
+        File artifactFile = new File( getBasedir(), pathOf( artifact ) );
+        
+        // We need to set the file here or the resolver will fail with an NPE, not fully
equipped to deal
+        // with multiple local repository implementations yet.
+        artifact.setFile( artifactFile );
+        
+        if( artifactFile.exists() )
+        {            
+            artifact.setResolved( true );            
+        }
+                
+        return artifact;
     }
 }

Modified: maven/components/branches/MNG-2766/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java?rev=773769&r1=773768&r2=773769&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
(original)
+++ maven/components/branches/MNG-2766/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
Tue May 12 02:43:26 2009
@@ -42,8 +42,7 @@
 // the layout used for a particular artifact type.
 
 /**
- * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
- * @version $Id$
+ * @author Jason van Zyl
  */
 public class ArtifactResolverTest
     extends AbstractArtifactComponentTestCase

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=773769&r1=773768&r2=773769&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
Tue May 12 02:43:26 2009
@@ -87,7 +87,7 @@
         
         MavenExecutionResult result = new DefaultMavenExecutionResult();
         
-        DelegatingLocalArtifactRepository delegatingLocalArtifactRepository = new DelegatingLocalArtifactRepository();
+        DelegatingLocalArtifactRepository delegatingLocalArtifactRepository = new DelegatingLocalArtifactRepository(
request.getLocalRepository() );
         delegatingLocalArtifactRepository.addToEndOfSearchOrder( new UserLocalArtifactRepository(
request.getLocalRepository() ) ); 
         
         if ( localArtifactRepositories != null && localArtifactRepositories.size()
> 0 )

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DelegatingLocalArtifactRepository.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DelegatingLocalArtifactRepository.java?rev=773769&r1=773768&r2=773769&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DelegatingLocalArtifactRepository.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/DelegatingLocalArtifactRepository.java
Tue May 12 02:43:26 2009
@@ -13,6 +13,13 @@
 {
     private List<LocalArtifactRepository> localRepositories;        
     
+    private ArtifactRepository userLocalArtifactRepository; 
+           
+    public DelegatingLocalArtifactRepository( ArtifactRepository artifactRepository )
+    {
+        this.userLocalArtifactRepository = artifactRepository;
+    }
+
     public void addToEndOfSearchOrder( LocalArtifactRepository localRepository )
     {
         if ( localRepositories == null )
@@ -65,7 +72,7 @@
     // This ID is necessary of the metadata lookup doesn't work correctly.
     public String getId()
     {
-        return "local";
+        return "delegating";
     }
     
     @Override
@@ -83,4 +90,10 @@
         
         return null;
     }
+    
+    @Override
+    public String getBasedir()
+    {
+        return userLocalArtifactRepository.getBasedir();
+    }
 }

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=773769&r1=773768&r2=773769&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
Tue May 12 02:43:26 2009
@@ -150,7 +150,7 @@
                     // mojoDescriptor.isDependencyResolutionRequired() is actually the scope
of the dependency resolution required, not a boolean ... yah.
                     try
                     {
-                        downloadProjectDependencies( session, Artifact.SCOPE_COMPILE /**mojoDescriptor.isDependencyResolutionRequired()*/
);
+                        downloadProjectDependencies( session, Artifact.SCOPE_TEST /**mojoDescriptor.isDependencyResolutionRequired()*/
);
                     }
                     catch ( ArtifactResolutionException e )
                     {
@@ -732,9 +732,7 @@
             if ( !parameter.isEditable() )
             {
                 
-            }
-            
-            
+            }                        
             
             try
             {
@@ -744,7 +742,6 @@
                     String e = c.getAttribute( "default-value" );
                     if ( e != null )
                     {
-                        System.out.println( ">> " + e );
                         value = expressionEvaluator.evaluate( e );
                     }                    
                 }

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=773769&r1=773768&r2=773769&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
Tue May 12 02:43:26 2009
@@ -37,8 +37,6 @@
 import org.apache.maven.model.DomainModel;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.ModelEventListener;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PluginExecution;
 import org.apache.maven.model.ProcessorContext;
 import org.apache.maven.model.Profile;
 import org.apache.maven.model.interpolator.Interpolator;
@@ -58,7 +56,6 @@
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
 
 /**
  * @version $Id$

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProject.java?rev=773769&r1=773768&r2=773769&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
Tue May 12 02:43:26 2009
@@ -36,7 +36,6 @@
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
 import org.apache.maven.artifact.InvalidRepositoryException;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
 import org.apache.maven.artifact.versioning.ManagedVersionMap;
 import org.apache.maven.model.Build;
@@ -584,9 +583,10 @@
         list.add( getBuild().getOutputDirectory() );
 
         for ( Artifact a : getArtifacts() )
-        {
+        {            
             if ( a.getArtifactHandler().isAddedToClasspath() )
             {
+                
                 File file = a.getFile();
                 if ( file == null )
                 {
@@ -595,9 +595,19 @@
                 list.add( file.getPath() );
             }
         }
+        
+        /*
+        System.out.println( "TEST CLASSPATH: ");
+        for( String s : list )
+        {
+            System.out.println( ">>>>> " + s );
+        }
+        */
+        
         return list;
     }
 
+    @Deprecated
     public List<Artifact> getTestArtifacts()
     {
         List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size()
);
@@ -613,6 +623,7 @@
         return list;
     }
 
+    @Deprecated
     public List<Dependency> getTestDependencies()
     {
         Set<Artifact> artifacts = getArtifacts();



Mime
View raw message