apply some inspections

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@219824 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-07-20 01:03:25 +00:00
parent 64836b2555
commit ee31f9650f
4 changed files with 14 additions and 12 deletions

View File

@ -103,9 +103,8 @@ public abstract class MavenProjectTestCase
protected MavenProject getProjectWithDependencies( File pom )
throws Exception
{
return projectBuilder.buildWithDependencies( pom, getLocalRepository(),
new ProjectClasspathArtifactResolver.Source( artifactFactory, artifactRepositoryFactory, getContainer() ),
Collections.EMPTY_LIST );
return projectBuilder.buildWithDependencies( pom, getLocalRepository(), new TestArtifactResolver.Source(
artifactFactory, artifactRepositoryFactory, getContainer() ), Collections.EMPTY_LIST );
}
protected MavenProject getProject( File pom )

View File

@ -36,12 +36,12 @@ public class ProjectClasspathTest
File f = getFileForClasspathResource( dir + "project-with-scoped-dependencies.xml" );
// XXX: Because this test fails, we resort to crude reflection hacks, see PLX-108 for the solution
// assertEquals( ProjectClasspathArtifactResolver.class, getContainer().lookup( ArtifactResolver.ROLE ).getClass() );
// assertEquals( TestArtifactResolver.class, getContainer().lookup( ArtifactResolver.ROLE ).getClass() );
MavenProjectBuilder builder = (MavenProjectBuilder) getContainer().lookup( MavenProjectBuilder.ROLE );
Field declaredField = builder.getClass().getDeclaredField( "artifactResolver" );
boolean acc = declaredField.isAccessible();
declaredField.setAccessible( true );
declaredField.set( builder, getContainer().lookup( ProjectClasspathArtifactResolver.class.getName() ) );
declaredField.set( builder, getContainer().lookup( TestArtifactResolver.class.getName() ) );
declaredField.setAccessible( acc );
// XXX: end hack

View File

@ -48,7 +48,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
public class ProjectClasspathArtifactResolver
public class TestArtifactResolver
extends DefaultArtifactResolver
implements Contextualizable
{
@ -56,7 +56,7 @@ public class ProjectClasspathArtifactResolver
private PlexusContainer container;
public static class Source
static class Source
implements ArtifactMetadataSource
{
private ArtifactFactory artifactFactory;
@ -109,7 +109,7 @@ public class ProjectClasspathArtifactResolver
IOUtil.close( r );
}
Set artifacts = null;
Set artifacts;
try
{
artifacts = createArtifacts( model.getDependencies(), artifact.getScope() );
@ -156,6 +156,9 @@ public class ProjectClasspathArtifactResolver
}
}
/**
* @noinspection RefusedBequest
*/
public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
throws ArtifactResolutionException
{

View File

@ -1,9 +1,9 @@
<plexus>
<components>
<!-- Due to PLX-108, have to work around it...
<!-- Due to PLX-108, have to work around it...
<component>
<role>org.apache.maven.artifact.ArtifactResolver</role>
<implementation>org.apache.maven.project.ProjectClasspathArtifactResolver</implementation>
<implementation>org.apache.maven.project.TestArtifactResolvertion>
<requirements>
<requirement>
<role>org.apache.maven.artifact.manager.WagonManager</role>
@ -15,8 +15,8 @@
</component>
-->
<component>
<role>org.apache.maven.project.ProjectClasspathArtifactResolver</role>
<implementation>org.apache.maven.project.ProjectClasspathArtifactResolver</implementation>
<role>org.apache.maven.project.TestArtifactResolver</role>
<implementation>org.apache.maven.project.TestArtifactResolver</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.manager.WagonManager</role>