maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Schneider" <pschnei...@gmail.com>
Subject Re: Problem /w RelativePath and Multiple level Inheritance
Date Wed, 14 Mar 2007 18:33:53 GMT
Hi Miguel,

You should change the <modules> section in your main pom to this:

<modules>
  <module>parent</module>
  <module>son</module>
</modules>

In other words, before son or grandson can be built, you need to build the
parent.

Cheers,


Patrick

On 3/14/07, Miguel Angel Hernández <migs.ho@gmail.com> wrote:
>
> Hi all,
> My first message was rejected as s p a m sob sob.
> I have a problem regarding relativePaths, inheritance and aggregation, and
> need some help please. I tested this in maven 2.0.5
> I have the following directory structure
>
> main:
>   - pom.xml
>   parent:
>   - pom.xml
>   son:
>     - pom.xml
>     - grandson:
>        - pom.xml
>
> Inheritance goes like this: parent > son > grandson; and aggregation goes
> like: main < son and son < grandson.
>
> Whenever I make a fresh mvn install (fresh meaning my local repository is
> clean w/o anyone of my artifacts) from the main I get and error because
> son
> artifact cant find the parent POM. I'm using relativePath to indicate
> where
> the son should search for his parent.
>
> Here is the code:
> Main pom:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project>
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>org.migs.ejemplos</groupId>
>   <artifactId>maven-test</artifactId>
>   <version>0.0.1</version>
>   <packaging>pom</packaging>
>
>   <modules>
>     <module>son</module>
>   </modules>
> </project>
>
> Parent pom:
>
> <?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>org.migs.ejemplos</groupId>
>   <artifactId>parent</artifactId>
>   <packaging>pom</packaging>
>   <version>0.0.1</version>
> </project>
>
> Son pom:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project>
>   <modelVersion>4.0.0</modelVersion>
>   <parent>
>     <groupId> org.migs.ejemplos</groupId>
>     <artifactId>parent</artifactId>
>     <version>0.0.1</version>
>     <relativePath>../parent/pom.xml</relativePath>
>   </parent>
>   <groupId> org.migs.ejemplos</groupId>
>   <artifactId>son</artifactId>
>   <version>0.0.1</version>
>   <packaging>pom</packaging>
>   <modules>
>     <module>grandson</module>
>   </modules>
> </project>
>
> Grandson POM:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project>
>   <modelVersion> 4.0.0 </modelVersion>
>   <parent>
>     <groupId>org.migs.ejemplos</groupId>
>     <artifactId>son</artifactId>
>     <version>0.0.1</version>
>     <relativePath>../pom.xml</relativePath>
>   </parent>
>   <groupId>org.migs.ejemplos</groupId>
>   <artifactId>grandson</artifactId>
>   <version>0.0.1</version>
>   <packaging>pom</packaging>
> </project>
>
> And here is a part of the ST:
>
> miguel@yuki:~/trabajo/migs.org/ejemplos/maven-test> mvn install -e
> + Error stacktraces are turned on.
> [INFO] Scanning for projects...
> Downloading:
> http://repo1.maven.org/maven2/org/migs/ejemplos/parent/0.0.1/parent-0.0.1.pom
>
> [WARNING] Unable to get resource from repository central (
> http://repo1.maven.org/maven2)
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Error building POM (may not be this project's POM).
>
>
> Project ID: org.migs.ejemplos:son:pom:0.0.1
>
> Reason: Cannot find parent: org.migs.ejemplos:parent for project:
> org.migs.ejemplos:son:pom:0.0.1
>
>
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.reactor.MavenExecutionException: Cannot find parent:
> org.migs.ejemplos:parent for project: org.migs.ejemplos:son:pom:0.0.1
>         at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java
> :365)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:278)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java :115)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java :39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.codehaus.classworlds.Launcher.launchEnhanced (Launcher.java
> :315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at org.codehaus.classworlds.Launcher.mainWithExitCode(
> Launcher.java
> :430)
>         at org.codehaus.classworlds.Launcher.main (Launcher.java:375)
> Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find
> parent: org.migs.ejemplos:parent for project:
> org.migs.ejemplos:son:pom:0.0.1
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage (
> DefaultMavenProjectBuilder.java:1161)
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(
> DefaultMavenProjectBuilder.java:1176)
>         at
> org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(
> DefaultMavenProjectBuilder.java:674)
>         at
>
> org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal
> (DefaultMavenProjectBuilder.java:416)
>         at org.apache.maven.project.DefaultMavenProjectBuilder.build (
> DefaultMavenProjectBuilder.java:192)
>         at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:515)
>         at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java
> :447)
>         at org.apache.maven.DefaultMaven.collectProjects (
> DefaultMaven.java
> :491)
>         at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java
> :491)
>         at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java
> :351)
>         ... 11 more
> Caused by: org.apache.maven.project.ProjectBuildingException: POM '
> org.migs.ejemplos:parent' not found in repository: Unable to download the
> artifact from any repository
>
>
> The thing is when I comment the aggregation part on the son pom (comment
> the
> modules section) the main installs correctly, or obviously if I install
> the
> parent first. But I think this should build from
> the main pom just right.
>
> Thanks
>
> Miguel
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message