04 June 2009

Maven import scope to import dependencies

Importing Managed Dependencies - Maven - Codehaus. Interesting, never knew you could "import" dependencies without pom inheritance.

3 comments:

  1. Gotta be careful though, it may not be what you're thinking. The scope only imports deps listed in the dependencyManagement section of the pom you're importing, not the regular deps in the general dep section. BUT: I'm writing a plugin to do just that (import deps from any project regardless of hierarchy or not), i call is "assimilate". Look for it in sourceforge or on freshmeat.net.

    ReplyDelete
  2. You can "inherit" all transitive dependencies from a POM by declaring a dependency to that POM. There is no need for such a plugin.

    ReplyDelete
  3. This applies only if the pom you are importing transitive dependencies from is of type 'pom'. Most projects build real-life, tangible artifacts: war, ears, jars, rpms, etc. I would be a little inconvenient to duplicate one of your poms of those types only to declare it as a project of typ 'pom', just so you could use it's dependencies from another project. Seems a wasted effort. This plugin will work with project-types other than 'pom'. Capiche?

    ReplyDelete