Le 12/09/2011 15:33, Jason Pyeron a écrit :
-----Original Message-----
From: Guillaume Polet
Sent: Monday, September 12, 2011 3:01
To: Maven Users List
Subject: Re: [maven] Re: Auto building parent and sibling
projects as needed

Le 11/09/2011 17:37, Jason Pyeron a écrit :
-----Original Message-----
From: Guillaume Polet
Sent: Sunday, September 11, 2011 4:07
To: Maven Users List
Subject: [maven] Re: Auto building parent and sibling projects as
needed

The problem is that a child does not know where the sources of its
parents are located,
Is it not the point of<relativePath>../pom.xml</relativePath>?
No, this simply indicates where to look relatively to find a
pom.xml if it is not installed in your local repository (or a
remote one where it could be fetched from).
Is this a design or bug of the reactor?
It is by design. If you want to build a parent, then just go to the parent. If the parent build was triggered, you would not have any possibility to just build a child.

and therefore it is completely
unable to trigger its build. You probably have set up one or more
parent aggregator projects and you mapped this hierarchy onto the
file/directory structure but this is not mandatory at all. You can
very well use a parent just to define the default version
to use for
dependencies, or the default target of the compiler, other
properties
that are common through all your projects and many more things.
You should probably read again the first two paragraphs here:

http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Project

<snip/>

Hard to say why your second build is failing. I just tried a
similar setup and it worked in all cases:
parent:
The difference is that you are saying that the children A&  B are pom packaged,
which does not cause compile to kick off, which inturn does not need the
dependency.

<snip/>
You can very well change them into jar's and add a dummy class in A and B project. It still works, I tried it myself.

B:
<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>B</artifactId>
<name>B</name>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
<groupId>test</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
<snip/>

Your log says the following:
-->  cannot find the pom.xml from project A (This I don't
understand why)
-->  jar file of project A cannot be found

Try 'mvn install' so that the pom and the jar file is
deployed locally because it will not find the jar in the
target directory.

An install would not be appropiate for this part of the development lifecycle.
For argument sake, lets assume that not every module passes all unit tests but
all compile and we are in a SNAPSHOT versioning.

-Jason
OK, maybe some expert Maven user knows how to go around such a situation. AFIK (and my knowledge is not very big), you have two options:
1) You build the parent, the children will follow and you should be fine
2) You do an 'mvn install': since you are using SNAPSHOT it should not be a problem to have unstable jars (although using -DskipTest=true is not recommended, but that's another story) and since 'install' deploys the artifacts locally, you do not pollute anyone else's repository.

Sorry if I can't help you more than that.

Cheers,
Guillaume


--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.




---------------------------------------------------------------------
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]

Reply via email to