mirror of https://github.com/apache/maven.git
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:
parent
64836b2555
commit
ee31f9650f
|
@ -103,9 +103,8 @@ public abstract class MavenProjectTestCase
|
||||||
protected MavenProject getProjectWithDependencies( File pom )
|
protected MavenProject getProjectWithDependencies( File pom )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
return projectBuilder.buildWithDependencies( pom, getLocalRepository(),
|
return projectBuilder.buildWithDependencies( pom, getLocalRepository(), new TestArtifactResolver.Source(
|
||||||
new ProjectClasspathArtifactResolver.Source( artifactFactory, artifactRepositoryFactory, getContainer() ),
|
artifactFactory, artifactRepositoryFactory, getContainer() ), Collections.EMPTY_LIST );
|
||||||
Collections.EMPTY_LIST );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MavenProject getProject( File pom )
|
protected MavenProject getProject( File pom )
|
||||||
|
|
|
@ -36,12 +36,12 @@ public class ProjectClasspathTest
|
||||||
File f = getFileForClasspathResource( dir + "project-with-scoped-dependencies.xml" );
|
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
|
// 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 );
|
MavenProjectBuilder builder = (MavenProjectBuilder) getContainer().lookup( MavenProjectBuilder.ROLE );
|
||||||
Field declaredField = builder.getClass().getDeclaredField( "artifactResolver" );
|
Field declaredField = builder.getClass().getDeclaredField( "artifactResolver" );
|
||||||
boolean acc = declaredField.isAccessible();
|
boolean acc = declaredField.isAccessible();
|
||||||
declaredField.setAccessible( true );
|
declaredField.setAccessible( true );
|
||||||
declaredField.set( builder, getContainer().lookup( ProjectClasspathArtifactResolver.class.getName() ) );
|
declaredField.set( builder, getContainer().lookup( TestArtifactResolver.class.getName() ) );
|
||||||
declaredField.setAccessible( acc );
|
declaredField.setAccessible( acc );
|
||||||
// XXX: end hack
|
// XXX: end hack
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ProjectClasspathArtifactResolver
|
public class TestArtifactResolver
|
||||||
extends DefaultArtifactResolver
|
extends DefaultArtifactResolver
|
||||||
implements Contextualizable
|
implements Contextualizable
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,7 @@ public class ProjectClasspathArtifactResolver
|
||||||
|
|
||||||
private PlexusContainer container;
|
private PlexusContainer container;
|
||||||
|
|
||||||
public static class Source
|
static class Source
|
||||||
implements ArtifactMetadataSource
|
implements ArtifactMetadataSource
|
||||||
{
|
{
|
||||||
private ArtifactFactory artifactFactory;
|
private ArtifactFactory artifactFactory;
|
||||||
|
@ -109,7 +109,7 @@ public class ProjectClasspathArtifactResolver
|
||||||
IOUtil.close( r );
|
IOUtil.close( r );
|
||||||
}
|
}
|
||||||
|
|
||||||
Set artifacts = null;
|
Set artifacts;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
artifacts = createArtifacts( model.getDependencies(), artifact.getScope() );
|
artifacts = createArtifacts( model.getDependencies(), artifact.getScope() );
|
||||||
|
@ -156,6 +156,9 @@ public class ProjectClasspathArtifactResolver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @noinspection RefusedBequest
|
||||||
|
*/
|
||||||
public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
|
public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
|
||||||
throws ArtifactResolutionException
|
throws ArtifactResolutionException
|
||||||
{
|
{
|
|
@ -3,7 +3,7 @@
|
||||||
<!-- Due to PLX-108, have to work around it...
|
<!-- Due to PLX-108, have to work around it...
|
||||||
<component>
|
<component>
|
||||||
<role>org.apache.maven.artifact.ArtifactResolver</role>
|
<role>org.apache.maven.artifact.ArtifactResolver</role>
|
||||||
<implementation>org.apache.maven.project.ProjectClasspathArtifactResolver</implementation>
|
<implementation>org.apache.maven.project.TestArtifactResolvertion>
|
||||||
<requirements>
|
<requirements>
|
||||||
<requirement>
|
<requirement>
|
||||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||||
|
@ -15,8 +15,8 @@
|
||||||
</component>
|
</component>
|
||||||
-->
|
-->
|
||||||
<component>
|
<component>
|
||||||
<role>org.apache.maven.project.ProjectClasspathArtifactResolver</role>
|
<role>org.apache.maven.project.TestArtifactResolver</role>
|
||||||
<implementation>org.apache.maven.project.ProjectClasspathArtifactResolver</implementation>
|
<implementation>org.apache.maven.project.TestArtifactResolver</implementation>
|
||||||
<requirements>
|
<requirements>
|
||||||
<requirement>
|
<requirement>
|
||||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||||
|
|
Loading…
Reference in New Issue