You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jean-Luc Wasmer <jl...@lists.wasmer.ca> on 2007/03/20 14:11:34 UTC
Ignore module if missing
Hi,
I would like to disable some modules if their folder is missing instead
of failing.
How can I do this?
Jean-Luc
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Ignore module if missing - possible bug?
Posted by Jean-Luc Wasmer <jl...@lists.wasmer.ca>.
I think I know why it didn't work: I was not in the project's directory.
I don't call mvn myself but it's done from a shell script which is done
in a different directory (with the -f option).
Here's your example run:
1- in the project directory... everything works fine
2- outside the project directory... the profile doesn't get activated
macb-003:~/Development/test/parent jl$ mvn install
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] Example parent
[INFO] Example module1
[INFO] Example module2
[INFO]
----------------------------------------------------------------------------
[INFO] Building Example parent
[INFO] task-segment: [install]
[INFO]
----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing /Users/jl/Development/test/parent/pom.xml to
/Users/jl/.m2/repository/org/example/example-parent/0.0.1-SNAPSHOT/example-parent-0.0.1-SNAPSHOT.pom
[INFO]
----------------------------------------------------------------------------
[INFO] Building Example module1
[INFO] task-segment: [install]
[INFO]
----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing /Users/jl/Development/test/parent/module1/pom.xml to
/Users/jl/.m2/repository/org/example/module1/0.0.1-SNAPSHOT/module1-0.0.1-SNAPSHOT.pom
[INFO]
----------------------------------------------------------------------------
[INFO] Building Example module2
[INFO] task-segment: [install]
[INFO]
----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing /Users/jl/Development/test/parent/module2/pom.xml to
/Users/jl/.m2/repository/org/example/module2/0.0.1-SNAPSHOT/module2-0.0.1-SNAPSHOT.pom
[INFO]
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
------------------------------------------------------------------------
[INFO] Example parent ........................................ SUCCESS
[1.734s]
[INFO] Example module1 ....................................... SUCCESS
[0.007s]
[INFO] Example module2 ....................................... SUCCESS
[0.016s]
[INFO]
------------------------------------------------------------------------
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Mar 20 17:30:49 EDT 2007
[INFO] Final Memory: 3M/7M
[INFO]
------------------------------------------------------------------------
macb-003:~/Development/test/parent jl$ cd ..
macb-003:~/Development/test jl$ mvn -f parent/pom.xml install
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] Example parent
[INFO] Example module1
[INFO]
----------------------------------------------------------------------------
[INFO] Building Example parent
[INFO] task-segment: [install]
[INFO]
----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing /Users/jl/Development/test/parent/pom.xml to
/Users/jl/.m2/repository/org/example/example-parent/0.0.1-SNAPSHOT/example-parent-0.0.1-SNAPSHOT.pom
[INFO]
----------------------------------------------------------------------------
[INFO] Building Example module1
[INFO] task-segment: [install]
[INFO]
----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing /Users/jl/Development/test/parent/module1/pom.xml to
/Users/jl/.m2/repository/org/example/module1/0.0.1-SNAPSHOT/module1-0.0.1-SNAPSHOT.pom
[INFO]
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
------------------------------------------------------------------------
[INFO] Example parent ........................................ SUCCESS
[1.593s]
[INFO] Example module1 ....................................... SUCCESS
[0.012s]
[INFO]
------------------------------------------------------------------------
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Tue Mar 20 17:31:06 EDT 2007
[INFO] Final Memory: 3M/7M
[INFO]
------------------------------------------------------------------------
Jean-Luc
Thierry Lach wrote:
> Then you're probably doing something wrong. Here's a simple test case.
>
> (...)
>
> On 3/20/07, Jean-Luc Wasmer <jl...@lists.wasmer.ca> wrote:
>>
>> That doesn't seem to work: the module never gets built (even when I
>> don't have an activation section).
>>
>> Jean-Luc
>>
>>
>> Thierry Lach wrote:
>> > I think this will work.... Define each module in a profile, then
>> > activate it
>> > if the pom exists, something like this:
>> >
>> > <profile>
>> > <id>module1-build</id>
>> > <activation>
>> > <file>
>> > <exists>module1/pom.xml</exists>
>> > </file>
>> > </activation>
>> > <modules>
>> > <module>module1</modules>
>> > </modules>
>> > </profile>
>> >
>> >
>> >
>> > On 3/20/07, Jean-Luc Wasmer <jl...@lists.wasmer.ca> wrote:
>> >>
>> >> Hi,
>> >>
>> >> I would like to disable some modules if their folder is missing
>> instead
>> >> of failing.
>> >> How can I do this?
>> >>
>> >>
>> >> Jean-Luc
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Ignore module if missing
Posted by Thierry Lach <th...@gmail.com>.
Then you're probably doing something wrong. Here's a simple test case.
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.example</groupId>
<artifactId>example-parent</artifactId>
<packaging>pom</packaging>
<name>Example parent</name>
<version>0.0.1-SNAPSHOT</version>
<modules>
<module>module1</module>
</modules>
<profiles>
<profile>
<id>module2-build</id>
<activation>
<file>
<exists>module2/pom.xml</exists>
</file>
</activation>
<modules>
<module>module2</module>
</modules>
</profile>
</profiles>
</project>
module1 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">
<parent>
<artifactId>example-parent</artifactId>
<groupId>org.example</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>module1</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Example module1</name>
</project>
module2 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">
<parent>
<artifactId>example-parent</artifactId>
<groupId>org.example</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>module2</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Example module2</name>
</project>
execution
C:\src\modules>mvn install
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] Example parent
[INFO] Example module1
[INFO] Example module2
[INFO]
----------------------------------------------------------------------------
[INFO] Building Example parent
[INFO] task-segment: [install]
[INFO]
----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing C:\src\modules\pom.xml to c:\Documents and
Settings\lacht\.m2\repository\org\example\example-parent\0.0.1-SNAPSHOT
\example-parent-0.0.1-SNAPSHOT.pom
[INFO]
----------------------------------------------------------------------------
[INFO] Building Example module1
[INFO] task-segment: [install]
[INFO]
----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing C:\src\modules\module1\pom.xml to c:\Documents and
Settings\lacht\.m2\repository\org\example\module1\0.0.1-SNAPSHOT\module1-
0.0.1-SNAPSHOT.pom
[INFO]
----------------------------------------------------------------------------
[INFO] Building Example module2
[INFO] task-segment: [install]
[INFO]
----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing C:\src\modules\module2\pom.xml to c:\Documents and
Settings\lacht\.m2\repository\org\example\module2\0.0.1-SNAPSHOT\module2-
0.0.1-SNAPSHOT.pom
[INFO]
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
------------------------------------------------------------------------
[INFO] Example parent ........................................ SUCCESS [
1.765s]
[INFO] Example module1 ....................................... SUCCESS [
0.015s]
[INFO] Example module2 ....................................... SUCCESS [
0.016s]
[INFO]
------------------------------------------------------------------------
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Mar 20 14:16:11 EDT 2007
[INFO] Final Memory: 3M/7M
[INFO]
------------------------------------------------------------------------
C:\src\modules>
and with module2 missing
C:\src\modules>rename module2 module3
C:\src\modules>mvn install
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] Example parent
[INFO] Example module1
[INFO]
----------------------------------------------------------------------------
[INFO] Building Example parent
[INFO] task-segment: [install]
[INFO]
----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing C:\src\modules\pom.xml to c:\Documents and
Settings\lacht\.m2\repository\org\example\example-parent\0.0.1-SNAPSHOT
\example-parent-0.0.1-SNAPSHOT.pom
[INFO]
----------------------------------------------------------------------------
[INFO] Building Example module1
[INFO] task-segment: [install]
[INFO]
----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing C:\src\modules\module1\pom.xml to c:\Documents and
Settings\lacht\.m2\repository\org\example\module1\0.0.1-SNAPSHO
T\module1-0.0.1-SNAPSHOT.pom
[INFO]
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
------------------------------------------------------------------------
[INFO] Example parent ........................................ SUCCESS [
1.750s]
[INFO] Example module1 ....................................... SUCCESS [
0.016s]
[INFO]
------------------------------------------------------------------------
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Mar 20 14:18:22 EDT 2007
[INFO] Final Memory: 3M/7M
[INFO]
------------------------------------------------------------------------
C:\src\modules>
On 3/20/07, Jean-Luc Wasmer <jl...@lists.wasmer.ca> wrote:
>
> That doesn't seem to work: the module never gets built (even when I
> don't have an activation section).
>
> Jean-Luc
>
>
> Thierry Lach wrote:
> > I think this will work.... Define each module in a profile, then
> > activate it
> > if the pom exists, something like this:
> >
> > <profile>
> > <id>module1-build</id>
> > <activation>
> > <file>
> > <exists>module1/pom.xml</exists>
> > </file>
> > </activation>
> > <modules>
> > <module>module1</modules>
> > </modules>
> > </profile>
> >
> >
> >
> > On 3/20/07, Jean-Luc Wasmer <jl...@lists.wasmer.ca> wrote:
> >>
> >> Hi,
> >>
> >> I would like to disable some modules if their folder is missing instead
> >> of failing.
> >> How can I do this?
> >>
> >>
> >> Jean-Luc
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Ignore module if missing
Posted by Jean-Luc Wasmer <jl...@lists.wasmer.ca>.
That doesn't seem to work: the module never gets built (even when I
don't have an activation section).
Jean-Luc
Thierry Lach wrote:
> I think this will work.... Define each module in a profile, then
> activate it
> if the pom exists, something like this:
>
> <profile>
> <id>module1-build</id>
> <activation>
> <file>
> <exists>module1/pom.xml</exists>
> </file>
> </activation>
> <modules>
> <module>module1</modules>
> </modules>
> </profile>
>
>
>
> On 3/20/07, Jean-Luc Wasmer <jl...@lists.wasmer.ca> wrote:
>>
>> Hi,
>>
>> I would like to disable some modules if their folder is missing instead
>> of failing.
>> How can I do this?
>>
>>
>> Jean-Luc
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Ignore module if missing
Posted by Thierry Lach <th...@gmail.com>.
I think this will work.... Define each module in a profile, then activate it
if the pom exists, something like this:
<profile>
<id>module1-build</id>
<activation>
<file>
<exists>module1/pom.xml</exists>
</file>
</activation>
<modules>
<module>module1</modules>
</modules>
</profile>
On 3/20/07, Jean-Luc Wasmer <jl...@lists.wasmer.ca> wrote:
>
> Hi,
>
> I would like to disable some modules if their folder is missing instead
> of failing.
> How can I do this?
>
>
> Jean-Luc
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>