You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by monkeyden <mo...@monkeyden.com> on 2009/07/24 18:41:32 UTC

Primary and secondary dependencies

I have the scope of some 3rd party dependencies set to "provided", but keep
getting all the secondary dependencies in my build.  I have 3 versions of
ant, when I don't even need 1.

How best to prevent secondary dependencies from being added to the build?  

Do the secondary dependencies inherit scope from the primary dependency or
do they sneak in?  I'd prefer not to explicitly do any of this for
secondaries.

thanks
-- 
View this message in context: http://www.nabble.com/Primary-and-secondary-dependencies-tp24647841p24647841.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: Primary and secondary dependencies

Posted by Juven Xu <ju...@sonatype.com>.
_ant:ant:jar:1.6.5:provided_ would not be packaged in your ear.

it's scope is provided, which mean Maven will assume it will be provided by
the environment, like web container.

On Mon, Jul 27, 2009 at 11:19 PM, monkeyden <mo...@monkeyden.com> wrote:

>
> Thanks for the reply Jonathan.  Here (below) is an example.  Ant 1.6.5 is a
> transitive dependency of my ejb jar module.  As you can see, it's set to
> "provided" all the way through, yet it ends up in my ear.  Based on my
> (quite possibly wrong) understanding of dependency scope, it shouldn't be.
> Thanks.
>
>
>
> +- com.mycompany.myapp.ws:ids-seam-ws-ejb:ejb:1.0:provided
> [INFO] |  +- quartz:quartz:jar:1.5.2:provided
> [INFO] |  +- org.jboss.portal.portlet:portlet-portlet:jar:2.0.4:provided
> [INFO] |  |  +- javax.portlet:portlet-api:jar:2.0:provided
> [INFO] |  |  +- org.jboss.portal.common:common-portal:jar:1.2.2:provided
> [INFO] |  |  +- org.jboss.portal.web:web-web:jar:1.2.2:provided
> [INFO] |  |  |  +- org.jboss.portal.common:common-common:jar:1.2.2:provided
> [INFO] |  |  |  |  +- javax.activation:activation:jar:1.1:provided
> [INFO] |  |  |  |  +- jboss:jboss-j2ee:jar:4.2.0.GA:provided
> [INFO] |  |  |  |  +- ant:ant:jar:1.6.5:provided
>
>
>
>
>
> Jonathan Woods wrote:
> >
> > I find the phrase "they are not transitive" a bit confusing here.
>  Anyway,
> > the way it should work is shown in the table at
> >
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mecha
> > nism.html#Dependency_Scope, which shows that the scope of dependencies
> > contributed by your 'provided' dependency should never be greater than
> > 'provided'.  In other words, you shouldn't be getting the transitive deps
> > either... but I have no explanation as to why you might be!  Are you sure
> > some other dependency which is tighter than 'provided' isn't bringing
> them
> > in?
> >
> > Try running   mvn dependency:tree  on your project and seeing what it
> > tells
> > you.
> >
> > Jon
> >
> >> -----Original Message-----
> >> From: monkeyden [mailto:monkeys@monkeyden.com]
> >> Sent: 24 July 2009 17:50
> >> To: users@maven.apache.org
> >> Subject: Re: Primary and secondary dependencies
> >>
> >>
> >> Based on this definition, which comes from the maven docs, I
> >> should NOT get the "primary" dependency in my build, but what
> >> about the transitive dependencies?  Do you suggest I should
> >> not be seeing this behavior when the primary dependency is
> >> provided?  thanks again.
> >>
> >> provided
> >> provided dependencies are used when you expect the JDK or a
> >> container to provide them. For example, if you were
> >> developing a web application, you would need the Servlet API
> >> available on the compile classpath to compile a servlet, but
> >> you wouldn't want to include the Servlet API in the packaged
> >> WAR; the Servlet API JAR is supplied by your application
> >> server or servlet container. provided dependencies are
> >> available on the compilation classpath (not runtime). They
> >> are not transitive, nor are they packaged.
> >>
> >>
> >>
> >>
> >> Juven Xu wrote:
> >> >
> >> > they are _transitive_ dependencies :) but you name them _secondary_
> >> > dependencies :)
> >> >
> >> > you would want to read this document:
> >> >
> >> http://www.sonatype.com/books/maven-book/reference/pom-relationships-s
> >> > ect-project-dependencies.html
> >> >
> >> > On Sat, Jul 25, 2009 at 12:41 AM, monkeyden
> >> <mo...@monkeyden.com> wrote:
> >> >
> >> >>
> >> >> I have the scope of some 3rd party dependencies set to "provided",
> >> >> but keep getting all the secondary dependencies in my
> >> build.  I have
> >> >> 3 versions of ant, when I don't even need 1.
> >> >>
> >> >> How best to prevent secondary dependencies from being
> >> added to the build?
> >> >>
> >> >> Do the secondary dependencies inherit scope from the primary
> >> >> dependency or do they sneak in?  I'd prefer not to
> >> explicitly do any
> >> >> of this for secondaries.
> >> >>
> >> >> thanks
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/Primary-and-secondary-dependencies-tp24647841p2
> >> >> 4647841.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
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > - juven
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Primary-and-secondary-dependencies-tp246
> > 47841p24647985.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
> >>
> >
> >
> > ---------------------------------------------------------------------
> > 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/Primary-and-secondary-dependencies-tp24647841p24682509.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
>
>


