You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Benoit Decherf <de...@yahoo-inc.com> on 2008/02/25 18:37:06 UTC

get resolved dependencies for a scope.

Hi,

I'm creating a plugin to migrate from our internal build system to 
maven. In this plugin, I need to get the test classpath, so I use :
project.createArtifacts(artifactFactory, "test", null);

The problem is that the artifacts in scope test are not returned!

I check in the code, and there is something strange in 
./maven-artifact/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java 
:
method createArtifact( String groupId, String artifactId, VersionRange 
versionRange, String type,
                                     String classifier, String scope, 
String inheritedScope, boolean optional )
        if ( inheritedScope == null )
        {  
            desiredScope = scope;
        }
        else if ( Artifact.SCOPE_TEST.equals( scope ) || 
Artifact.SCOPE_PROVIDED.equals( scope ) )
        {  
            return null;
        }


So if inheritedScope = "test", I won't get the artifact in scope "test", 
but if inheritedScope = null I will get them. Is this a correct behaviour ?
Or maybe there is another way to get the resolved artifacts ?

for the migration, I just call our actual build system in the plugin for 
compilation, packaging, etc... so the project is declared as a pom 
packaging. It seems that project.getArtifacts() return an empty list in 
this case. Is it normal ?

Benoit

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org