You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Roland Förther <ro...@100world.de> on 2006/07/31 11:13:41 UTC

Howto declare a dependency on a group of modules

Hi,

is it possible to specify a dependency on several modules
by a single dependency declaration (e.g. by a dependency on a parent  
pom)?


Thanks,

Roland

______________________________________________________________
Roland Förther                          100world.com AG
Roland.Foerther@100world.com            www.100world.com




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


Re: Howto declare a dependency on a group of modules

Posted by Wayne Fay <wa...@gmail.com>.
I think you're looking for something like this...

EJB Client projects
ejb1 - pom.xml
ejb2 - pom.xml
ejb3 - pom.xml

application-x-ejb-client - pom.xml
<dep>ejb1</dep>
<dep>ejb2</dep>
<dep>ejb3</dep>

app1 - pom.xml
<dep>application-x-ejb-client</dep>

When starting a new project (app1 above), you only need to declare a
single dependency on application-x-ejb-client project, which will
transitively pull in the ejb1, ejb2, and ejb3 dependencies.

Give this a try and stay flexible to try some other approaches as you
become more comfortable with Maven and fully integrate it into your
development process.

Wayne

On 7/31/06, Barrie Treloar <ba...@gmail.com> wrote:
> > Indeed, DRY is one benefit I want to get and we have several clients.
>
> > > I think it is important to explicit list your dependencies, otherwise
> > > you pull in cruft and the kitchen sink unnecessarily.
>
> You didn't respond to this.
> Do all clients have the SAME dependency set?
> Unless you are talking about a large number of client projects, and
> even then, I would still explicitly list the dependencies for each
> client.  As the dependencies should be correct for those clients and
> not include cruft because it is easier.
>
> > But think of a typical scenario, where client and middleware is
> > developed by separate
> > teams. You get decoupling of client dependency from client artifact
> > naming, versioning and partitioning,
> > which is controlled by the middleware team, if you use an
> > intermediate 'application-x-ejb-client' project.
>
> You get all this with maven out of the box anyway.
> There is no need for an intermediate.
> I am failing to follow what you are trying to do.
>
> I'd suggest trying it the hard way and seeing how you go.
> I think you will find it won't turn out to be hard or onerous.
>
> Of course you are using maven 2 right?
>
> ---------------------------------------------------------------------
> 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


Re: Howto declare a dependency on a group of modules

Posted by Barrie Treloar <ba...@gmail.com>.
> Indeed, DRY is one benefit I want to get and we have several clients.

> > I think it is important to explicit list your dependencies, otherwise
> > you pull in cruft and the kitchen sink unnecessarily.

You didn't respond to this.
Do all clients have the SAME dependency set?
Unless you are talking about a large number of client projects, and
even then, I would still explicitly list the dependencies for each
client.  As the dependencies should be correct for those clients and
not include cruft because it is easier.

> But think of a typical scenario, where client and middleware is
> developed by separate
> teams. You get decoupling of client dependency from client artifact
> naming, versioning and partitioning,
> which is controlled by the middleware team, if you use an
> intermediate 'application-x-ejb-client' project.

You get all this with maven out of the box anyway.
There is no need for an intermediate.
I am failing to follow what you are trying to do.

I'd suggest trying it the hard way and seeing how you go.
I think you will find it won't turn out to be hard or onerous.

Of course you are using maven 2 right?

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


Re: Howto declare a dependency on a group of modules

Posted by Roland Förther <ro...@100world.de>.
Am 31.07.2006 um 13:13 schrieb Barrie Treloar:

>> It would be nice for convenience
>> to have
>> a kind of maven project, which for example could be called
>> 'application-x-ejb-client',
>> that bundles the dependencies for a client and might help deliver
>> them all
>> by providing a single dependency declaration on application-x-ejb- 
>> client
>> in thw web client's POM.
>
> I'm not doing web development.
> I have no notion of how many ejb-clients you would normally have.
>
> Unless you can get some regular expression magic to help import things
> you would need to declare your dependencies in your
> "application-x-ejb-client" project and these exact ones would be
> needed in your client as well.  Whether you declare them in
> application-x-ejb-client or in your client pom they still need to be
> declared.  The only benefit I could see would be if you had more than
> one client and by creating this extra project you can apply DRY (don't
> repeat yourself). Otherwise I can't see any benefit.

