What happens, if you use "mvn install"?

Fredy


-----Ursprüngliche Nachricht-----
Von: Florian Rampp [mailto:florian.ra...@jambit.com] 
Gesendet: Freitag, 17. Dezember 2010 10:51
An: users@maven.apache.org
Betreff: Dependency on pom-project not resolved in reactor on multi-module build

Hello,

I am having the following issue with artifact resolution in the Maven reactor. 
My project layout resembles the following:

--> Parent POM
    --> POM A (packaging: pom)
    --> POM B (packaging: jar)

"POM A" and "POM B" have "Parent POM" as parent. "Parent POM" has "POM A" and 
"POM B" as submodules. All projects inherit their version from the parent POM.

"POM B" has a dependency on "POM A", which has dependencies on several other 
artifacts and is used according to section "3.6.1. Grouping dependencies" in 
http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-best-practice.html.

When I execute "mvn package" on the parent POM, the build results in the 
following error:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) mygroup:A:pom:1.0-SNAPSHOT
  Path to dependency: 
        1) mygroup:B:jar:1.0-SNAPSHOT
        2) mygroup:A:pom:1.0-SNAPSHOT



Debug output reveals the following error: 

[DEBUG] WARNING: A dependency of the current project (or of one the plugins 
used in its build) was found in the reactor, 
but had not been built at the time it was requested. It will be resolved from 
the repository instead.

Current Project: Unnamed - mygroup:B:jar:1.0-SNAPSHOT
Requested Dependency: mygroup:A:pom:1.0-SNAPSHOT

NOTE: You may need to run this build to the 'compile' lifecycle phase, or 
farther, in order to build the dependency artifact.




So I am wondering if this is a bug. Dependencies on POM projects in the reactor 
should not be handled different than dependencies on JAR-projects.

The content of POM file for project A is:

<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>
    <parent>
        <artifactId>parent</artifactId>
        <groupId>mygroup</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>A</artifactId>
    <packaging>pom</packaging>
</project>


The content of POM file for project B is:

<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>
    <parent>
        <artifactId>parent</artifactId>
        <groupId>mygroup</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>B</artifactId>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>A</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
        </dependency>
    </dependencies>
</project>



Thanks a lot,

Florian

-- 

Florian Rampp, Software Architect
Phone: +49.89.45 23 47-64



-- 
jambit Software Development & Management GmbH
Nymphenburger Straße 13-15, D-80335 München
Phone: +49.89.45 23 47-0  Fax:  +49.89.45 23 47-70  

http://www.jambit.com    where innovation works

Geschäftsführer: Peter F. Fellinger, Markus Hartinger
Sitz: München; Registergericht: München, HRB 129139

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

Reply via email to