Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aether-users] How to calculate the transitive dependencies of not installed (yet) project ?

Found where the problem was...
my plugin are dealing with an artifact with a custom packaging and aether needs a set up for it. I need to add ArtifactTypeRegistry and a DependencyTraverser.
after that the transitive dependencies were found properly.

well, the unique way that I found to have a customized session was creating a new one based on the one injected by plexus:

    RepositorySystemSession getRepositorySystemSession() {
        if (session == null) {
            session = new DefaultRepositorySystemSession(
                    repositorySystemSession);
            ArtifactTypeRegistry registry = RepositoryUtils
                    .newArtifactTypeRegistry(artifactHandlerManager);
            session.setArtifactTypeRegistry(registry);
           
            session.setDependencyTraverser(new StaticDependencyTraverser(true));
        }
        return session;
    }


if someone knows an better way to set up the session, please let me know.

regards,

Cristiano

2015-02-07 11:55 GMT-03:00 Cristiano Gavião <cvgaviao@xxxxxxxxx>:
Hello,

I've created a aggregator mojo that must pack some declared dependencies in the current pom (including transitive ones). All dependencies were previously installed in local repo, but the current rootProject is not yet.
I'm using the following that I took from aether demo:

rootArtifact = toArtifact(getProject().getArtifact());
CollectRequest collectRequest = new CollectRequest();
            collectRequest.setRoot(new Dependency(rootArtifact,
                    JavaScopes.COMPILE));
            collectRequest.setRepositories(remoteRepos);

            DependencyRequest dependencyRequest = new DependencyRequest(
                    collectRequest, new DependencyFilter() {

                        @Override
                        public boolean accept(DependencyNode node,
                                List<DependencyNode> parents) {
                            return node.getDependency().getScope()
                                    .equals(JavaScopes.COMPILE)
                                    && !node.getDependency().isOptional();
                        }
                    });

            List<ArtifactResult> artifactResults = repositorySystem
                    .resolveDependencies(repositorySystemSession,
dependencyRequest).getArtifactResults();


But I'm getting an empty result .

could someone point me to what I'm missing here ?


thanks for any tip,

Cristiano



--
"Tudo vale a pena se a alma não é pequena..."

Back to the top