Complex dependency resolution with Maven and possibly Aether - how?

I'm trying to write a Maven plugin which does the following: Get all dependencies of a module and find out whether any transitive dependeny of it has a transitive dependency to any sibling module of the current module.

My idea is the following:

  • Get the module's parent (POM-only parent) and then get all of its modules, to find the siblings of the current module.
  • Get the module's transitive dependencies (but only for our group ID).
  • For each of the transitive dependencies, get its transitive dependencies and find out whether any of them is one of the sibling modules.

I've tried doing it in Maven 2 style and now ended with Aether. However, I'm not sure whether it's possible to do what I want with Aether.

Currently, I can get the POM-only parent (not with Aether, but with the MavenProject) and I can get the transitive dependencies and then filter them to keep only artifacts with our group ID. I didn't find the equivalent of the Maven FilterArtifacts in Aether.

So, the questions are: Is my idea of how I can accomplish my goal correct? Can I do that with Aether only? If yes, how do I do it? Or do I have to resort to a mix of Maven 2 and Aether? (I tried a bit, but the differences between the SNAPSHOT version and the timestamp SNAPSHOT version are a bit cumbersome)

Anyway, any help is greatly appreciated!

Answers


You can use jcabi-aether library (I'm one of developers), which can help you to do what you want:

  1. Get a list of modules from MavenProject
  2. Get their dependencies
  3. Loop through them one by one and resolve them using com.jcabi.aether.Aether

Should work fine with Maven 3


Need Your Help

Handling Reference Types

c# reference types

When reference variable can be passed by reference :

PHP SoapClient is not interpreting XML response into array

php soap soap-client

I am struggling to get PHP's inbuilt SoapClient to interpret the response coming back from the web service I'm trying to call.