mirror of https://github.com/apache/maven.git
o implement the find(Artifact) method in the default local repository
git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@773769 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3504931b37
commit
55ecfa65d6
|
@ -65,7 +65,7 @@ END SNIPPET: ant-bootstrap -->
|
|||
<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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,8 +42,7 @@ import org.apache.maven.artifact.versioning.ArtifactVersion;
|
|||
// 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
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -13,6 +13,13 @@ public class DelegatingLocalArtifactRepository
|
|||
{
|
||||
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 @@ 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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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$
|
||||
|
|
|
@ -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<Artifact> getTestArtifacts()
|
||||
{
|
||||
List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() );
|
||||
|
@ -613,6 +623,7 @@ public class MavenProject
|
|||
return list;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public List<Dependency> getTestDependencies()
|
||||
{
|
||||
Set<Artifact> artifacts = getArtifacts();
|
||||
|
|
Loading…
Reference in New Issue