You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kent Tong <ke...@cpttm.org.mo> on 2006/06/18 03:11:04 UTC

conceptual problem in multi-module project?

Hi,

I have a multi-module project for testing. It contains two modules: m1 and m2.
m2 depends on m1. I can build the whole project or m1 just fine. The problem
is, when I try to build m2 separately, it tries to download the pom.xml for
the project from the repository. If I have never been able to build the whole 
project, it won't find the pom.xml file and will fail. 

Now, there is a circular dependency here. To build the whole project, we 
need to build m2. To build m2, we need to build the whole project. It means
they have to be built together. A consequence is that one can't develop m2
in isolation.

Any workaround? For example, can I install the project pom.xml without
building the modules?

Thanks!


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


Re: conceptual problem in multi-module project?

Posted by Kent Tong <ke...@cpttm.org.mo>.
Wendy Smoak <wsmoak <at> gmail.com> writes:

> You can install just the parent pom with:
> 
>    mvn install -N

That's what I am looking for. Thanks!


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


Re: conceptual problem in multi-module project?

Posted by Wendy Smoak <ws...@gmail.com>.
On 6/18/06, Kent Tong <ke...@cpttm.org.mo> wrote:

> That is the point. In order to build m2, I have to build the whole
> project. If m2 is still in development (ie, some tests still fail),
> I can't build m2 separately.

You can install just the parent pom with:

   mvn install -N

I thought that Maven would check for "../pom.xml" before going to the
local repository for a parent pom.  It hasn't ever seemed to work that
way, though.

-- 
Wendy

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


Re: conceptual problem in multi-module project?

Posted by Alexandre Poitras <al...@gmail.com>.
On 6/19/06, rudy.bistrovich@thomson.com <ru...@thomson.com> wrote:
> You touched on a good point here. I have a similar situation where I
> have multiple modules that don't share the same release structure yet I
> would still like to have them use the same parent POM to inherit certain
> project info.
>
> Has anyone defined a Parent POM like that and just not included the
> "module" tags in it? Or would that be considered a Super POM instead?
>
> --Rudy


In my opinion, this is how you should do it. Lot of people don't
realize it but a super pom and modules are two different concepts. So
if you want to share some values just use a super pom (using the
parent tag) which doesn't declare any modules. For instance, I use a 3
level pom hierarchy and it works like a charm.

>
> -----Original Message-----
> From: Alexandre Poitras [mailto:alexandre.poitras@gmail.com]
> Sent: Sunday, June 18, 2006 2:32 PM
> To: Maven Users List
> Subject: Re: conceptual problem in multi-module project?
>
> >
> > That is the point. In order to build m2, I have to build the whole
> > project. If m2 is still in development (ie, some tests still fail),
> > I can't build m2 separately.
>
> If m2 and m1 doesn't share the same release cycle, they shouldn't be
> sibling modules. The purpose of modules is to separate a big project
> in small subprojects. Instead just declare a SNAPSHOT m2 dependency in
> you m1 pom. Modules dependencies is the same as Eclipse project
> dependencies. If one project doesn't compile than of course all the
> other projects depending upon this one won't compile either.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


RE: conceptual problem in multi-module project?

Posted by ru...@thomson.com.
You touched on a good point here. I have a similar situation where I
have multiple modules that don't share the same release structure yet I
would still like to have them use the same parent POM to inherit certain
project info.

Has anyone defined a Parent POM like that and just not included the
"module" tags in it? Or would that be considered a Super POM instead?

--Rudy

-----Original Message-----
From: Alexandre Poitras [mailto:alexandre.poitras@gmail.com] 
Sent: Sunday, June 18, 2006 2:32 PM
To: Maven Users List
Subject: Re: conceptual problem in multi-module project?

>
> That is the point. In order to build m2, I have to build the whole
> project. If m2 is still in development (ie, some tests still fail),
> I can't build m2 separately.

If m2 and m1 doesn't share the same release cycle, they shouldn't be
sibling modules. The purpose of modules is to separate a big project
in small subprojects. Instead just declare a SNAPSHOT m2 dependency in
you m1 pom. Modules dependencies is the same as Eclipse project
dependencies. If one project doesn't compile than of course all the
other projects depending upon this one won't compile either.

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


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


