You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ken Weiner <kw...@gmail.com> on 2005/08/04 08:37:43 UTC

[m2] Behavior of transitive dependencies

I am new to Maven 2 and am trying to understand currently, in alpha 3,
how transitive dependencies are supposed to be working.

If I want to include something like dom4j-1.6.jar, but none of the
dom4j dependencies, in my project, how would I specify this in the
pom?  I tried the following, and since the dom4j pom has many
dependencies listed in it, maven tries to grab them all and fails
because many aren't available in the repositories.

<dependency>
    <groupId>dom4j</groupId>
    <artifactId>dom4j</artifactId>
    <version>1.6</version>
    <scope>runtime</scope>
</dependency>

I don't know if I should be declaring something differently in my pom
or in the dom4j pom.

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


Re: [m2] Behavior of transitive dependencies

Posted by Brett Porter <br...@gmail.com>.
Some of them should be test dependencies.

The rest, which are "optional", become tricky to declare. If we leave
them out of the dom4j pom, then if you touch that code and don't use
the dep, you get a runtime error. We instead chose the current
approach of passing along all the deps, and having to exclude them in
your build. By making the problem be a compile time problem, you get a
lot more assistance rather than a sneaky error at runtime, and often
the extra dependencies are harmless.

- Brett

On 8/5/05, Ken Weiner <kw...@gmail.com> wrote:
> Thanks for the reply, Brett. I suspected that the issue was within
> dom4j's POM, and I'd like to help clean it up by submitting issues to
> MEV in JIRA.  However, I am not sure what the appropriate corrections
> would be.  Should the jars inside the dom4j POM be declared with a
> particular scope that would prevent them from being fetched when
> another POM depends on dom4j?  If so, which scope would this be?
> 
> -Ken
> 
> On 8/3/05, Brett Porter <br...@gmail.com> wrote:
> > There isn't actually a way to turn it off wholesale, but you can
> > exclude specific ones using <exclusions />:
> >
> > <dependency>
> >   <groupId>dom4j</groupId>
> >   ...
> >   <exclusions>
> >     <exclusion>
> >       <groupId>jdbc</groupId>
> >       <artifactId>jdbc</artifactId>
> >     </exclusion>
> >     ...
> >   </exclusions>
> >
> > This should be considered a last resort - what really needs to happen
> > is for the dom4j metadata to be corrected. It in particular is well
> > known to be problematic.
> >
> > You can file issues for other metadata at http://jira.codehaus.org/browse/MEV
> >
> > We will be spending more time after the beta-1 release on cleaning up
> > the existing metadata.
> >
> > - Brett
>

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


Re: [m2] Behavior of transitive dependencies

Posted by Ken Weiner <kw...@gmail.com>.
Thanks for the reply, Brett. I suspected that the issue was within
dom4j's POM, and I'd like to help clean it up by submitting issues to
MEV in JIRA.  However, I am not sure what the appropriate corrections
would be.  Should the jars inside the dom4j POM be declared with a
particular scope that would prevent them from being fetched when
another POM depends on dom4j?  If so, which scope would this be?

-Ken

On 8/3/05, Brett Porter <br...@gmail.com> wrote:
> There isn't actually a way to turn it off wholesale, but you can
> exclude specific ones using <exclusions />:
> 
> <dependency>
>   <groupId>dom4j</groupId>
>   ...
>   <exclusions>
>     <exclusion>
>       <groupId>jdbc</groupId>
>       <artifactId>jdbc</artifactId>
>     </exclusion>
>     ...
>   </exclusions>
> 
> This should be considered a last resort - what really needs to happen
> is for the dom4j metadata to be corrected. It in particular is well
> known to be problematic.
> 
> You can file issues for other metadata at http://jira.codehaus.org/browse/MEV
> 
> We will be spending more time after the beta-1 release on cleaning up
> the existing metadata.
> 
> - Brett

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


Re: [m2] Behavior of transitive dependencies

Posted by Brett Porter <br...@gmail.com>.
There isn't actually a way to turn it off wholesale, but you can
exclude specific ones using <exclusions />:

<dependency>
  <groupId>dom4j</groupId>
  ...
  <exclusions>
    <exclusion>
      <groupId>jdbc</groupId>
      <artifactId>jdbc</artifactId>
    </exclusion>
    ...
  </exclusions>
  
This should be considered a last resort - what really needs to happen
is for the dom4j metadata to be corrected. It in particular is well
known to be problematic.

You can file issues for other metadata at http://jira.codehaus.org/browse/MEV

We will be spending more time after the beta-1 release on cleaning up
the existing metadata.

- Brett

On 8/4/05, Ken Weiner <kw...@gmail.com> wrote:
> I am new to Maven 2 and am trying to understand currently, in alpha 3,
> how transitive dependencies are supposed to be working.
> 
> If I want to include something like dom4j-1.6.jar, but none of the
> dom4j dependencies, in my project, how would I specify this in the
> pom?  I tried the following, and since the dom4j pom has many
> dependencies listed in it, maven tries to grab them all and fails
> because many aren't available in the repositories.
> 
> <dependency>
>     <groupId>dom4j</groupId>
>     <artifactId>dom4j</artifactId>
>     <version>1.6</version>
>     <scope>runtime</scope>
> </dependency>
> 
> I don't know if I should be declaring something differently in my pom
> or in the dom4j pom.
> 
> ---------------------------------------------------------------------
> 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