One of the nice side effects of moving the maven resolution code away from 
apache is that people who work for companies with IP policies need additional 
approval to look at the source to find out how it works.  Since I don't have 
such approval I'm really hoping for some advice.

I've been following the sample code at 
http://aether.sonatype.org/using-aether-in-maven-plugins.html
http://www.sonatype.com/people/2011/01/how-to-use-aether-in-maven-plugins/#more-6838

I am working on a maven plugin that needs to traverse the entire dependency 
tree starting from a project artifact.  Aether is not finding the whole tree.  
Why not?  How do I make it?

To be more specific, aether is finding no children for an artifact that...
-- is only present in my local repo
-- is a custom packaging
-- the artifact for this custom packaging has a classifier
-- the type is not the same as the packaging name

I'll call this artifact A below.

i've made some spot checks for jars that are deployed to apache snapshot repo 
or central and aether seems to be finding the children for these.

I think the relevant code is:

    /**
     * The entry point to Aether, i.e. the component doing all the work.
     *
     * @component
     */
    private RepositorySystem repoSystem;

    /**
     * The current repository/network configuration of Maven.
     *
     * @parameter default-value="${repositorySystemSession}"
     * @readonly
     */
    private RepositorySystemSession repoSession;

    /**
     * The project's remote repositories to use for the resolution of project 
dependencies.
     *
     * @parameter default-value="${project.remoteProjectRepositories}"
     * @readonly
     */
    private List<RemoteRepository> projectRepos;


    private DependencyNode getDependencyTree(Artifact artifact) throws 
MojoExecutionException {
        try {
            List<org.sonatype.aether.graph.Dependency> managedArtifacts = new 
ArrayList<org.sonatype.aether.graph.Dependency>();
            CollectRequest collectRequest = new CollectRequest(new 
org.sonatype.aether.graph.Dependency(artifact, "compile"), managedArtifacts, 
projectRepos);
            CollectResult result = repoSystem.collectDependencies(repoSession, 
collectRequest);
            return result.getRoot();
        } catch (DependencyCollectionException e) {
            throw new MojoExecutionException("Cannot build project dependency 
tree", e);
        }
    }

getDependencyTree when called on my project artifact returns a tree where the 
node for A has no children.  Furthermore calling getDependencyTree on A 
directly also finds no children.  On the other hand running this plugin on the 
project for A does find the children of A (the dependencies listed in the pom 
for A).

changing the dependency on A from

        <dependency>
            <groupId>org.apache.geronimo.features</groupId>
            <artifactId>org.apache.geronimo.jaxb-support</artifactId>
            <type>xml</type>
            <classifier>features</classifier>
            <version>3.99.99-SNAPSHOT</version>
        </dependency>
(xml is the primary artifact file extension)
to

        <dependency>
            <groupId>org.apache.geronimo.features</groupId>
            <artifactId>org.apache.geronimo.jaxb-support</artifactId>
            <type>feature</type>
            <classifier>features</classifier>
            <version>3.99.99-SNAPSHOT</version>
        </dependency>
(feature is the packaging type)
causes a resolution error:

[ERROR] Failed to execute goal on project org.apache.geronimo.transaction.kar: 
Could not resolve dependencies for project 
org.apache.geronimo.features:org.apache.geronimo.transaction.kar:kar:3.99.99-SNAPSHOT:
 Could not find artifact 
org.apache.geronimo.features:org.apache.geronimo.jaxb-support:feature:features:3.99.99-SNAPSHOT
 in nexus (http://localhost:8081/nexus/content/groups/public) -> [Help 1]

Any advice?

thanks
david jencks




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to