-- 
- juven

RE: Primary and secondary dependencies

Posted by monkeyden <mo...@monkeyden.com>.
Thanks for the reply Jonathan.  Here (below) is an example.  Ant 1.6.5 is a
transitive dependency of my ejb jar module.  As you can see, it's set to
"provided" all the way through, yet it ends up in my ear.  Based on my
(quite possibly wrong) understanding of dependency scope, it shouldn't be. 
Thanks.



+- com.mycompany.myapp.ws:ids-seam-ws-ejb:ejb:1.0:provided
[INFO] |  +- quartz:quartz:jar:1.5.2:provided
[INFO] |  +- org.jboss.portal.portlet:portlet-portlet:jar:2.0.4:provided
[INFO] |  |  +- javax.portlet:portlet-api:jar:2.0:provided
[INFO] |  |  +- org.jboss.portal.common:common-portal:jar:1.2.2:provided
[INFO] |  |  +- org.jboss.portal.web:web-web:jar:1.2.2:provided
[INFO] |  |  |  +- org.jboss.portal.common:common-common:jar:1.2.2:provided
[INFO] |  |  |  |  +- javax.activation:activation:jar:1.1:provided
[INFO] |  |  |  |  +- jboss:jboss-j2ee:jar:4.2.0.GA:provided
[INFO] |  |  |  |  +- ant:ant:jar:1.6.5:provided





