Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Buckminster » maven dependency scope
maven dependency scope [message #506508] Thu, 07 January 2010 08:46 Go to next message
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 00:36 Go to previous messageGo to next message
Thomas Hallgren is currently offline Thomas Hallgren
Messages: 3214
Registered: July 2009
Senior Member
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 07:46 Go to previous messageGo to next message
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
Re: maven dependency scope [message #507464 is a reply to message #507032] Wed, 13 January 2010 10:08 Go to previous message
Eclipse User
Originally posted by: pajai.extrabright.com

Hi Thomas,

Here is the bugzilla entry to that:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=299491

Cheers!
Patrick
Previous Topic:import of root files, root folders - but the directory structure will be flatten
Next Topic:Updating a self made eclipse product (site.p2) problem
Goto Forum:
  


Current Time: Fri Jul 25 01:16:54 EDT 2014

Powered by FUDForum. Page generated in 0.06008 seconds