You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matthew Adams <ma...@matthewadams.me> on 2013/02/05 15:10:36 UTC

New Maven idea: include (import++)?

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:matthew@matthewadams.me <ma...@matthewadams.me>
skype:matthewadams12
googletalk:matthew@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams

Re: New Maven idea: include (import++)?

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 05/02/2013 11:13 AM, Wayne Fay wrote:
>> We do make a single jar for each group in the group POM and put that in the
>> Tomcat lib at run time.
> OK, sorry for the misstatement earlier.
NP. It is not a topic that comes up to often.
>
>
>> It also makes it a bit easier to make sure that everyone has the right
>> versions on there workstations when testing.
> Didn't realize you do this, but agree it simplifies things drastically
> for your developers.
Gets rid of the real PITA situations where you are chasing some obscure 
problem that one person has, only to find they forgot to upgrade a 3rd 
party library in their Tomcat.
Also going back to fix a bug in a previous version is easier since you 
only have to reset about 10 libraries rather than 70.

>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: New Maven idea: include (import++)?

Posted by Wayne Fay <wa...@gmail.com>.
> We do make a single jar for each group in the group POM and put that in the
> Tomcat lib at run time.

OK, sorry for the misstatement earlier.


> It also makes it a bit easier to make sure that everyone has the right
> versions on there workstations when testing.

Didn't realize you do this, but agree it simplifies things drastically
for your developers.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: New Maven idea: include (import++)?

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 07/02/2013 10:03 AM, Matthew Adams wrote:
> On Tue, Feb 5, 2013 at 9:57 AM, Ron Wheeler 
> <rwheeler@artifact-software.com 
> <ma...@artifact-software.com>> wrote:
>
>     [snip]
>
>     We do make a single jar for each group in the group POM and put
>     that in the Tomcat lib at run time.
>     This just keeps the clutter down.
>     It makes sure that we get the same versions of everything with
>     which we did the builds of the wars, without having to deal with
>     70+ jar files.
>
>     [snip] 
>
>         Unsure how well this fits in with OSGi.
>
>
>     Me neither, but I would like to hear anyone's opinion.
>
> Well, I can tell you that wouldn't work well in OSGi.  OSGi places a 
> formal boundary around bundles, which are jars, only with OSGi 
> metadata in their META-INF/MANIFEST.MF.  It'd be pretty crazy to try 
> to export everything properly from uberjars like these.
At an abstract level, these would be "provided" in the same way that the 
JVM or Tomcat functionality is provided.

Thanks for the comment. I will read your references and if you find the 
other link, that would be most appreciated.
It is an area that I have not had a chance to explore so I appreciate 
your effort to get me started.

Ron
>
> I think a better solution would be to use OSGi plans or libraries, 
> which is kind of targeting the ease-of-use problem.  See 
> http://www.eclipse.org/virgo/documentation/virgo-documentation-3.6.0.RELEASE/docs/virgo-user-guide/htmlsingle/virgo-user-guide.html#concepts.grouping, 
> although I think it's documented better elsewhere (and I can't find it 
> right now).
>
> -matthew
>
> -- 
> mailto:matthew@matthewadams.me
> skype:matthewadams12
> googletalk:matthew@matthewadams.me 
> <ma...@matthewadams.me>
> http://matthewadams.me
> http://www.linkedin.com/in/matthewadams


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


Re: New Maven idea: include (import++)?

Posted by Matthew Adams <ma...@matthewadams.me>.
On Tue, Feb 5, 2013 at 9:57 AM, Ron Wheeler
<rw...@artifact-software.com>wrote:

> [snip]
>
We do make a single jar for each group in the group POM and put that in the
> Tomcat lib at run time.
>  This just keeps the clutter down.
> It makes sure that we get the same versions of everything with which we
> did the builds of the wars, without having to deal with 70+ jar files.



> [snip]

Unsure how well this fits in with OSGi.
>>
>
> Me neither, but I would like to hear anyone's opinion.
>
> Well, I can tell you that wouldn't work well in OSGi.  OSGi places a
formal boundary around bundles, which are jars, only with OSGi metadata in
their META-INF/MANIFEST.MF.  It'd be pretty crazy to try to export
everything properly from uberjars like these.