Jonathan Woods wrote:
> 
> I find the phrase "they are not transitive" a bit confusing here.  Anyway,
> the way it should work is shown in the table at
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mecha
> nism.html#Dependency_Scope, which shows that the scope of dependencies
> contributed by your 'provided' dependency should never be greater than
> 'provided'.  In other words, you shouldn't be getting the transitive deps
> either... but I have no explanation as to why you might be!  Are you sure
> some other dependency which is tighter than 'provided' isn't bringing them
> in?
> 
> Try running   mvn dependency:tree  on your project and seeing what it
> tells
> you.
> 
> Jon
> 
>> -----Original Message-----
>> From: monkeyden [mailto:monkeys@monkeyden.com] 
>> Sent: 24 July 2009 17:50
>> To: users@maven.apache.org
>> Subject: Re: Primary and secondary dependencies
>> 
>> 
>> Based on this definition, which comes from the maven docs, I 
>> should NOT get the "primary" dependency in my build, but what 
>> about the transitive dependencies?  Do you suggest I should 
>> not be seeing this behavior when the primary dependency is 
>> provided?  thanks again.
>> 
>> provided
>> provided dependencies are used when you expect the JDK or a 
>> container to provide them. For example, if you were 
>> developing a web application, you would need the Servlet API 
>> available on the compile classpath to compile a servlet, but 
>> you wouldn't want to include the Servlet API in the packaged 
>> WAR; the Servlet API JAR is supplied by your application 
>> server or servlet container. provided dependencies are 
>> available on the compilation classpath (not runtime). They 
>> are not transitive, nor are they packaged.
>> 
>> 
>> 
>> 
>> Juven Xu wrote:
>> > 
>> > they are _transitive_ dependencies :) but you name them _secondary_ 
>> > dependencies :)
>> > 
>> > you would want to read this document:
>> > 
>> http://www.sonatype.com/books/maven-book/reference/pom-relationships-s
>> > ect-project-dependencies.html
>> > 
>> > On Sat, Jul 25, 2009 at 12:41 AM, monkeyden 
>> <mo...@monkeyden.com> wrote:
>> > 
>> >>
>> >> I have the scope of some 3rd party dependencies set to "provided", 
>> >> but keep getting all the secondary dependencies in my 
>> build.  I have 
>> >> 3 versions of ant, when I don't even need 1.
>> >>
>> >> How best to prevent secondary dependencies from being 
>> added to the build?
>> >>
>> >> Do the secondary dependencies inherit scope from the primary 
>> >> dependency or do they sneak in?  I'd prefer not to 
>> explicitly do any 
>> >> of this for secondaries.
>> >>
>> >> thanks
>> >> --
>> >> View this message in context:
>> >> 
>> http://www.nabble.com/Primary-and-secondary-dependencies-tp24647841p2
>> >> 4647841.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
>> >>
>> >>
>> > 
>> > 
>> > --
>> > - juven
>> > 
>> > 
>> 
>> --
>> View this message in context: 
>> http://www.nabble.com/Primary-and-secondary-dependencies-tp246
> 47841p24647985.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
>> 
> 
> 
> ---------------------------------------------------------------------
> 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/Primary-and-secondary-dependencies-tp24647841p24682509.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: Primary and secondary dependencies

Posted by Jonathan Woods <jo...@scintillance.com>.
I find the phrase "they are not transitive" a bit confusing here.  Anyway,
the way it should work is shown in the table at
http://maven.apache.org/guides/introduction/introduction-to-dependency-mecha
nism.html#Dependency_Scope, which shows that the scope of dependencies
contributed by your 'provided' dependency should never be greater than
'provided'.  In other words, you shouldn't be getting the transitive deps
either... but I have no explanation as to why you might be!  Are you sure
some other dependency which is tighter than 'provided' isn't bringing them
in?

Try running   mvn dependency:tree  on your project and seeing what it tells
you.

Jon

> -----Original Message-----
> From: monkeyden [mailto:monkeys@monkeyden.com] 
> Sent: 24 July 2009 17:50
> To: users@maven.apache.org
> Subject: Re: Primary and secondary dependencies
> 
> 
> Based on this definition, which comes from the maven docs, I 
> should NOT get the "primary" dependency in my build, but what 
> about the transitive dependencies?  Do you suggest I should 
> not be seeing this behavior when the primary dependency is 
> provided?  thanks again.
> 
> provided
> provided dependencies are used when you expect the JDK or a 
> container to provide them. For example, if you were 
> developing a web application, you would need the Servlet API 
> available on the compile classpath to compile a servlet, but 
> you wouldn't want to include the Servlet API in the packaged 
> WAR; the Servlet API JAR is supplied by your application 
> server or servlet container. provided dependencies are 
> available on the compilation classpath (not runtime). They 
> are not transitive, nor are they packaged.
> 
> 
> 
> 
> Juven Xu wrote:
> > 
> > they are _transitive_ dependencies :) but you name them _secondary_ 
> > dependencies :)
> > 
> > you would want to read this document:
> > 
> http://www.sonatype.com/books/maven-book/reference/pom-relationships-s
> > ect-project-dependencies.html
> > 
> > On Sat, Jul 25, 2009 at 12:41 AM, monkeyden 
> <mo...@monkeyden.com> wrote:
> > 
> >>
> >> I have the scope of some 3rd party dependencies set to "provided", 
> >> but keep getting all the secondary dependencies in my 
> build.  I have 
> >> 3 versions of ant, when I don't even need 1.
> >>
> >> How best to prevent secondary dependencies from being 
> added to the build?
> >>
> >> Do the secondary dependencies inherit scope from the primary 
> >> dependency or do they sneak in?  I'd prefer not to 
> explicitly do any 
> >> of this for secondaries.
> >>
> >> thanks
> >> --
> >> View this message in context:
> >> 
> http://www.nabble.com/Primary-and-secondary-dependencies-tp24647841p2
> >> 4647841.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
> >>
> >>
> > 
> > 
> > --
> > - juven
> > 
> > 
> 
> --
> View this message in context: 
> http://www.nabble.com/Primary-and-secondary-dependencies-tp246
47841p24647985.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
> 


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


