maven dependency scope [message #506508] |
Thu, 07 January 2010 13:46 |
Eclipse User |
|
|
|
Originally posted by: pajai.extrabright.com
Hi all,
Maven defines scopes with respect to dependencies. By default a
dependency has the scope 'compile', unless it is specified otherwise
(e.g. 'test').
Example (from pom.xml of artifactA):
<dependency>
<groupId>sample.group</groupId>
<artifactId>artifactB</artifactId>
<version>1</version>
<scope>test</test>
</dependency>
When in a bundle I have a dependency to artifactA, which defines a
test-scope dependency to artifactB (see previous snippet), then I am
generally not interested to fetch artifactB.
My question: can I with Buckminster restrict the transitive dependency
fetching to the 'compile' scope?
Thanks in advance.
Cheers!
Patrick
|
|
|
Re: maven dependency scope [message #506736 is a reply to message #506508] |
Sat, 09 January 2010 05:36 |
|
Hi Patrick,
Limiting based on scope sounds very reasonable. It is not yet implemented though, so a bugzilla for
this would be appreciated. A couple of questions since you seem knowledgeable in this area:
- Is the scope always present?
- If it's not present, does it always default to 'compile'?
- Would a solution where you can define the scope in a maven RMAP provider be OK (default being
'compile')
Regards,
Thomas Hallgren
Patrick J. wrote:
> Hi all,
>
> Maven defines scopes with respect to dependencies. By default a
> dependency has the scope 'compile', unless it is specified otherwise
> (e.g. 'test').
>
> Example (from pom.xml of artifactA):
>
> <dependency>
> <groupId>sample.group</groupId>
> <artifactId>artifactB</artifactId>
> <version>1</version>
> <scope>test</test>
> </dependency>
>
> When in a bundle I have a dependency to artifactA, which defines a
> test-scope dependency to artifactB (see previous snippet), then I am
> generally not interested to fetch artifactB.
>
> My question: can I with Buckminster restrict the transitive dependency
> fetching to the 'compile' scope?
>
> Thanks in advance.
> Cheers!
>
> Patrick
|
|
|
Re: maven dependency scope [message #507032 is a reply to message #506736] |
Mon, 11 January 2010 12:46 |
Eclipse User |
|
|
|
Originally posted by: pajai.extrabright.com
Hi Thomas,
Thanks for your answer. Ok, I'll write a bugzilla for this.
> - Is the scope always present?
The scope is not always present. It is per default 'compile'.
> - If it's not present, does it always default to 'compile'?
Yes. (As of the latest maven 2 version).
> - Would a solution where you can define the scope in a maven RMAP
> provider be OK (default being 'compile')
This might be a good solution (although I am not a maven guru). There is
more info about the maven scopes at [1]. There are 6 scopes defined
which have each a different behavior with respect to transitive
dependency inclusion (e.g. a compile-scope dependency will be a
compile-dependency of all dependent projects while a test-scope
dependency will affect only the project defining it). Perhaps a short
reflection with a maven guru on that topic would be good (since maven is
a world in itself).
Cheers,
Patrick
[1]
http://maven.apache.org/guides/introduction/introduction-to- dependency-mechanism.html#Dependency_Scope
|
|
|
|
Powered by
FUDForum. Page generated in 0.02494 seconds