On 16 March 2011 18:35, Robert Dare <[email protected]> wrote: > I was recently upgraded to Maven 3.0.2 and found that it can not build my > Maven 2 projects. My projects are flat, multi-module projects where the > parent is a sibling project to the other modules. > > In the parent's pom, I define the other modules as such: > > <modules> > <module>../module1</module> > <module>../module2</module> > </module> > > The child modules link to the parent: > > <parent> > <groupId>group</groupId> > <artifactId>myparent</artifactId> > <version>1.0-SNAPSHOT</version> > </parent> > > When I try do do a "mvn package" from the parent directory, I get an error > saying that module1 can not find the parent. > > [ERROR] The project group:module1:1.0-SNAPSHOT > (/pathProjects/demo/flat/module1/pom.xml) has 1 error > [ERROR] Non-resolvable parent POM: Could not find artifact > group:myparent:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong > local POM @ line 12, column 10 -> [Help 2]
see https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-ParentPOMResolution you should add a <relativePath> element if the parent pom is not in the parent directory (it defaults to ../pom.xml) <parent> <groupId>group</groupId> <artifactId>myparent</artifactId> <version>1.0-SNAPSHOT</version> <relativePath>../myparent/pom.xml</relativePath> </parent> this will work in both Maven2 and Maven3 (and was suggested good practice even before Maven3) > Maven3 was supposed to be backwards compatible? Is it no longer allowed > to have flat, multi-module projects, or am I doing something else wrong? > > Many regards, > -- Cheers, Stuart