Re: Primary and secondary dependencies

Posted by monkeyden <mo...@monkeyden.com>.
Based on this definition, which comes from the maven docs, I should NOT get
the "primary" dependency in my build, but what about the transitive
dependencies?  Do you suggest I should not be seeing this behavior when the
primary dependency is provided?  thanks again.

provided
provided dependencies are used when you expect the JDK or a container to
provide them. For example, if you were developing a web application, you
would need the Servlet API available on the compile classpath to compile a
servlet, but you wouldn’t want to include the Servlet API in the packaged
WAR; the Servlet API JAR is supplied by your application server or servlet
container. provided dependencies are available on the compilation classpath
(not runtime). They are not transitive, nor are they packaged.




Juven Xu wrote:
> 
> they are _transitive_ dependencies :) but you name them _secondary_
> dependencies :)
> 
> you would want to read this document:
> http://www.sonatype.com/books/maven-book/reference/pom-relationships-sect-project-dependencies.html
> 
> On Sat, Jul 25, 2009 at 12:41 AM, monkeyden <mo...@monkeyden.com> wrote:
> 
>>
>> I have the scope of some 3rd party dependencies set to "provided", but
>> keep
>> getting all the secondary dependencies in my build.  I have 3 versions of
>> ant, when I don't even need 1.
>>
>> How best to prevent secondary dependencies from being added to the build?
>>
>> Do the secondary dependencies inherit scope from the primary dependency
>> or
>> do they sneak in?  I'd prefer not to explicitly do any of this for
>> secondaries.
>>
>> thanks
>> --
>> View this message in context:
>> http://www.nabble.com/Primary-and-secondary-dependencies-tp24647841p24647841.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
>>
>>
> 
> 
> -- 
> - juven
> 
> 

-- 
View this message in context: http://www.nabble.com/Primary-and-secondary-dependencies-tp24647841p24647985.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: Primary and secondary dependencies

Posted by Juven Xu <ju...@sonatype.com>.
they are _transitive_ dependencies :) but you name them _secondary_
dependencies :)

you would want to read this document:
http://www.sonatype.com/books/maven-book/reference/pom-relationships-sect-project-dependencies.html

On Sat, Jul 25, 2009 at 12:41 AM, monkeyden <mo...@monkeyden.com> wrote:

>
> I have the scope of some 3rd party dependencies set to "provided", but keep
> getting all the secondary dependencies in my build.  I have 3 versions of
> ant, when I don't even need 1.
>
> How best to prevent secondary dependencies from being added to the build?
>
> Do the secondary dependencies inherit scope from the primary dependency or
> do they sneak in?  I'd prefer not to explicitly do any of this for
> secondaries.
>
> thanks
> --
> View this message in context:
> http://www.nabble.com/Primary-and-secondary-dependencies-tp24647841p24647841.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
>
>


-- 
- juven