I think a better solution would be to use OSGi plans or libraries, which is
kind of targeting the ease-of-use problem.  See
http://www.eclipse.org/virgo/documentation/virgo-documentation-3.6.0.RELEASE/docs/virgo-user-guide/htmlsingle/virgo-user-guide.html#concepts.grouping,
although I think it's documented better elsewhere (and I can't find it
right now).

-matthew

-- 
mailto:matthew@matthewadams.me <ma...@matthewadams.me>
skype:matthewadams12
googletalk:matthew@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams

Re: New Maven idea: include (import++)?

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 05/02/2013 10:35 AM, Wayne Fay wrote:
>> way.  Taking dependencies and packing them all into a single archive is
>> certainly doable, but when you're planning on going into an environment
>> like OSGi, that's a bad, bad idea.  :)
> I don't think Ron has literally built a single JAR with those
> artifacts all glommed together. Instead, he has a single Maven project
> (pom) that declares Hibernate, Tomcat, Spring etc as dependencies.
> Then he depends on THAT pom project in his own projects. That brings
> all those dependencies (in those specific versions) in transitively.
  At compile time, you are right.
Since the dependency is "provided" it does not get added to our war files.


> Then he goes another step and specifies that pom as scope provided and
> puts all those jars in the server or lib folder of his app server.
> This keeps his actual project wars tiny and quick to deploy, and his
> various projects use the same small number of version-specific
> artifacts/dependencies across the board.
We do make a single jar for each group in the group POM and put that in 
the Tomcat lib at run time.
This just keeps the clutter down.
It makes sure that we get the same versions of everything with which we 
did the builds of the wars, without having to deal with 70+ jar files.

It also makes it a bit easier to make sure that everyone has the right 
versions on there workstations when testing.
The aggregated jar has the version number of the target release so if 
you see  a Spring-Hibernate-MySql-Tomcat-1.9.jar and you are supposed to 
be working on 1.10, you know that you have a problem.
If you have to look through the versions on 20 jars files in a library 
with 70+ jars, you may miss the fact that the person is testing with an 
different combination of jars.

The war files don't care how the libraries get there.

> Unsure how well this fits in with OSGi.

Me neither, but I would like to hear anyone's opinion.

> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: New Maven idea: include (import++)?

Posted by Wayne Fay <wa...@gmail.com>.
> way.  Taking dependencies and packing them all into a single archive is
> certainly doable, but when you're planning on going into an environment
> like OSGi, that's a bad, bad idea.  :)

I don't think Ron has literally built a single JAR with those
artifacts all glommed together. Instead, he has a single Maven project
(pom) that declares Hibernate, Tomcat, Spring etc as dependencies.
Then he depends on THAT pom project in his own projects. That brings
all those dependencies (in those specific versions) in transitively.

Then he goes another step and specifies that pom as scope provided and
puts all those jars in the server or lib folder of his app server.
This keeps his actual project wars tiny and quick to deploy, and his
various projects use the same small number of version-specific
artifacts/dependencies across the board.

Unsure how well this fits in with OSGi.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: New Maven idea: include (import++)?

Posted by Matthew Adams <ma...@matthewadams.me>.
The short answer to your question, Ron, is, well, that we don't do it that
way.  Taking dependencies and packing them all into a single archive is
certainly doable, but when you're planning on going into an environment
like OSGi, that's a bad, bad idea.  :)


On Tue, Feb 5, 2013 at 8:58 AM, Ron Wheeler
<rw...@artifact-software.com>wrote:

