Re: about dependence transfer

2008-01-21 Thread Guillaume Lederrey
On 17/01/2008, Simon Kitching [EMAIL PROTECTED] wrote:
 Suppose your project depends on class Foo from project p1 (and so declares a 
 compile-scope dependency on p1).

 But class Foo extends class Base from project p2 (and so p1 has a 
 compile-scope dependency on p2). So project p2 (even though it is a 
 transitive dependency) is needed at compile time for your code.

  I have a related question / remark : Imagine a Maven module that is
used as a library. This library has classes that are part of a public
interface, and classes the are the actual implementation. The
implementation can depend on other artifacts to compile, but those
artifacts should not be needed to compile a project depending on our
library.

  Of course, the right thing to do is to split the library in an api
module and an implementation module. But imagine that you have
legacy code that didnt follow this separation (everybody knows that
bad design never happens in real life project ;-). Would it be
possible to declare a compile time dependency that will not be
transitive ? Or that will only be a runtime dependency transitively ?

  I'd like to know what you think about this kind of problems ...

 P2's runtime dependencies will not be needed, so I suppose those are not 
 fetched.

 http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

 Cheers, Simon

  Nick Stolwijk [EMAIL PROTECTED] schrieb:
  Then I was wrong there. I thought when maven needs a dependency for
  compilation, it wouldn't need the transitive dependencies.
 
  With regards,
 
  Nick Stolwijk
 
  Simon Kitching wrote:
   Nick: for maven2, if a pom declares a dependency on something that itself 
   has non-optional dependencies, then they should get *immediately* 
   downloaded.
  
  
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Jabber : [EMAIL PROTECTED]
Skype : Guillaume.Lederrey
Projects :
* http://rwanda.wordpress.com/
* http://rwandatech.wordpress.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: about dependence transfer

2008-01-21 Thread Simon Kitching
 Guillaume Lederrey [EMAIL PROTECTED] schrieb:
 On 17/01/2008, Simon Kitching [EMAIL PROTECTED] wrote:
  Suppose your project depends on class Foo from project p1 (and so declares 
  a compile-scope dependency on p1).
 
  But class Foo extends class Base from project p2 (and so p1 has a 
  compile-scope dependency on p2). So project p2 (even though it is a 
  transitive dependency) is needed at compile time for your code.
 
   I have a related question / remark : Imagine a Maven module that is
 used as a library. This library has classes that are part of a public
 interface, and classes the are the actual implementation. The
 implementation can depend on other artifacts to compile, but those
 artifacts should not be needed to compile a project depending on our
 library.
 
   Of course, the right thing to do is to split the library in an api
 module and an implementation module. But imagine that you have
 legacy code that didnt follow this separation (everybody knows that
 bad design never happens in real life project ;-). Would it be
 possible to declare a compile time dependency that will not be
 transitive ? Or that will only be a runtime dependency transitively ?

What you could possibly do is create a profile that you would use for 
compiling. In this profile, add the problem dependencies with scope of 
compile. But in the main part, add the problem dependencies with scope of 
runtime, so that projects which just *use* your code (via its pom) see the 
lib as just a runtime dependency, not a compiletime one.

I'm not sure if it's possible to have the same dependency twice (which will 
happen when the profile is active) but it might be worth trying..

Regards, Simon

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: about dependence transfer

2008-01-21 Thread Wayne Fay
 What you could possibly do is create a profile that you would use for
 compiling. In this profile, add the problem dependencies with scope of
 compile. But in the main part, add the problem dependencies with scope of
 runtime, so that projects which just *use* your code (via its pom) see the
 lib as just a runtime dependency, not a compiletime one.

 I'm not sure if it's possible to have the same dependency twice (which will
 happen when the profile is active) but it might be worth trying..

I'm not sure either, but I would assume the least-restrictive scope
would win. So if you specify compile and runtime, you'll get
compile. If anything else happens, I might be inclined to call it a
bug, or I'd like someone to explain what they're thinking.

Try mvn help:effective-pom -pYOUR_PROFILE_NAME to see what Maven
actually does with the multiple dependency declarations.

