That might be because the activation is based on a relative pathname. But I tried to use the following
<file>${basedir}/module2/pom.xml</file> and it doesn't work as expected. Running mvn help:effective-pom gives the following ************************************************************************************ Effective POM for project 'org.example:example-parent:pom:0.0.1-SNAPSHOT' ************************************************************************************ <?xml version="1.0" encoding="UTF-8"?><project> <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> <build> <sourceDirectory>C:\src\modules\src\main\java</sourceDirectory> <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory> <testSourceDirectory>C:\src\modules\src\test\java</testSourceDirectory> <outputDirectory>C:\src\modules\target\classes</outputDirectory> <testOutputDirectory>C:\src\modules\target\test-classes</testOutputDirectory> <resources> <resource> <directory>C:\src\modules\src\main\resources</directory> </resource> </resources> <testResources> <testResource> <directory>C:\src\modules\src\test\resources</directory> </testResource> </testResources> <directory>C:\src\modules\target</directory> <finalName>example-parent-0.0.1-SNAPSHOT</finalName> <plugins> <plugin> <artifactId>maven-help-plugin</artifactId> <version>2.0.1</version> </plugin> </plugins> </build> <profiles> <profile> <id>module2-build</id> <activation> <file> <exists>C:\src\modules/module2/pom.xml</exists> </file> </activation> <modules> <module>module2</module> </modules> </profile> </profiles> <modules> <module>module1</module> </modules> <repositories> <repository> <snapshots> <enabled>false</enabled> </snapshots> <id>central</id> <name>Maven Repository Switchboard</name> <url>http://repo1.maven.org/maven2</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <releases> <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> <id>central</id> <name>Maven Plugin Repository</name> <url>http://repo1.maven.org/maven2</url> </pluginRepository> </pluginRepositories> <reporting> <outputDirectory>target/site</outputDirectory> </reporting> </project> ************************************************************************************ but if I change the line in the parent pom to be <file>C:/src/modules/module2/pom.xml</file> it works. On 3/20/07, Jean-Luc Wasmer <[EMAIL PROTECTED]> wrote:
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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]