diff --git a/build.xml b/build.xml index 8ebd735baa..5c845f4308 100644 --- a/build.xml +++ b/build.xml @@ -65,7 +65,7 @@ END SNIPPET: ant-bootstrap --> - + maven.home = ${maven.home.effective} maven.repo.local = ${maven.repo.local} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java index 27b1395d34..98f77d72ad 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java @@ -19,6 +19,8 @@ package org.apache.maven.artifact.repository; * 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 class DefaultArtifactRepository 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; } } diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java index 99b7d69859..9f4eb02e0c 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java +++ b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java @@ -42,8 +42,7 @@ import org.apache.maven.artifact.versioning.ArtifactVersion; // the layout used for a particular artifact type. /** - * @author Jason van Zyl - * @version $Id$ + * @author Jason van Zyl */ public class ArtifactResolverTest extends AbstractArtifactComponentTestCase diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index 2199f93f9d..895bb690af 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -87,7 +87,7 @@ public class DefaultMaven 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 ) diff --git a/maven-core/src/main/java/org/apache/maven/DelegatingLocalArtifactRepository.java b/maven-core/src/main/java/org/apache/maven/DelegatingLocalArtifactRepository.java index 8a2e63703e..4a3af235b3 100644 --- a/maven-core/src/main/java/org/apache/maven/DelegatingLocalArtifactRepository.java +++ b/maven-core/src/main/java/org/apache/maven/DelegatingLocalArtifactRepository.java @@ -13,6 +13,13 @@ public class DelegatingLocalArtifactRepository { private List localRepositories; + private ArtifactRepository userLocalArtifactRepository; + + public DelegatingLocalArtifactRepository( ArtifactRepository artifactRepository ) + { + this.userLocalArtifactRepository = artifactRepository; + } + public void addToEndOfSearchOrder( LocalArtifactRepository localRepository ) { if ( localRepositories == null ) @@ -65,7 +72,7 @@ public class DelegatingLocalArtifactRepository // This ID is necessary of the metadata lookup doesn't work correctly. public String getId() { - return "local"; + return "delegating"; } @Override @@ -83,4 +90,10 @@ public class DelegatingLocalArtifactRepository return null; } + + @Override + public String getBasedir() + { + return userLocalArtifactRepository.getBasedir(); + } } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java index 7f48d78cd3..2b16c42e72 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java @@ -150,7 +150,7 @@ public class DefaultLifecycleExecutor // 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 @@ public class DefaultLifecycleExecutor if ( !parameter.isEditable() ) { - } - - + } try { @@ -744,7 +742,6 @@ public class DefaultLifecycleExecutor String e = c.getAttribute( "default-value" ); if ( e != null ) { - System.out.println( ">> " + e ); value = expressionEvaluator.evaluate( e ); } } diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java index a169df2d85..dd1a300092 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -37,8 +37,6 @@ import org.apache.maven.model.Build; 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.logging.Logger; 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$ diff --git a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java index d1219cbdd1..1dffdf368d 100644 --- a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java @@ -36,7 +36,6 @@ import org.apache.maven.artifact.ArtifactUtils; 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 @@ public class MavenProject list.add( getBuild().getOutputDirectory() ); for ( Artifact a : getArtifacts() ) - { + { if ( a.getArtifactHandler().isAddedToClasspath() ) { + File file = a.getFile(); if ( file == null ) { @@ -595,9 +595,19 @@ public class MavenProject list.add( file.getPath() ); } } + + /* + System.out.println( "TEST CLASSPATH: "); + for( String s : list ) + { + System.out.println( ">>>>> " + s ); + } + */ + return list; } + @Deprecated public List getTestArtifacts() { List list = new ArrayList( getArtifacts().size() ); @@ -613,6 +623,7 @@ public class MavenProject return list; } + @Deprecated public List getTestDependencies() { Set artifacts = getArtifacts();