You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Markus Jostock <ma...@softwareag.com> on 2008/11/06 11:33:09 UTC

Dependency of sibling module

Hi

My project structure is like this

parent            <-- type pom
  +-- module1     <-- type jar
  +-- module2     <-- type jar, depends on module 1

When running mvn in the parent directory everything works fine.

But when running mvn in the module2, which depends on module1, maven 
tries to download the library of module1 from the web and thus doesn't 
succeed.

I probably misunderstood the dependency mechanism, but this really 
remains a mind boggling issue to me.

Could somebody point out to me why this happens?

Markus


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


Re: Dependency of sibling module

Posted by Samuli Saarinen <sa...@remion.com>.
Hi,

AFAIK reactor can be thought of as an aggregation of the projects that 
are part of the build starting from the level in the project that maven 
is executed.

I think it _could_ be possible to resolve dependencies the way you 
describe but it is not the way maven does it :)

-Samuli

Markus Jostock wrote:
> So it's the reactor which is a kind of execution entity? I thought it 
> would be possible for the reactor via the parent/child relationship to 
> find the parent pom and therein the <module>module1</module> ...
> 
> Cheers
> Markus
> 
> 
> Samuli Saarinen wrote :
>>> parent            <-- type pom
>>>  +-- module1     <-- type jar
>>>  +-- module2     <-- type jar, depends on module 1
>>>
>>
>> When you build the project from the parent level both module1 and 
>> module2 are in the same reactor and maven is able to resolve the 
>> dependency. That is not the case when building directly from module2
>>



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


Re: Dependency of sibling module

Posted by Markus Jostock <ma...@softwareag.com>.
Hi Samuli

Many thanks, yes this solved my problem.

So it's the reactor which is a kind of execution entity? I thought it 
would be possible for the reactor via the parent/child relationship to 
find the parent pom and therein the <module>module1</module> ...

Cheers
 Markus


Samuli Saarinen wrote :
>> parent            <-- type pom
>>  +-- module1     <-- type jar
>>  +-- module2     <-- type jar, depends on module 1
>>
>
> When you build the project from the parent level both module1 and 
> module2 are in the same reactor and maven is able to resolve the 
> dependency. That is not the case when building directly from module2
>



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


Re: Dependency of sibling module

Posted by Samuli Saarinen <sa...@remion.com>.
Markus Jostock wrote:
> Hi
> 
> My project structure is like this
> 
> parent            <-- type pom
>  +-- module1     <-- type jar
>  +-- module2     <-- type jar, depends on module 1
> 
> When running mvn in the parent directory everything works fine.
> 
> But when running mvn in the module2, which depends on module1, maven 
> tries to download the library of module1 from the web and thus doesn't 
> succeed.
> 
> I probably misunderstood the dependency mechanism, but this really 
> remains a mind boggling issue to me.
> 
> Could somebody point out to me why this happens?

Hello,

When you build the project from the parent level both module1 and 
module2 are in the same reactor and maven is able to resolve the 
dependency. That is not the case when building directly from module2

If you want to build just module2 you first have to run mvn install on 
module1. That way when building module2 module1 is found in the local 
repository.

Hope this helps

- Samuli


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