You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by jaikiran <ja...@yahoo.co.in> on 2010/01/06 10:57:08 UTC

Optionally disable transitive dependencies in Maven

Hello everyone,

I am using Maven-2.0.9 and I have a project A which depends on a couple of
classes from project B. So obviously, i have a dependency in my pom.xml as
follows:

<dependency>
      <groupId>org</groupId>
      <artifactId>projectB</artifactId>
</dependency>

But the project B has a long list of transitive dependencies, none of which
are required in project A. I was looking for a way to disable those
transitive dependencies from being pulled into project A. One option would
be to add numerous "exclude" elements to the dependency. But this is not
practical, given the long list of transitive dependencies.

I was looking for something like the following:

<dependency>
      <groupId>org</groupId>
      <artifactId>projectB</artifactId>
      <transitive>false</transitive>
</dependency>

A "transitive" child element to the dependency element which can then be
configured to disable transitive dependencies from being pulled in. From
what i learn based on my discussion about this on #maven IRC, there's no
technical reason why this can't be done/allowed. 

It would be useful to have this feature in Maven to disable transitive
dependencies. Any thoughts?

P.S: Is this the right list or should this be in maven-dev list?




-- 
View this message in context: http://n2.nabble.com/Optionally-disable-transitive-dependencies-in-Maven-tp4259924p4259924.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: Optionally disable transitive dependencies in Maven

Posted by Stevo Slavić <ss...@gmail.com>.
http://jira.codehaus.org/browse/MNG-2315

http://stackoverflow.com/questions/547805/how-to-exclude-all-transitive-dependencies-of-a-maven-dependency

Regards,
Stevo.

On Wed, Jan 6, 2010 at 11:45 AM, jaikiran <ja...@yahoo.co.in>wrote:

>
> I would have done that. But the project B is not in my control. It's a
> third
> party project.
>
>
> Stevo Slavić wrote:
> >
> > I'd suggest that you refactor projectB bits used by both projectB and
> > projectA into a new projectC module and have it referenced as dependency
> > from both projectA and projectB.
> >
> > Regards,
> > Stevo.
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/Optionally-disable-transitive-dependencies-in-Maven-tp4259924p4260065.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: Optionally disable transitive dependencies in Maven

Posted by jaikiran <ja...@yahoo.co.in>.
I would have done that. But the project B is not in my control. It's a third
party project.


Stevo Slavić wrote:
> 
> I'd suggest that you refactor projectB bits used by both projectB and
> projectA into a new projectC module and have it referenced as dependency
> from both projectA and projectB.
> 
> Regards,
> Stevo.
> 
> 

-- 
View this message in context: http://n2.nabble.com/Optionally-disable-transitive-dependencies-in-Maven-tp4259924p4260065.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: Optionally disable transitive dependencies in Maven

Posted by Stevo Slavić <ss...@gmail.com>.
I'd suggest that you refactor projectB bits used by both projectB and
projectA into a new projectC module and have it referenced as dependency
from both projectA and projectB.

Regards,
Stevo.

On Wed, Jan 6, 2010 at 10:57 AM, jaikiran <ja...@yahoo.co.in>wrote:

>
> Hello everyone,
>
> I am using Maven-2.0.9 and I have a project A which depends on a couple of
> classes from project B. So obviously, i have a dependency in my pom.xml as
> follows:
>
> <dependency>
>      <groupId>org</groupId>
>      <artifactId>projectB</artifactId>
> </dependency>
>
> But the project B has a long list of transitive dependencies, none of which
> are required in project A. I was looking for a way to disable those
> transitive dependencies from being pulled into project A. One option would
> be to add numerous "exclude" elements to the dependency. But this is not
> practical, given the long list of transitive dependencies.
>
> I was looking for something like the following:
>
> <dependency>
>      <groupId>org</groupId>
>      <artifactId>projectB</artifactId>
>      <transitive>false</transitive>
> </dependency>
>
> A "transitive" child element to the dependency element which can then be
> configured to disable transitive dependencies from being pulled in. From
> what i learn based on my discussion about this on #maven IRC, there's no
> technical reason why this can't be done/allowed.
>
> It would be useful to have this feature in Maven to disable transitive
> dependencies. Any thoughts?
>
> P.S: Is this the right list or should this be in maven-dev list?
>
>
>
>
> --
> View this message in context:
> http://n2.nabble.com/Optionally-disable-transitive-dependencies-in-Maven-tp4259924p4259924.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
>
>