Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aether-users] Obtaining a list of direct dependencies

Johannes Dorn wrote:

I need to get a list for all direct(not transitive) dependencies for an artifact. My code for this is:

CollectRequest collectRequest = new CollectRequest();
collectRequest.addRepository(remoteRepository);
Dependency artifactDependency = new Dependency(artifact, "compile");
collectRequest.addDependency(artifactDependency);

CollectResult collectResult = repoSystem.collectDependencies(

Unless you require the additional processing/filtering in the dependency collection process, calling readArtifactDescriptor() should be a lighter approach to get the direct dependencies.

The problem here is, that this will give me artifacts in the form like this:
activeio:activeio:jar:${activeio_version}

Properties aren't resolved.

Can you give some more context like what POM actually declares this dependency? I'm curious to see whether this property is actually resolvable or somebody deployed a POM which depends on user-supplied properties, wouldn't be the first broken POM out there.

In general, maven-model-builder used by Aether to get the artifact descriptor already interpolates properties from properties in the POM, and the user/system properties passed into the RepositorySystemSession.


Benjamin



Back to the top