pde-target-maven-plugin icon indicating copy to clipboard operation
pde-target-maven-plugin copied to clipboard

Recursively gather children projects dependencies

Open ugilio opened this issue 11 years ago • 4 comments

This way you can run the plugin on the parent pom, generating a target that includes the dependencies of all the children projects.

I'm quite new to Maven, but I have to work on a maven-based project with a lot of children projects, each with lots of dependencies: the other guys are using Netbeans while I want to use Eclipse, so I made this patch.

ugilio avatar Jun 11 '14 08:06 ugilio

Hi - sorry for a very late reply.

I was wondering about the use case.. Are you using the PDE plug-in to work on Maven-only project? Or is it actually an Eclipse application with plug-ins, etc? In the latter case, you would build the *.target in the "repository" plugin, which normally would not have any children.. (at least in my configurations).

If you are using this only to gather Maven dependencies for Maven project.. have you tried using m2e, i.e. Maven for Eclipse? Then you would check-out Maven projects from your source control and import them using Import > Existing Maven projects.. All children projects and their dependencies should be resolved correctly directly from Maven repository. m2e is part of all main Eclipse distributions, I think.

Could you elaborate on your use case some more? Thanks!

andriusvelykis avatar Jun 22 '14 16:06 andriusvelykis

Ok, let me explain a little more in depth. I have a maven project that uses Felix, that was developed with Netbeans. It is made of a parent project that encloses about 10 bundles. I use m2e to import the maven project as an eclipse PDE project. Everything works well in regard to compilation, but then I would like to be able to run and debug felix in the same way I can do with a regular equinox eclipse PDE project: I am using felix-eclipse (see https://code.google.com/p/felix-eclipse) for it. It still has some issues since it was not meant to be used with maven, but I sent a patch there too.

Now the point is, m2e resolves dependencies that are needed at compile time, and for packaging, but does not generate the runtime dependencies that eclipse expects: instead of manually adding each jar that is stored in ~/.m2 folder for each of the dependencies of each of the 10 bundles, I wanted to use your plugin. Ideally I want to modify the parent pom to use your plugin, and it would generate the target configuration for all required jars of all the bundles that make up the project. But currently it only considers the parent pom, which has no direct dependencies. The alternative would be to modify the pom of each bundle, generate all the targets, manually merge everything in a big target and import that: not really the ideal solution :)

ugilio avatar Jun 23 '14 07:06 ugilio

Thanks for the explanation - I see what you are trying to do. I suppose adding support for including children modules into the dependency collection should not hurt :)

However, I have just reviewed the code - aren't you throwing out the whole filtered dependency resolution inherited from the parent? I have added a comment to the pull request code.

Furthermore, I was thinking, would it be better to add this functionality under a configuration option? So that walking the children would be optional (maybe false by default) for faster executions in case someone does not want a full walk?

andriusvelykis avatar Jun 27 '14 13:06 andriusvelykis

Yeah, I am quite new to maven so my approach was a little bit brutal - I saw that getDependencyArtifacts() worked and I used it. For the configuration option, I am not really sure: if someone runs the plugin on a parent pom I think he needs the dependencies for all the children: usually a parent pom does not have any dependency per se, it is a collection of modules. Running the plugin on a bundle that has not children should not add overhead I think.

ugilio avatar Jun 27 '14 15:06 ugilio