> Why are you using import rather than compile?
>
> We built our own jars from the Spring jars so that we only had a single
> dependency that had a lot of jars that we needed.
> We actually when further and built a single Spring-Hibernate-MySql-Tomcat
> jar and made it "provided" so we only installed it once rather than
> accumulating all this stuff in each war file.
>
> When we extended this to other third party tools (JasperReports, CXF,
> Faces,etc.), we got our war files down to a point where they only included
> our code and were a pleasure to build and deploy.
>
> Ron
>
> On 05/02/2013 9:37 AM, Matthew Adams wrote:
>
>> Nope.
>>
>> Some products (like Spring or ORMs) modularize their offerings, but there
>> are common combinations of those modules that are nice to have for
>> convenient use.  For example, DataNucleus+JPA, DataNucleus+JDO+RDBMS, or
>> DataNucleus+JDO+Mongo.  See the various datanucleus-accessplatform-*
>> artifacts defined at
>> http://www.datanucleus.org/**downloads/maven2/org/**datanucleus/<http://www.datanucleus.org/downloads/maven2/org/datanucleus/>for more
>> examples.
>>
>> This is different from what I'm proposing.  It's one small additional step
>> beyond maven pom imports (see
>> http://maven.apache.org/**guides/introduction/**
>> introduction-to-dependency-**mechanism.html#Importing_**Dependencies<http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies>
>> ).
>> The extra step is for maven to actually include the dependencies for me;
>> with current import support, I still have to add the imported dependencies
>> manually.
>>
>> -matthew
>>
>>
>> David Pratt wrote
>>
>>> Isn't this exactly what transitive dependencies do?
>>>
>>> --
>>> David Pratt
>>> Sent with Sparrow (http://www.sparrowmailapp.**com/?sig<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<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<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<http://maven.apache.org/POM/4.0.0>
>>>> "
>>>>
>>>> xmlns:xsi="http://www.w3.org/**2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
>>>> "
>>>>
>>>> xsi:schemaLocation="http://**maven.apache.org/POM/4.0.0<http://maven.apache.org/POM/4.0.0>
>>>> http://maven.apache.org/maven-**v4_0_0.xsd<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>
>>>
>>>>
>>>>
>>>>  <dependency>
>>>
>>>>
>>>>  <groupId>
>>> me.matthewadams
>>> </groupId>
>>>
>>>>
>>>>  <artifactId>
>>> datanucleus-rdbms
>>> </artifactId>
>>>
>>>>
>>>>
>>>>  <scope>
>>> include
>>> </scope>
>>>
>>>
>>>>
>>>>  <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:
>>>>
>>> matthew@
>>>   &lt;
>>> matthew@
>>>   (mailto:
>>> matthew@
>>> )&gt;
>>>
>>>> skype:matthewadams12
>>>> googletalk:
>>>>
>>> matthew@
>>>   (mailto:
>>> matthew@
>>> )
>>>
>>>> http://matthewadams.me
>>>> http://www.linkedin.com/in/**matthewadams<http://www.linkedin.com/in/matthewadams>
>>>>
>>>>
>>>>
>>
>>
>>
>> --
>> View this message in context: http://maven.40175.n5.nabble.**
>> com/New-Maven-idea-include-**import-tp5745916p5745923.html<http://maven.40175.n5.nabble.com/New-Maven-idea-include-import-tp5745916p5745923.html>
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@maven.**apache.org<us...@maven.apache.org>
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
mailto:matthew@matthewadams.me <ma...@matthewadams.me>
skype:matthewadams12
googletalk:matthew@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams

Re: New Maven idea: include (import++)?

Posted by Ron Wheeler <rw...@artifact-software.com>.
Why are you using import rather than compile?

We built our own jars from the Spring jars so that we only had a single 
dependency that had a lot of jars that we needed.
We actually when further and built a single 
Spring-Hibernate-MySql-Tomcat jar and made it "provided" so we only 
installed it once rather than accumulating all this stuff in each war file.

When we extended this to other third party tools (JasperReports, CXF, 
Faces,etc.), we got our war files down to a point where they only 
included our code and were a pleasure to build and deploy.

Ron

On 05/02/2013 9:37 AM, Matthew Adams wrote:
> Nope.
>
> Some products (like Spring or ORMs) modularize their offerings, but there
> are common combinations of those modules that are nice to have for
> convenient use.  For example, DataNucleus+JPA, DataNucleus+JDO+RDBMS, or
> DataNucleus+JDO+Mongo.  See the various datanucleus-accessplatform-*
> artifacts defined at
> http://www.datanucleus.org/downloads/maven2/org/datanucleus/ for more
> examples.
>
> This is different from what I'm proposing.  It's one small additional step
> beyond maven pom imports (see
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies).
> The extra step is for maven to actually include the dependencies for me;
> with current import support, I still have to add the imported dependencies
> manually.
>
> -matthew
>
>
> David Pratt wrote
>> 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>
>>>
>>>
>> <dependency>
>>>
>> <groupId>
>> me.matthewadams
>> </groupId>
>>>
>> <artifactId>
>> datanucleus-rdbms
>> </artifactId>
>>>
>>>
>> <scope>
>> include
>> </scope>
>>   
>>>
>> <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:
>> matthew@
>>   &lt;
>> matthew@
>>   (mailto:
>> matthew@
>> )&gt;
>>> skype:matthewadams12
>>> googletalk:
>> matthew@
>>   (mailto:
>> matthew@
>> )
>>> http://matthewadams.me
>>> http://www.linkedin.com/in/matthewadams
>>>
>>>
>
>
>
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/New-Maven-idea-include-import-tp5745916p5745923.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: New Maven idea: include (import++)?

Posted by Matthew Adams <ma...@matthewadams.me>.
Nope.

Some products (like Spring or ORMs) modularize their offerings, but there
are common combinations of those modules that are nice to have for
convenient use.  For example, DataNucleus+JPA, DataNucleus+JDO+RDBMS, or
DataNucleus+JDO+Mongo.  See the various datanucleus-accessplatform-*
artifacts defined at
http://www.datanucleus.org/downloads/maven2/org/datanucleus/ for more
examples.

This is different from what I'm proposing.  It's one small additional step
beyond maven pom imports (see
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies). 
The extra step is for maven to actually include the dependencies for me;
with current import support, I still have to add the imported dependencies
manually.

-matthew


David Pratt wrote
> 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>
>> 
>> 

>> 
>> 
> <dependency>
>> 
>> 
> <groupId>
> me.matthewadams
> </groupId>
>> 
>> 
> <artifactId>
> datanucleus-rdbms
> </artifactId>
>> 
>> 

>> 
>> 
> <scope>
> include
> </scope>
>  

>> 
>> 
> <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:

> matthew@

>  &lt;

> matthew@

>  (mailto:

> matthew@

> )&gt;
>> skype:matthewadams12
>> googletalk:

> matthew@

>  (mailto:

> matthew@

> )
>> http://matthewadams.me
>> http://www.linkedin.com/in/matthewadams
>> 
>>





--
View this message in context: http://maven.40175.n5.nabble.com/New-Maven-idea-include-import-tp5745916p5745923.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: New Maven idea: include (import++)?

Posted by David Pratt <da...@gmail.com>.
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:matthew@matthewadams.me <matthew@matthewadams.me (mailto:matthew@matthewadams.me)>
> skype:matthewadams12
> googletalk:matthew@matthewadams.me (mailto:matthew@matthewadams.me)
> http://matthewadams.me
> http://www.linkedin.com/in/matthewadams
> 
> 



Re: New Maven idea: include (import++)?

Posted by Wayne Fay <wa...@gmail.com>.
> Hello; you can do this today by simply declaring a "normal" dependency on
> an artifact of type pom.

You beat me to it... ;-)