Indeed, DRY is one benefit I want to get and we have several clients.
But think of a typical scenario, where client and middleware is  
developed by separate
teams. You get decoupling of client dependency from client artifact  
naming, versioning and partitioning,
which is controlled by the middleware team, if you use an  
intermediate 'application-x-ejb-client' project.

-

Roland


>
> I think it is important to explicit list your dependencies, otherwise
> you pull in cruft and the kitchen sink unnecessarily.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

______________________________________________________________
Roland Förther                          100world.com AG
Roland.Foerther@100world.com            www.100world.com




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


Re: Howto declare a dependency on a group of modules

Posted by Barrie Treloar <ba...@gmail.com>.
> It would be nice for convenience
> to have
> a kind of maven project, which for example could be called
> 'application-x-ejb-client',
> that bundles the dependencies for a client and might help deliver
> them all
> by providing a single dependency declaration on application-x-ejb-client
> in thw web client's POM.

I'm not doing web development.
I have no notion of how many ejb-clients you would normally have.

Unless you can get some regular expression magic to help import things
you would need to declare your dependencies in your
"application-x-ejb-client" project and these exact ones would be
needed in your client as well.  Whether you declare them in
application-x-ejb-client or in your client pom they still need to be
declared.  The only benefit I could see would be if you had more than
one client and by creating this extra project you can apply DRY (don't
repeat yourself). Otherwise I can't see any benefit.

I think it is important to explicit list your dependencies, otherwise
you pull in cruft and the kitchen sink unnecessarily.

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


Re: Ad: Re: Howto declare a dependency on a group of modules

Posted by Roland Förther <ro...@100world.de>.
Hi,

Am 31.07.2006 um 12:40 schrieb Stefan Magnus Landrø:

> We've done something similar. We use project of type pom that declares
> dependencies to things that several of our projects need.
>
> So, create a project with all the EJB dependencies, and include it  
> as a
> standard dependency. The transitive-dependency mechanism in maven will
> take care of the rest.
>
> Stefan
>

Many thanks! That helps.

A note:

One should not forget to set the dependency type to the bundling  
project as POM (<dependency>...<type>pom</type></dependency),
otherwise maven tries to resolve a none existing JAR artifact for the  
bundling project.

- Roland


> Roland Förther <ro...@100world.de> skrev 31.07.2006  
> 12:33:04:
>
>> Hi,
>>
>> On 31.07.2006 at 11:42, Barrie Treloar wrote:
>>
>>> On 7/31/06, Roland Förther <ro...@100world.de> wrote:
>>>> Hi,
>>>>
>>>> is it possible to specify a dependency on several modules
>>>> by a single dependency declaration (e.g. by a dependency on a  
>>>> parent
>>>> pom)?
>>>
>>> You might want to explain more of what you are trying to do.
>>
>> Ok, let me describe, what I'm trying to do. Think of a web client,
>> which acts on a J2EE middleware using many ejb client JARs.
>> Each ejb client JAR is an artifact generated by a maven project with
>> type 'ejb'.
>> These ejb projects do not depend on each other and are part
>> of what we call a middleware application.
>>
>> In the web client's POM I have to make a dependency declaration
>> on each ejb client jar separately. It would be nice for convenience
>> to have
>> a kind of maven project, which for example could be called
>> 'application-x-ejb-client',
>> that bundles the dependencies for a client and might help deliver
>> them all
>> by providing a single dependency declaration on application-x-ejb- 
>> client
>> in thw web client's POM.
>>
>>
>>>
>>> Also you might want to make sure the terminology you use is correct.
>>> It took me a while to work it out and I can't guarantee I'm 100%
>>> correct.
>>>
>>> A module is just a way to make building your application easier from
>>> the command line.
>>> It has zero effect on dependencies since in order to be a parent
>>> module and have modules your project must be of type pom, which is
>>> doesn't compile anything. (You do get pom.xml inheritance but  
>>> that is
>>> not the same as dependencies).  Through the use of modules you  
>>> can run
>>> a single maven command at the parent level and it will also be  
>>> run on
>>> all the modules.
>>>
>>> A dependency is where your artifact requires the other artifact. And
>>> with Maven 2 this is now transitive.  So if artifact A depends on
>>> artifact B, and artifact B depends on C, then artifact A will
>>> automatically pull in C through B.  You can have dependencies  
>>> without
>>> having a module.
>>
>> I agree.
>>
>>>
>>> HTH
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>
>> Thanks,
>>
>> Roland
>>
>> ______________________________________________________________
>> Roland Förther                          100world.com AG
>> Roland.Foerther@100world.com            www.100world.com
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>

