You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sesha Nandyal <Se...@Sun.COM> on 2008/07/29 18:21:38 UTC

Unable to build from individual sub-modules

Hello All,
   I am having problems building the sub-modules independently. However, 
I am able to build all the sub-modules from the parent module though.

   So let me explain how I have setup the directory structure and the 
entries in the pom.xml file

   Following is the directory structure
   parent
   |__pom.xml   <-------pom.xml for the parent
   |__sub-module1
   |       |__trunk
   |               |__ pom.xml
   |
   |__sub-module2
           |__trunk
                   |__pom.xml

In the parent pom.xml - following are the relevant entries:
<modelVersion>4.0.0</modelVersion>
 <groupId>com.sun.projectName</groupId>
  <artifactId>projectName-parent</artifactId>
  <packaging>parent</packaging>
   <version>0.12-SNAPSHOT</version>
   <name>project-parent</name>
       <modules>
       <module>sub-module1/trunk</module>
       <module>sub-module2/trunk</module>
    </modules>

And in the pom.xml for sub-module1
<parent>
       <groupId>com.sun.projectName</groupId>
       <artifactId>projectName-parent</artifactId>
       <version>0.12-SNAPSHOT</version>
    </parent>
    <artifactId>sub-module1</artifactId>



So now I am able to successfully build all the sub-modules and the 
parent module by running mvn compile from the parent directory. However, 
when I run mvn compile under sub-module1/trunk, I get the following error:

n$ mvn compile
[INFO] Scanning for projects...
[INFO] 
------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] 
------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

GroupId: com.sun.projectName
ArtifactId: projectName-parent
Version: 0.12-SNAPSHOT

Reason: Unable to download the artifact from any repository

  com.sun.starlight:projectName-parent:pom:0.12-SNAPSHOT

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)


[INFO] 
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Cannot find parent: 
com.sun.projectName:projectName-parent for project: null:xmigen:pom:null 
for project null:sub-module1:pom:null


Can you please let me know what is incorrect or missing in the pom.xml file?

Thank you
Sesha

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


Re: Unable to build from individual sub-modules

Posted by Piotr Oktaba <pi...@coconet.pl>.
The parent artifact haven't been installed into your local repository,
and that's why submodules cannot find it.

Try to perform goal:mvn install 
in parent module, and after that submodules should build correctly with
both goals: install or compile.

Cheers,
Piotrek

On Tue, 2008-07-29 at 10:21 -0600, Sesha Nandyal wrote:

> Hello All,
>    I am having problems building the sub-modules independently. However, 
> I am able to build all the sub-modules from the parent module though.
> 
>    So let me explain how I have setup the directory structure and the 
> entries in the pom.xml file
> 
>    Following is the directory structure
>    parent
>    |__pom.xml   <-------pom.xml for the parent
>    |__sub-module1
>    |       |__trunk
>    |               |__ pom.xml
>    |
>    |__sub-module2
>            |__trunk
>                    |__pom.xml
> 
> In the parent pom.xml - following are the relevant entries:
> <modelVersion>4.0.0</modelVersion>
>  <groupId>com.sun.projectName</groupId>
>   <artifactId>projectName-parent</artifactId>
>   <packaging>parent</packaging>
>    <version>0.12-SNAPSHOT</version>
>    <name>project-parent</name>
>        <modules>
>        <module>sub-module1/trunk</module>
>        <module>sub-module2/trunk</module>
>     </modules>
> 
> And in the pom.xml for sub-module1
> <parent>
>        <groupId>com.sun.projectName</groupId>
>        <artifactId>projectName-parent</artifactId>
>        <version>0.12-SNAPSHOT</version>
>     </parent>
>     <artifactId>sub-module1</artifactId>
> 
> 
> 
> So now I am able to successfully build all the sub-modules and the 
> parent module by running mvn compile from the parent directory. However, 
> when I run mvn compile under sub-module1/trunk, I get the following error:
> 
> n$ mvn compile
> [INFO] Scanning for projects...
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Failed to resolve artifact.
> 
> GroupId: com.sun.projectName
> ArtifactId: projectName-parent
> Version: 0.12-SNAPSHOT
> 
> Reason: Unable to download the artifact from any repository
> 
>   com.sun.starlight:projectName-parent:pom:0.12-SNAPSHOT
> 
> from the specified remote repositories:
>   central (http://repo1.maven.org/maven2)
> 
> 
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.reactor.MavenExecutionException: Cannot find parent: 
> com.sun.projectName:projectName-parent for project: null:xmigen:pom:null 
> for project null:sub-module1:pom:null
> 
> 
> Can you please let me know what is incorrect or missing in the pom.xml file?
> 
> Thank you
> Sesha
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>