RE: cannot get transitive dependencies working

2011-04-05 Thread Khai Do
Ahh, I get it.  Thank you for the clarification.  


Re: cannot get transitive dependencies working

2011-04-05 Thread Lars Corneliussen

Hi,

A transitive dependency is a dependeny of your dependency.

If you reference a class of that "transitive" dependency, it is not a 
dependency of your dependency anymore. It's now also your direct 
dependency and hence SHOULD be declared in the POM.


_
Lars

Am 05.04.11 18:32, schrieb Brett Porter:

You're correct, and I think it is behaving as you expect.

What I'm trying to be clear on (which is sometimes hard without pictures):

Let's say B depends on C. Let's say your current project's source code uses 
classes from all of A, B and C.

You should declare all 3 dependencies, because you need to compile against 
them. You shouldn't rely on not declaring C because B will bring it in - 
because B might later change not to, or use a different version.

Now, if you just use A, B - you only compile against A, B, but you run against 
A, B, C (because B needs C to run).

The problem in Java is if C contains an abstract class implemented in B, you 
need to compile against C, even if you only use classes from A and B.

:)

On 06/04/2011, at 2:11 AM, Khai Do wrote:


Hi Brett.  Maybe I don't understand. What do you mean when you say ".NET is not 
burdened the same way"?  As a best practice (for java projects) I follow the pattern 
of only referencing top level modules and letting maven resolve all the transitive 
dependencies for me on compile.  I believe this is the definition of dependency 
management.  It seems like your suggesting that .NET is not build the same way and I 
shouldn't follow this pattern for npanday builds?  Wouldn't this break maven's dependency 
management feature?  -Khai


--
Brett Porter
br...@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter








Re: cannot get transitive dependencies working

2011-04-05 Thread Brett Porter
You're correct, and I think it is behaving as you expect.

What I'm trying to be clear on (which is sometimes hard without pictures):

Let's say B depends on C. Let's say your current project's source code uses 
classes from all of A, B and C.

You should declare all 3 dependencies, because you need to compile against 
them. You shouldn't rely on not declaring C because B will bring it in - 
because B might later change not to, or use a different version.

Now, if you just use A, B - you only compile against A, B, but you run against 
A, B, C (because B needs C to run).

The problem in Java is if C contains an abstract class implemented in B, you 
need to compile against C, even if you only use classes from A and B.

:)

On 06/04/2011, at 2:11 AM, Khai Do wrote:

> Hi Brett.  Maybe I don't understand. What do you mean when you say ".NET is 
> not burdened the same way"?  As a best practice (for java projects) I follow 
> the pattern of only referencing top level modules and letting maven resolve 
> all the transitive dependencies for me on compile.  I believe this is the 
> definition of dependency management.  It seems like your suggesting that .NET 
> is not build the same way and I shouldn't follow this pattern for npanday 
> builds?  Wouldn't this break maven's dependency management feature?  -Khai
> 

--
Brett Porter
br...@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter






RE: cannot get transitive dependencies working

2011-04-05 Thread Khai Do
Hi Brett.  Maybe I don't understand. What do you mean when you say ".NET is not 
burdened the same way"?  As a best practice (for java projects) I follow the 
pattern of only referencing top level modules and letting maven resolve all the 
transitive dependencies for me on compile.  I believe this is the definition of 
dependency management.  It seems like your suggesting that .NET is not build 
the same way and I shouldn't follow this pattern for npanday builds?  Wouldn't 
this break maven's dependency management feature?  -Khai



Re: cannot get transitive dependencies working

2011-04-05 Thread Brett Porter
Maven originally didn't allow transitive, compile time dependencies. 
Unfortunately, there are certain circumstances under which Java requires them 
at compile time and I reluctantly changed it to avoid confusion. The 
dependency:analyze goal now warns you if you don't specify them directly.

.NET isn't burdened in the same way, so it's desired that things you directly 
use in the current project are specified (which things required by your 
dependencies are brought in transitively)

On 06/04/2011, at 1:01 AM, Khai Do wrote:

> The whole point of maven's transitive dependency feature is to pull in all 
> indirect dependencies for build, test, and runtime.  At least this is how it 
> works with maven java projects.  You should not have to supply concrete 
> references to every library that a project depends on, it would be a 
> nightmare to manage if your chain of dependencies gets really long.  Also 
> your pom files will be very long containing lots of duplication.
> 
> Here is what I expect..
> ProjectB depends on projectA, projectC depends on projectB.  Therefore when I 
> build projectC using npanday it should recognize projectA as a transitive 
> dependency and automatically download and reference projectA as well.
> 

--
Brett Porter
br...@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter






RE: cannot get transitive dependencies working

2011-04-05 Thread Khai Do
The whole point of maven's transitive dependency feature is to pull in all 
indirect dependencies for build, test, and runtime.  At least this is how it 
works with maven java projects.  You should not have to supply concrete 
references to every library that a project depends on, it would be a nightmare 
to manage if your chain of dependencies gets really long.  Also your pom files 
will be very long containing lots of duplication.

Here is what I expect..
ProjectB depends on projectA, projectC depends on projectB.  Therefore when I 
build projectC using npanday it should recognize projectA as a transitive 
dependency and automatically download and reference projectA as well.



Re: cannot get transitive dependencies working

2011-04-05 Thread Lars Corneliussen

Hi,

I am not sure about that, but I think you should  use a concrete 
reference whenever you compile against something - since you are taking 
*direct* dependency on it.


Transitive dependencies will work for runtime or test scope, where 
projectB needs projectC in order to run correctly.


_
yours,
Lars

Am 05.04.11 15:28, schrieb Khai Do:

Hello, Can anybody tell me if transitive dependencies work when using npanday?  
I have a .NET multi module project and have the following simple scenario where 
transitive dependency isn't working.  I'm using java 1.6, maven 2.2.1, and 
npanday-1.3-incubating,

I have 3 projects: projectA, projectB and projectC.

projectB depends on projectA.  ProjectB and projectA build just fine.I create 
projectC which depends on projectA&  projectB.  When I create my projectC 
pom.xml  I add projectB as the only  dependency keeping in mind that maven should 
pull in projectA through its transitive dependency mechanism.  However when I build 
projectC it fails and says that it can't find classes from projectA.

When I add projectA as a dependency to projectC then it builds just fine.

Any help would be appreciated.  Thanks.