> Second, I'm just frankly not sure how (or if) the
> dependencyManagementsection in the pom-as-dependency will work, if at
> all.

I'm not sure about this either. But you could still use the import pom
for the depMgmt section, and then regular pom/compile-scope as
dependency for the actual dependencies.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: New Maven idea: include (import++)?

Posted by Laird Nelson <lj...@gmail.com>.
On Thu, Feb 7, 2013 at 6:55 AM, Matthew Adams <ma...@matthewadams.me>wrote:

> Sheesh.  Maybe it's worth documenting that explicitly.  For whatever
> reason, after reading the import documentation, I wouldn't
> have thought to just add <type>pom</type> to my convenience pom.
>

Like I said, don't feel bad; it took me years before I realized this was
possible.


> > First, the dependencies are "one level down"--that is, you didn't include
> > your pom artifact's dependencies directly, you included them
> transitively.
> >  This might have a bearing on what versions of a given dependency "win"
> in
> > a complex inherited pom scenario.
> >
> > Ack.
>

This is not actually a big deal so long as you're remotely organized about
things.

Best,
Laird

-- 
http://about.me/lairdnelson

Re: New Maven idea: include (import++)?

Posted by Matthew Adams <ma...@matthewadams.me>.
On Tue, Feb 5, 2013 at 9:29 AM, Laird Nelson <lj...@gmail.com> wrote:

> On Tue, Feb 5, 2013 at 6:10 AM, Matthew Adams <matthew@matthewadams.me
> >wrote:
>
> > 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.
>
> Hello; you can do this today by simply declaring a "normal" dependency on
> an artifact of type pom.
> [snip]
> You should not feel like you missed something; this is not really explained
> well anywhere.  You kind of have to infer it from other parts of the Maven
> documentation.
>
> Sheesh.  Maybe it's worth documenting that explicitly.  For whatever
reason, after reading the import documentation, I wouldn't
have thought to just add <type>pom</type> to my convenience pom.