______________________________________________________________
Roland Förther                          100world.com AG
Roland.Foerther@100world.com            www.100world.com




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


Ad: Re: Howto declare a dependency on a group of modules

Posted by Stefan Magnus Landrø <st...@gjensidige.no>.
We've done something similar. We use project of type pom that declares 
dependencies to things that several of our projects need.

So, create a project with all the EJB dependencies, and include it as a 
standard dependency. The transitive-dependency mechanism in maven will 
take care of the rest.

Stefan

Roland Förther <ro...@100world.de> skrev 31.07.2006 12:33:04:

> Hi,
> 
> On 31.07.2006 at 11:42, Barrie Treloar wrote:
> 
> > On 7/31/06, Roland Förther <ro...@100world.de> wrote:
> >> Hi,
> >>
> >> is it possible to specify a dependency on several modules
> >> by a single dependency declaration (e.g. by a dependency on a parent
> >> pom)?
> >
> > You might want to explain more of what you are trying to do.
> 
> Ok, let me describe, what I'm trying to do. Think of a web client,
> which acts on a J2EE middleware using many ejb client JARs.
> Each ejb client JAR is an artifact generated by a maven project with 
> type 'ejb'.
> These ejb projects do not depend on each other and are part
> of what we call a middleware application.
> 
> In the web client's POM I have to make a dependency declaration
> on each ejb client jar separately. It would be nice for convenience 
> to have
> a kind of maven project, which for example could be called 
> 'application-x-ejb-client',
> that bundles the dependencies for a client and might help deliver 
> them all
> by providing a single dependency declaration on application-x-ejb-client
> in thw web client's POM.
> 
> 
> >
> > Also you might want to make sure the terminology you use is correct.
> > It took me a while to work it out and I can't guarantee I'm 100% 
> > correct.
> >
> > A module is just a way to make building your application easier from
> > the command line.
> > It has zero effect on dependencies since in order to be a parent
> > module and have modules your project must be of type pom, which is
> > doesn't compile anything. (You do get pom.xml inheritance but that is
> > not the same as dependencies).  Through the use of modules you can run
> > a single maven command at the parent level and it will also be run on
> > all the modules.
> >
> > A dependency is where your artifact requires the other artifact. And
> > with Maven 2 this is now transitive.  So if artifact A depends on
> > artifact B, and artifact B depends on C, then artifact A will
> > automatically pull in C through B.  You can have dependencies without
> > having a module.
> 
> I agree.
> 
> >
> > HTH
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> 
> Thanks,
> 
> Roland
> 
> ______________________________________________________________
> Roland Förther                          100world.com AG
> Roland.Foerther@100world.com            www.100world.com
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

Re: Howto declare a dependency on a group of modules

Posted by Roland Förther <ro...@100world.de>.
Hi,

On 31.07.2006 at 11:42, Barrie Treloar wrote:

> On 7/31/06, Roland Förther <ro...@100world.de> wrote:
>> Hi,
>>
>> is it possible to specify a dependency on several modules
>> by a single dependency declaration (e.g. by a dependency on a parent
>> pom)?
>
> You might want to explain more of what you are trying to do.