Re: conceptual problem in multi-module project?

Posted by Alexandre Poitras <al...@gmail.com>.
>
> That is the point. In order to build m2, I have to build the whole
> project. If m2 is still in development (ie, some tests still fail),
> I can't build m2 separately.

If m2 and m1 doesn't share the same release cycle, they shouldn't be
sibling modules. The purpose of modules is to separate a big project
in small subprojects. Instead just declare a SNAPSHOT m2 dependency in
you m1 pom. Modules dependencies is the same as Eclipse project
dependencies. If one project doesn't compile than of course all the
other projects depending upon this one won't compile either.

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


Re: conceptual problem in multi-module project?

Posted by Kent Tong <ke...@cpttm.org.mo>.
Andreas Schildbach <andreas <at> schildbach.de> writes:

> Did you try "mvn install" on your parent pom directory? 

It will work fine.

> If it fails, > please post the output and your parent pom. If it succeeds, 
> you should be able to build m1 or m2 separately from now on.

That is the point. In order to build m2, I have to build the whole
project. If m2 is still in development (ie, some tests still fail),
I can't build m2 separately.



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


Re: conceptual problem in multi-module project?

Posted by Andreas Schildbach <an...@schildbach.de>.
Kent Tong wrote:

>> Yes, Reactor should take care of that if you run "mvn install" in your 
>> root project directory (containing the "outermost" pom.xml).
> 
> Yes, but I'd like to build m2 separately.
> 
>> As an alternative, it should also be possible to run "mvn install" 
>> separately on m1 and then m2, because Maven searches for parent poms on 
>> the filesystem rather than resolve them from the local repository.
> 
> I tried this but it didn't work. It is definitely looking for the
> parent pom in the local repository:

Did you try "mvn install" on your parent pom directory? If it fails, 
please post the output and your parent pom. If it succeeds, you should 
be able to build m1 or m2 separately from now on.

Regards,

Andreas


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


Re: conceptual problem in multi-module project?

Posted by Kent Tong <ke...@cpttm.org.mo>.
Edwin Punzalan <epunzalan <at> exist.com> writes:

> What is your directory structure for this?

c:\prj
    +--m1
    +--m2

> The parent pom is searched in the file system FIRST before any of the 
> repositories... The reason why your build is searching the repo is 
> probably because the parent pom is not located "../pom.xml" from the 
> module project.

As you can see above, the parent pom.xml is indeed in the parent
directory. It has made no attempt to locate it in the file 
system.

> You can use <relativePath> inside the <parent> tag to tell the reactor 
> where to look for the parent's pom.

It doesn't seem to work. I receive the same error. Here is m2's pom:

<project>
        <parent>
                <groupId>org.foo</groupId>
                <artifactId>prj</artifactId>
                <version>1.0</version>
                <relativePath>../pom.xml</relativePath>
        </parent>
        ...
<project>

The error is:

