File-based profile activation behaves differently in Maven 3
------------------------------------------------------------

                 Key: MNG-4735
                 URL: http://jira.codehaus.org/browse/MNG-4735
             Project: Maven 2 & 3
          Issue Type: Bug
          Components: Profiles
    Affects Versions: 3.0-beta-1
         Environment: Ubuntu 10.04 64-bit, Windows XP 32-bit, Windows 7 64-bit
Java 6
            Reporter: Ryan Stewart


I have a project with parent and child poms. The child pom has a profile that 
is activated by file existence. When running a multimodule build in the 
directory of the parent pom, the profile fails to activate when it should. 
Under Maven 2, the profile activates as expected. Example poms that demonstrate 
the problem are below. Put the first pom in the root of the project. Put the 
second pom in a subdirectory named "child". Then, in the project root, run "mvn 
antrun:run". With Maven 2, the output will be "profile property value". Under 
Maven 3, it will be "default property value".

Note that the problem is unrelated to the antrun plugin. I'm just using it to 
demonstrate the behavior.

{code:title=pom.xml}
<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>com.foo</groupId>
    <artifactId>parent</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>child</module>
    </modules>
</project>
{code}

{code:title=child/pom.xml}
<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>
    <artifactId>child</artifactId>
    <packaging>jar</packaging>
    <parent>
        <groupId>com.foo</groupId>
        <artifactId>parent</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <properties>
        <test.property>default property value</test.property>
    </properties>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.3</version>
                <executions>
                    <execution>
                        <id>default-cli</id>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <echo message="Property value: 
[${test.property}]"/>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>change-property-value</id>
            <activation>
                <file>
                    <exists>child/pom.xml</exists>
                </file>
            </activation>
            <properties>
                <test.property>profile property value</test.property>
            </properties>
        </profile>
    </profiles>
</project>
{code}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to