Ok, let me describe, what I'm trying to do. Think of a web client,
which acts on a J2EE middleware using many ejb client JARs.
Each ejb client JAR is an artifact generated by a maven project with  
type 'ejb'.
These ejb projects do not depend on each other and are part
of what we call a middleware application.

In the web client's POM I have to make a dependency declaration
on each ejb client jar separately. It would be nice for convenience  
to have
a kind of maven project, which for example could be called  
'application-x-ejb-client',
that bundles the dependencies for a client and might help deliver  
them all
by providing a single dependency declaration on application-x-ejb-client
in thw web client's POM.


>
> Also you might want to make sure the terminology you use is correct.
> It took me a while to work it out and I can't guarantee I'm 100%  
> correct.
>
> A module is just a way to make building your application easier from
> the command line.
> It has zero effect on dependencies since in order to be a parent
> module and have modules your project must be of type pom, which is
> doesn't compile anything. (You do get pom.xml inheritance but that is
> not the same as dependencies).  Through the use of modules you can run
> a single maven command at the parent level and it will also be run on
> all the modules.
>
> A dependency is where your artifact requires the other artifact. And
> with Maven 2 this is now transitive.  So if artifact A depends on
> artifact B, and artifact B depends on C, then artifact A will
> automatically pull in C through B.  You can have dependencies without
> having a module.

I agree.

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

Thanks,

Roland

______________________________________________________________
Roland Förther                          100world.com AG
Roland.Foerther@100world.com            www.100world.com




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


Re: Re: Howto declare a dependency on a group of modules

Posted by Stefan Magnus Landrø <st...@gjensidige.no>.
Have a look at transitive dependencies too (see Better builds with maven 
for more details).

HTH

"Barrie Treloar" <ba...@gmail.com> skrev 31.07.2006 11:42:46:

> On 7/31/06, Roland Förther <ro...@100world.de> wrote:
> > Hi,
> >
> > is it possible to specify a dependency on several modules
> > by a single dependency declaration (e.g. by a dependency on a parent
> > pom)?
> 
> You might want to explain more of what you are trying to do.
> 
> Also you might want to make sure the terminology you use is correct.
> It took me a while to work it out and I can't guarantee I'm 100% 
correct.
> 
> A module is just a way to make building your application easier from
> the command line.
> It has zero effect on dependencies since in order to be a parent
> module and have modules your project must be of type pom, which is
> doesn't compile anything. (You do get pom.xml inheritance but that is
> not the same as dependencies).  Through the use of modules you can run
> a single maven command at the parent level and it will also be run on
> all the modules.
> 
> A dependency is where your artifact requires the other artifact. And
> with Maven 2 this is now transitive.  So if artifact A depends on
> artifact B, and artifact B depends on C, then artifact A will
> automatically pull in C through B.  You can have dependencies without
> having a module.
> 
> HTH
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

Re: Howto declare a dependency on a group of modules

Posted by Barrie Treloar <ba...@gmail.com>.
On 7/31/06, Roland Förther <ro...@100world.de> wrote:
> Hi,
>
> is it possible to specify a dependency on several modules
> by a single dependency declaration (e.g. by a dependency on a parent
> pom)?

You might want to explain more of what you are trying to do.

Also you might want to make sure the terminology you use is correct.
It took me a while to work it out and I can't guarantee I'm 100% correct.

A module is just a way to make building your application easier from
the command line.
It has zero effect on dependencies since in order to be a parent
module and have modules your project must be of type pom, which is
doesn't compile anything. (You do get pom.xml inheritance but that is
not the same as dependencies).  Through the use of modules you can run
a single maven command at the parent level and it will also be run on
all the modules.

A dependency is where your artifact requires the other artifact. And
with Maven 2 this is now transitive.  So if artifact A depends on
artifact B, and artifact B depends on C, then artifact A will
automatically pull in C through B.  You can have dependencies without
having a module.

HTH

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