You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Fabian Kürten <fa...@web.de> on 2009/09/20 13:36:43 UTC

Sibling dependency

Hi List,

I'm almost certainly doing things wrong, but I couldn't find what is wrong.

I created a minimal failing example to show the problem.
Imagine 3 pom.xml (and nothing else) aranged in a parent-child relationship:
|-- pom.xml
|-- A
|   `-- pom.xml
`-- B
     `-- pom.xml

Each pom is quite simple:
pom.xml [the root one]:
---------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>test</groupId>
   <artifactId>test</artifactId>
   <packaging>pom</packaging>
   <version>1.0-SNAPSHOT</version>
   <modules>
     <module>A</module>
     <module>B</module>
   </modules>
</project>
---------------------------------------------------------------

A/pom.xml:
---------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd" 
xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <artifactId>test</artifactId>
     <groupId>test</groupId>
     <version>1.0-SNAPSHOT</version>
   </parent>
   <groupId>test.test</groupId>
   <artifactId>A</artifactId>
   <version>1.0-SNAPSHOT</version>
</project>
---------------------------------------------------------------

B/pom.xml:
---------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd" 
xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <artifactId>test</artifactId>
     <groupId>test</groupId>
     <version>1.0-SNAPSHOT</version>
   </parent>
   <groupId>test.test</groupId>
   <artifactId>B</artifactId>
   <version>1.0-SNAPSHOT</version>
   <dependencies>
     <dependency>
       <groupId>test.test</groupId>
         <artifactId>A</artifactId>
         <version>1.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
</project>
---------------------------------------------------------------

As you can see B depends on A.

If I run mvn package in the root folder, everything works fine.
If I run mvn package in A everything is fine aswell
However, if I run mvn package in B, mvn does not know where to find 
test.test:A

Why is that, how can I solve this (apart from installing A first)?

Thanks
Fabian Kürten

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


Re: Sibling dependency

Posted by Wayne Fay <wa...@gmail.com>.
> As you can see B depends on A.
>
> If I run mvn package in the root folder, everything works fine.
> If I run mvn package in A everything is fine aswell
> However, if I run mvn package in B, mvn does not know where to find
> test.test:A

B depends on A, which is not installed. Since it is not installed, A
does not exist as far as B is concerned except when you are building
from A directly or from the parent (in which case, the reactor will
resolve it).

This is working as intended. B does not know where to look for A
except in the local repo cache, though the reactor can provide it in
multi-module builds such as when you build from the parent in your
example above.

Wayne

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


Re: Sibling dependency

Posted by Antonio Petrelli <an...@gmail.com>.
2009/9/20 Fabian Kürten <fa...@web.de>:
> It seems to be related to
> http://jira.codehaus.org/browse/MNG-2979

No, this bug refers to site generation.

Antonio

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


Re: Sibling dependency

Posted by Fabian Kürten <fa...@web.de>.
Some more information:

mvn -v
Apache Maven 2.2.0 (rdebian-2)
Java version: 1.6.0_14
Java home: /usr/lib/jvm/java-6-sun-1.6.0.14/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux" version: "2.6.24-1-686" arch: "i386" Family: "unix"


It seems to be related to
http://jira.codehaus.org/browse/MNG-2979

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


Re: Sibling dependency

Posted by Antonio Petrelli <an...@gmail.com>.
2009/9/20 Fabian Kürten <fa...@web.de>:
> If I run mvn package in the root folder, everything works fine.
> If I run mvn package in A everything is fine aswell
> However, if I run mvn package in B, mvn does not know where to find
> test.test:A
>
> Why is that, how can I solve this (apart from installing A first)?

I think this is the intended behaviour: since A is not installed, and
you are trying to package B inside B's directory, not its parent,
Maven does not find a dependency and it breaks.

Tiles has got lots of this kind of dependency and, in our POV, it is
just what we want to accomplish.

Antonio

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