$ mvn install
[INFO] Scanning for projects...
[INFO] --------------------------------------
[INFO] Building Module 2 for Test Project
[INFO]    task-segment: [install]
[INFO] --------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
Downloading: http://repo1.maven.org/maven2/org/foo/prj/1.0/prj-1.0.pom
[WARNING] Unable to get resource from repository central 
(http://repo1.maven.org/maven2)
[INFO] --------------------------------------
[ERROR] BUILD ERROR
[INFO] --------------------------------------
[INFO] Failed to resolve artifact.

GroupId: org.foo
ArtifactId: prj
Version: 1.0

Reason: Unable to download the artifact from any repository

  org.foo:prj:pom:1.0



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


Re: conceptual problem in multi-module project?

Posted by Edwin Punzalan <ep...@exist.com>.
What is your directory structure for this?

The parent pom is searched in the file system FIRST before any of the 
repositories... The reason why your build is searching the repo is 
probably because the parent pom is not located "../pom.xml" from the 
module project.

You can use <relativePath> inside the <parent> tag to tell the reactor 
where to look for the parent's pom.

Hope that helps.


^_^


Kent Tong wrote:
> Andreas Schildbach <andreas <at> schildbach.de> writes:
>
>   
>> Yes, Reactor should take care of that if you run "mvn install" in your 
>> root project directory (containing the "outermost" pom.xml).
>>     
>
> Yes, but I'd like to build m2 separately.
>
>   
>> As an alternative, it should also be possible to run "mvn install" 
>> separately on m1 and then m2, because Maven searches for parent poms on 
>> the filesystem rather than resolve them from the local repository.
>>     
>
> I tried this but it didn't work. It is definitely looking for the
> parent pom in the local repository:
>
> $ mvn install
> [INFO] Scanning for projects...
> [INFO] -------------------------------------------------------
> [INFO] Building Module 2 for Test Project
> [INFO]    task-segment: [install]
> [INFO] -------------------------------------------------------
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> Downloading: http://repo1.maven.org/maven2/org/foo/prj/1.0/prj-1.0.pom
> [WARNING] Unable to get resource from repository central 
> (http://repo1.maven.org/maven2)
> [INFO] -------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] -------------------------------------------------------
> [INFO] Failed to resolve artifact.
>
> GroupId: org.foo
> ArtifactId: prj
> Version: 1.0
>
> Reason: Unable to download the artifact from any repository
>
>   org.foo:prj:pom:1.0
>
> from the specified remote repositories:
>   central (http://repo1.maven.org/maven2)
>
> The m2 pom.xml is:
>
> <project>
>         <parent>
>                 <groupId>org.foo</groupId>
>                 <artifactId>prj</artifactId>
>                 <version>1.0</version>
>         </parent>
>         <modelVersion>4.0.0</modelVersion>
>         <artifactId>m2</artifactId>
>         <packaging>jar</packaging>
>         <version>1.0</version>
>         <name>Module 2 for Test Project</name>
>         <dependencies>
>                 <dependency>
>                         <groupId>org.foo</groupId>
>                         <artifactId>m1</artifactId>
>                         <version>1.0</version>
>                 </dependency>
>         </dependencies>
> </project>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>   

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


Re: conceptual problem in multi-module project?

Posted by Kent Tong <ke...@cpttm.org.mo>.
Andreas Schildbach <andreas <at> schildbach.de> writes:

> Yes, Reactor should take care of that if you run "mvn install" in your 
> root project directory (containing the "outermost" pom.xml).

Yes, but I'd like to build m2 separately.

> As an alternative, it should also be possible to run "mvn install" 
> separately on m1 and then m2, because Maven searches for parent poms on 
> the filesystem rather than resolve them from the local repository.

I tried this but it didn't work. It is definitely looking for the
parent pom in the local repository:

$ mvn install
[INFO] Scanning for projects...
[INFO] -------------------------------------------------------
[INFO] Building Module 2 for Test Project
[INFO]    task-segment: [install]
[INFO] -------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
Downloading: http://repo1.maven.org/maven2/org/foo/prj/1.0/prj-1.0.pom
[WARNING] Unable to get resource from repository central 
(http://repo1.maven.org/maven2)
[INFO] -------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] -------------------------------------------------------
[INFO] Failed to resolve artifact.

GroupId: org.foo
ArtifactId: prj
Version: 1.0

Reason: Unable to download the artifact from any repository

  org.foo:prj:pom:1.0

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

The m2 pom.xml is:

<project>
        <parent>
                <groupId>org.foo</groupId>
                <artifactId>prj</artifactId>
                <version>1.0</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
        <artifactId>m2</artifactId>
        <packaging>jar</packaging>
        <version>1.0</version>
        <name>Module 2 for Test Project</name>
        <dependencies>
                <dependency>
                        <groupId>org.foo</groupId>
                        <artifactId>m1</artifactId>
                        <version>1.0</version>
                </dependency>
        </dependencies>
</project>


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


Re: conceptual problem in multi-module project?

Posted by Andreas Schildbach <an...@schildbach.de>.
Kent Tong wrote:

> Any workaround? For example, can I install the project pom.xml without
> building the modules?

Yes, Reactor should take care of that if you run "mvn install" in your 
root project directory (containing the "outermost" pom.xml).

As an alternative, it should also be possible to run "mvn install" 
separately on m1 and then m2, because Maven searches for parent poms on 
the filesystem rather than resolve them from the local repository.

Regards,

Andreas


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