Isn't this exactly what transitive dependencies do? -- David Pratt Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Tuesday, February 5, 2013 at 8:10 AM, Matthew Adams wrote: > Hi all, > > I started using the pom import feature ( > http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies), > and discovered that it differed from my expectations. What I was looking > for was a way to define a new artifact in a pom that, if used in a > consuming artifact's <dependencies>, would include all of the dependencies > in the referenced artifact. > > For example, take DataNucleus. I've defined my own pom for import purposes > that contains both the <dependencyManagement> section and <dependencies> > that are to be included. It's at > https://github.com/matthewadams/datanucleus-rdbms/blob/master/pom.xml. > > As a client, if I use the existing pom import support, then all I > effectively get are entries in my pom's <dependencyManagement> section. > The inconvenient thing is, I still have to declare each of the imported > pom's dependencies that I want. That kind of defeats the purpose of > defining a pom to be imported, IMHO. > > Instead, I'd like to propose that a new scope be introduced called > "include", that implies <type>pom</type> so that all I have to do is use > the following in my consuming pom: > > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > > <project > > xmlns="http://maven.apache.org/POM/4.0.0" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/maven-v4_0_0.xsd"> > > <modelVersion>4.0.0</modelVersion> > > > <groupId>me.matthewadams</groupId> > > <artifactId>pom-include-client</artifactId> > > <version>0.1.0.BUILD-SNAPSHOT</version> > > <packaging>jar</packaging> > > > <dependencies> > > <!-- > > this dependency would pull in all dependencies listed > > in the referenced pom's <dependencies> section > > --> > > <dependency> > > <groupId>me.matthewadams</groupId> > > <artifactId>datanucleus-rdbms</artifactId> > > <!-- > > <type>pom</type> > > implied by next line, so unnecessary; anything else is an error --> > > <scope>include</scope> <!-- NEW! different from "import"! --> > > <version>3.1.4</version> > > </dependency> > > </dependencies> > > </project> > > This way, it's extremely convenient to get all the constituent artifacts > without having to declare them all. > > Thoughts? > > -matthew > > -- > mailto:[email protected] <[email protected] > (mailto:[email protected])> > skype:matthewadams12 > googletalk:[email protected] (mailto:[email protected]) > http://matthewadams.me > http://www.linkedin.com/in/matthewadams > >