Wayne

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: about dependence transfer

2008-01-17 Thread nicklist
You give not so much information, but I think I know why Maven didn't 
downloaded the dependencies. Because it didn't have to.

It wil only download dependencies if it has too. If you specify a dependency 
and need the transitive dependencies for compile time, you will need to add 
them yourself. You are depended on them, so you need to specify that. Else your 
code breaks if a newer version of another dependency stops being depended on it.

If you have further questions, please be more descriptive about what you are 
trying to do. 

Hth,

Nick Stolwijk

-Original Message-
From: cmd [mailto:[EMAIL PROTECTED]
Sent: Thu 1/17/2008 3:47 PM
To: users@maven.apache.org
Subject: about dependence transfer
 

i use maven2 to manage my jars
like this
dependency
groupIdorg.springframework/groupId
artifactIdspring/artifactId
version2.5.1/version
/dependency

but springframework depend some jars.Maven has not download the jars
automatic.
now how can i set the config file?

-- 
View this message in context: 
http://www.nabble.com/about-dependence-transfer-tp14920281s177p14920281.html
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: about dependence transfer

2008-01-17 Thread Simon Kitching
Nick: for maven2, if a pom declares a dependency on something that itself has 
non-optional dependencies, then they should get *immediately* downloaded.

cmd: is the small bit of config you originally posted nested inside a 
dependencyManagement section? If so, that is wrong.

Otherwise, please tell us why you think the dependencies of the 
org.springframework:spring library have not been downloaded.

Regards, Simon

 [EMAIL PROTECTED] schrieb:
 You give not so much information, but I think I know why Maven didn't 
 downloaded the dependencies. Because it didn't have to.
 
 It wil only download dependencies if it has too. If you specify a dependency 
 and need the transitive dependencies for compile time, you will need to add 
 them yourself. You are depended on them, so you need to specify that. Else 
 your code breaks if a newer version of another dependency stops being 
 depended on it.
 
 If you have further questions, please be more descriptive about what you are 
 trying to do. 
 
 Hth,
 
 Nick Stolwijk
 
 -Original Message-
 From: cmd [mailto:[EMAIL PROTECTED]
 Sent: Thu 1/17/2008 3:47 PM
 To: users@maven.apache.org
 Subject: about dependence transfer
  
 
 i use maven2 to manage my jars
 like this
 dependency
   groupIdorg.springframework/groupId
   artifactIdspring/artifactId
   version2.5.1/version
 /dependency
 
 but springframework depend some jars.Maven has not download the jars
 automatic.
 now how can i set the config file?
 
 -- 
 View this message in context: 
 http://www.nabble.com/about-dependence-transfer-tp14920281s177p14920281.html
 Sent from the Maven - Users mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: about dependence transfer

2008-01-17 Thread Nick Stolwijk
Then I was wrong there. I thought when maven needs a dependency for 
compilation, it wouldn't need the transitive dependencies.


With regards,

Nick Stolwijk

Simon Kitching wrote:

Nick: for maven2, if a pom declares a dependency on something that itself has 
non-optional dependencies, then they should get *immediately* downloaded.

  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: about dependence transfer

2008-01-17 Thread Simon Kitching
Suppose your project depends on class Foo from project p1 (and so declares a 
compile-scope dependency on p1).

But class Foo extends class Base from project p2 (and so p1 has a compile-scope 
dependency on p2). So project p2 (even though it is a transitive dependency) is 
needed at compile time for your code.

P2's runtime dependencies will not be needed, so I suppose those are not 
fetched.

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

Cheers, Simon

 Nick Stolwijk [EMAIL PROTECTED] schrieb:
 Then I was wrong there. I thought when maven needs a dependency for 
 compilation, it wouldn't need the transitive dependencies.
 
 With regards,
 
 Nick Stolwijk
 
 Simon Kitching wrote:
  Nick: for maven2, if a pom declares a dependency on something that itself 
  has non-optional dependencies, then they should get *immediately* 
  downloaded.
 

 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]