You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by jp4 <jo...@hnpsolutions.com> on 2006/11/03 16:38:59 UTC

Mechanism to import common depdencies into your pom files?

I have a client with many different maven projects.  I am trying to figure
out a way to manage the versions of common libraries across these projects
without duplicating the version number in each project.  For example,
commons-lang-1.1.jar is used in 50 projects.  I know that I can use a parent
pom file to do this, but I don't want all of my projects to include
everything in the parent pom.  Is there a way to import or include a
dependency in your pom... So for example, define a file with common-lang
dependency and include that in all pom files that need to reference it?

Thanks,

jp4
-- 
View this message in context: http://www.nabble.com/Mechanism-to-import-common-depdencies-into-your-pom-files--tf2568584s177.html#a7159759
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: Mechanism to import common depdencies into your pom files?

Posted by jp4 <jo...@hnpsolutions.com>.
Exactly what I was looking for and it works quite well!

Thanks,
jp4


Wendy Smoak-3 wrote:
> 
> On 11/3/06, jp4 <jo...@hnpsolutions.com> wrote:
> 
>> I have a client with many different maven projects.  I am trying to
>> figure
>> out a way to manage the versions of common libraries across these
>> projects
>> without duplicating the version number in each project.
> 
> This is typically done with <dependencyManagement>.  You specify
> version numbers there, then just declare the groupId and artifactId in
> the module that needs it.  (There have been some issues with
> dependency management and transitive dependencies, so check JIRA or
> the list archives if it doesn't seem to be working right.)
> 
>> For example,
>> commons-lang-1.1.jar is used in 50 projects.  I know that I can use a
>> parent
>> pom file to do this, but I don't want all of my projects to include
>> everything in the parent pom.  Is there a way to import or include a
>> dependency in your pom... So for example, define a file with common-lang
>> dependency and include that in all pom files that need to reference it?
> 
> To inherit it without ever declaring it again, just put it in
> <dependencies> in a top-level pom.
> 
> Many organizations have a 'master pom' (with no <modules>) that the
> various [project]-parent poms inherit from.
> 
> If you do this, be sure the dependencies are *really* common to all
> projects.
> 
> -- 
> Wendy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Mechanism-to-import-common-depdencies-into-your-pom-files--tf2568584s177.html#a7160595
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: Mechanism to import common depdencies into your pom files?

Posted by Wendy Smoak <ws...@gmail.com>.
On 11/3/06, jp4 <jo...@hnpsolutions.com> wrote:

> I have a client with many different maven projects.  I am trying to figure
> out a way to manage the versions of common libraries across these projects
> without duplicating the version number in each project.

This is typically done with <dependencyManagement>.  You specify
version numbers there, then just declare the groupId and artifactId in
the module that needs it.  (There have been some issues with
dependency management and transitive dependencies, so check JIRA or
the list archives if it doesn't seem to be working right.)

> For example,
> commons-lang-1.1.jar is used in 50 projects.  I know that I can use a parent
> pom file to do this, but I don't want all of my projects to include
> everything in the parent pom.  Is there a way to import or include a
> dependency in your pom... So for example, define a file with common-lang
> dependency and include that in all pom files that need to reference it?

To inherit it without ever declaring it again, just put it in
<dependencies> in a top-level pom.

Many organizations have a 'master pom' (with no <modules>) that the
various [project]-parent poms inherit from.

If you do this, be sure the dependencies are *really* common to all projects.

-- 
Wendy

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


Re: Mechanism to import common depdencies into your pom files?

Posted by Wayne Fay <wa...@gmail.com>.
This is essentially why the <dependencyManagement> node was created.
Take a look at it.

You'll probably want to make a single corporate-wide "super parent"
that all your projects point to, and include the <depMgmt> node in
that pom. Then in projects that need to use various dependencies, you
can declare the dependency without any version information and it will
use the version declared in the super parent <depMgmt> node.

Wayne

On 11/3/06, jp4 <jo...@hnpsolutions.com> wrote:
>
> I have a client with many different maven projects.  I am trying to figure
> out a way to manage the versions of common libraries across these projects
> without duplicating the version number in each project.  For example,
> commons-lang-1.1.jar is used in 50 projects.  I know that I can use a parent
> pom file to do this, but I don't want all of my projects to include
> everything in the parent pom.  Is there a way to import or include a
> dependency in your pom... So for example, define a file with common-lang
> dependency and include that in all pom files that need to reference it?
>
> Thanks,
>
> jp4
> --
> View this message in context:
> http://www.nabble.com/Mechanism-to-import-common-depdencies-into-your-pom-files--tf2568584s177.html#a7159759
> 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
>
>

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