You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Karl Heinz Marbaise (JIRA)" <ji...@apache.org> on 2016/07/23 16:21:20 UTC

[jira] [Updated] (MNG-6070) Profile activation based on a property does not work correctly

     [ https://issues.apache.org/jira/browse/MNG-6070?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Karl Heinz Marbaise updated MNG-6070:
-------------------------------------
    Description: 
I have created a simple example project with the following pom file:
{code: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.soebes.maven.example</groupId>
  <artifactId>example</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.soebes.maven.plugins</groupId>
          <artifactId>echo-maven-plugin</artifactId>
          <version>0.3.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.soebes.maven.plugins</groupId>
            <artifactId>echo-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>initialize</phase>
                <goals>
                  <goal>echo</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <echos>
                <echo>Profile: performRelease property is activated '${performRelease}'.</echo>
              </echos>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
{code}

If I use Maven 3.3.9 and run it like this:
{code}
~/ws-git-maven-bugs/profiles (master)$ mvn initialize
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building example 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.401 s
[INFO] Finished at: 2016-07-23T18:11:47+02:00
[INFO] Final Memory: 7M/245M
[INFO] ------------------------------------------------------------------------
{code}
If I run the current master of Maven Core (sha: 90f26c279af9738735be8f84f60dcf21b6244e24) I got the following result:
{code}
~/ws-git-maven-bugs/profiles (master)$ ~/tools/maven-test/apache-maven-3.4.0-SNAPSHOT/bin/mvn initialize
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building example 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- echo-maven-plugin:0.3.0:echo (default) @ example ---
[INFO] Profile: performRelease property is activated '${performRelease}'.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.478 s
[INFO] Finished at: 2016-07-23T18:12:54+02:00
[INFO] Final Memory: 9M/245M
[INFO] ------------------------------------------------------------------------
{code}

This means the profile will be erroneously activated but the property does not contain a value.

If I add an id to the profile like this:

{code:xml}
  <profiles>
    <profile>
      <id>an-other-profile</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
  ..
{code}
It will produce the following (correct) result:
{code}
~/ws-git-maven-bugs/profiles (master *)$ ~/tools/maven-test/apache-maven-3.4.0-SNAPSHOT/bin/mvn initialize
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building example 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.279 s
[INFO] Finished at: 2016-07-23T18:18:23+02:00
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------
{code}

I have create a full working example here: https://github.com/khmarbaise/mng-6070

  was:
I have created a simple example project with the following pom file:
{code: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.soebes.maven.example</groupId>
  <artifactId>example</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.soebes.maven.plugins</groupId>
          <artifactId>echo-maven-plugin</artifactId>
          <version>0.3.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.soebes.maven.plugins</groupId>
            <artifactId>echo-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>initialize</phase>
                <goals>
                  <goal>echo</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <echos>
                <echo>Profile: performRelease property is activated '${performRelease}'.</echo>
              </echos>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
{code}

If I use Maven 3.3.9 and run it like this:
{code}
~/ws-git-maven-bugs/profiles (master)$ mvn initialize
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building example 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.401 s
[INFO] Finished at: 2016-07-23T18:11:47+02:00
[INFO] Final Memory: 7M/245M
[INFO] ------------------------------------------------------------------------
{code}
If I run the current master of Maven Core (sha: 90f26c279af9738735be8f84f60dcf21b6244e24) I got the following result:
{code}
~/ws-git-maven-bugs/profiles (master)$ ~/tools/maven-test/apache-maven-3.4.0-SNAPSHOT/bin/mvn initialize
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building example 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- echo-maven-plugin:0.3.0:echo (default) @ example ---
[INFO] Profile: performRelease property is activated '${performRelease}'.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.478 s
[INFO] Finished at: 2016-07-23T18:12:54+02:00
[INFO] Final Memory: 9M/245M
[INFO] ------------------------------------------------------------------------
{code}

This means the profile will be erroneously activated but the property does not contain a value.

If I add an id to the profile like this:

{code:xml}
  <profiles>
    <profile>
      <id>an-other-profile</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
  ..
{code}
It will produce the following (correct) result:
{code}
~/ws-git-maven-bugs/profiles (master *)$ ~/tools/maven-test/apache-maven-3.4.0-SNAPSHOT/bin/mvn initialize
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building example 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.279 s
[INFO] Finished at: 2016-07-23T18:18:23+02:00
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------
{code}



> Profile activation based on a property does not work correctly
> --------------------------------------------------------------
>
>                 Key: MNG-6070
>                 URL: https://issues.apache.org/jira/browse/MNG-6070
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.4.0
>         Environment: ~/ws-git-maven-bugs/profiles (master)$ ~/tools/maven-test/apache-maven-3.4.0-SNAPSHOT/bin/mvn --version
> Apache Maven 3.4.0-SNAPSHOT (90f26c279af9738735be8f84f60dcf21b6244e24; 2016-07-23T16:24:50+02:00)
> Maven home: /Users/kama/tools/maven-test/apache-maven-3.4.0-SNAPSHOT
> Java version: 1.7.0_79, vendor: Oracle Corporation
> Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "Mac OS X", version: "10.8.5", arch: "x86_64", family: "Unix"
>            Reporter: Karl Heinz Marbaise
>            Priority: Blocker
>
> I have created a simple example project with the following pom file:
> {code: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.soebes.maven.example</groupId>
>   <artifactId>example</artifactId>
>   <packaging>jar</packaging>
>   <version>1.0-SNAPSHOT</version>
>   <properties>
>     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>   </properties>
>   <build>
>     <pluginManagement>
>       <plugins>
>         <plugin>
>           <groupId>com.soebes.maven.plugins</groupId>
>           <artifactId>echo-maven-plugin</artifactId>
>           <version>0.3.0</version>
>         </plugin>
>       </plugins>
>     </pluginManagement>
>   </build>
>   <profiles>
>     <profile>
>       <activation>
>         <property>
>           <name>performRelease</name>
>           <value>true</value>
>         </property>
>       </activation>
>       <build>
>         <plugins>
>           <plugin>
>             <groupId>com.soebes.maven.plugins</groupId>
>             <artifactId>echo-maven-plugin</artifactId>
>             <executions>
>               <execution>
>                 <phase>initialize</phase>
>                 <goals>
>                   <goal>echo</goal>
>                 </goals>
>               </execution>
>             </executions>
>             <configuration>
>               <echos>
>                 <echo>Profile: performRelease property is activated '${performRelease}'.</echo>
>               </echos>
>             </configuration>
>           </plugin>
>         </plugins>
>       </build>
>     </profile>
>   </profiles>
> </project>
> {code}
> If I use Maven 3.3.9 and run it like this:
> {code}
> ~/ws-git-maven-bugs/profiles (master)$ mvn initialize
> [INFO] Scanning for projects...
> [INFO]
> [INFO] ------------------------------------------------------------------------
> [INFO] Building example 1.0-SNAPSHOT
> [INFO] ------------------------------------------------------------------------
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 0.401 s
> [INFO] Finished at: 2016-07-23T18:11:47+02:00
> [INFO] Final Memory: 7M/245M
> [INFO] ------------------------------------------------------------------------
> {code}
> If I run the current master of Maven Core (sha: 90f26c279af9738735be8f84f60dcf21b6244e24) I got the following result:
> {code}
> ~/ws-git-maven-bugs/profiles (master)$ ~/tools/maven-test/apache-maven-3.4.0-SNAPSHOT/bin/mvn initialize
> [INFO] Scanning for projects...
> [INFO]
> [INFO] ------------------------------------------------------------------------
> [INFO] Building example 1.0-SNAPSHOT
> [INFO] ------------------------------------------------------------------------
> [INFO]
> [INFO] --- echo-maven-plugin:0.3.0:echo (default) @ example ---
> [INFO] Profile: performRelease property is activated '${performRelease}'.
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 0.478 s
> [INFO] Finished at: 2016-07-23T18:12:54+02:00
> [INFO] Final Memory: 9M/245M
> [INFO] ------------------------------------------------------------------------
> {code}
> This means the profile will be erroneously activated but the property does not contain a value.
> If I add an id to the profile like this:
> {code:xml}
>   <profiles>
>     <profile>
>       <id>an-other-profile</id>
>       <activation>
>         <property>
>           <name>performRelease</name>
>           <value>true</value>
>         </property>
>       </activation>
>   ..
> {code}
> It will produce the following (correct) result:
> {code}
> ~/ws-git-maven-bugs/profiles (master *)$ ~/tools/maven-test/apache-maven-3.4.0-SNAPSHOT/bin/mvn initialize
> [INFO] Scanning for projects...
> [INFO]
> [INFO] ------------------------------------------------------------------------
> [INFO] Building example 1.0-SNAPSHOT
> [INFO] ------------------------------------------------------------------------
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 0.279 s
> [INFO] Finished at: 2016-07-23T18:18:23+02:00
> [INFO] Final Memory: 8M/245M
> [INFO] ------------------------------------------------------------------------
> {code}
> I have create a full working example here: https://github.com/khmarbaise/mng-6070



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)