> There are several side effects to doing things this way, which may or may
> not matter to you.
>
> First, the dependencies are "one level down"--that is, you didn't include
> your pom artifact's dependencies directly, you included them transitively.
>  This might have a bearing on what versions of a given dependency "win" in
> a complex inherited pom scenario.
>
> Ack.


> Second, I'm just frankly not sure how (or if) the
> dependencyManagementsection in the pom-as-dependency will work, if at
> all.
>
> That's ok.  Maybe I'll just remove the project/dependencyManagement
section entirely and only use project/dependencies.


> I hope this helps.
>
> Mos' def'!  Thanks!

-- 
mailto:matthew@matthewadams.me <ma...@matthewadams.me>
skype:matthewadams12
googletalk:matthew@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams

Re: New Maven idea: include (import++)?

Posted by Mirko Friedenhagen <mf...@gmail.com>.
Hello everyone,

I see that, by including a pom in compile scope, the project has the
dependencies defined as transitive dependencies in it's classpath.
Two things come to my mind, which could make a scope include sensible:
1) dependency:analyze AKA define what you depend on for compilation
- we use dependency:analyze and have a policy that projects should
depend directly on stuff they need for compilation.
- I have not checked this but by "(ab)using" a pom with compile scope,
dependencies defined in there will trigger warnings from
dependency:analyze, do they not?
2) using dependencies for other scopes
- I think only dependencies declared in compile scope will be
transitively in compile of the including project.
- What if you always want to include junit, hamcrest and mockito
(easymock ...) in scope test?

Regards Mirko

On Tue, Feb 5, 2013 at 4:29 PM, Laird Nelson <lj...@gmail.com> wrote:
> On Tue, Feb 5, 2013 at 6:10 AM, Matthew Adams <ma...@matthewadams.me>wrote:
>
>> 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.
>
>
> Hello; you can do this today by simply declaring a "normal" dependency on
> an artifact of type pom.
>
> So:
>
> <dependency>
>   <groupId>your.datanucleus.pom.groupId</groupId>
>   <artifactId>your.datanucleus.pom.artifactId</artifactId>
>   <version>whatever</version>
>   <scope>compile</scope>
>   <type>pom</type>
> </dependency>
>
>
> You should not feel like you missed something; this is not really explained
> well anywhere.  You kind of have to infer it from other parts of the Maven
> documentation.
>
> There are several side effects to doing things this way, which may or may
> not matter to you.
>
> First, the dependencies are "one level down"--that is, you didn't include
> your pom artifact's dependencies directly, you included them transitively.
>  This might have a bearing on what versions of a given dependency "win" in
> a complex inherited pom scenario.
>
> Second, I'm just frankly not sure how (or if) the
> dependencyManagementsection in the pom-as-dependency will work, if at
> all.
>
> I hope this helps.
>
> Best,
> Laird
>
> --
> http://about.me/lairdnelson

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: New Maven idea: include (import++)?

Posted by Laird Nelson <lj...@gmail.com>.
On Tue, Feb 5, 2013 at 6:10 AM, Matthew Adams <ma...@matthewadams.me>wrote:

> 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.


Hello; you can do this today by simply declaring a "normal" dependency on
an artifact of type pom.

So:

<dependency>
  <groupId>your.datanucleus.pom.groupId</groupId>
  <artifactId>your.datanucleus.pom.artifactId</artifactId>
  <version>whatever</version>
  <scope>compile</scope>
  <type>pom</type>
</dependency>


You should not feel like you missed something; this is not really explained
well anywhere.  You kind of have to infer it from other parts of the Maven
documentation.

There are several side effects to doing things this way, which may or may
not matter to you.

First, the dependencies are "one level down"--that is, you didn't include
your pom artifact's dependencies directly, you included them transitively.
 This might have a bearing on what versions of a given dependency "win" in
a complex inherited pom scenario.

Second, I'm just frankly not sure how (or if) the
dependencyManagementsection in the pom-as-dependency will work, if at
all.

I hope this helps.

Best,
Laird

-- 
http://about.me/lairdnelson