profile activation have trouble when based on project variable
--------------------------------------------------------------
Key: MNG-4927
URL: http://jira.codehaus.org/browse/MNG-4927
Project: Maven 2 & 3
Issue Type: Bug
Affects Versions: 3.0.1, 2.2.1
Environment: Ubuntu/Maven 3.0.1 or WindowsXP/Maven 2.2.1
JVM 1.6
Reporter: David N'DIAYE
Attachments: pom.xml
I tried to manage the generation of Java code from a wsdl via a Maven profile
that is activated only if the build directory does not exist, and the
activation profile behaved oddly.
For example, this activation code is always active, even if
{{'target/generated-sources'}} exists.
{code:xml}
<activation>
<activeByDefault>false</activeByDefault>
<file>
<missing>${project.build.directory}/generated-sources/</missing>
</file>
</activation>
{code}
I create a simple test case.
# first step, check profiles which are activate
{code:title=mvn help:active-profiles|borderStyle=solid}
$ mvn help:active-profiles
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building profile 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-help-plugin:2.1.1:active-profiles (default-cli) @ profile ---
[INFO]
Active Profiles for Project 'tescase:profile:jar:0.0.1':
The following profiles are active:
- test-profile-ok (source: pom)
- test-profile-ko (source: pom)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
{code}
# second step, compile
{code:title=mvn compile|borderStyle=solid}
$ mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building profile 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.3:run (wsdl2java-ko) @ profile ---
[INFO] Executing tasks
[echo] profile test-profile-ko : unfortunately this profile is always
active
[INFO] Executed tasks
[INFO]
[INFO] --- maven-antrun-plugin:1.3:run (wsdl2java-ok) @ profile ---
[INFO] Executing tasks
[echo] profile test-profile-ok : This profile is active if and only if,
the directory 'target/generated-sources' does not exist
[INFO] Executed tasks
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ profile
---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
/home/david/tmp/jira/maven/activationProfile/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ profile ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-antrun-plugin:1.3:run (default) @ profile ---
[INFO] Executing tasks
[echo] build sample
[echo] mkdir
/home/david/tmp/jira/maven/activationProfile/target/generated-sources
[mkdir] Created dir:
/home/david/tmp/jira/maven/activationProfile/target/generated-sources
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
{code}
# third step : the first error, *{color:red}the profile which is activate by
variable is always active{color}*
{code:title=mvn help:active-profiles|borderStyle=solid}
$ mvn help:active-profiles
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building profile 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-help-plugin:2.1.1:active-profiles (default-cli) @ profile ---
[INFO]
Active Profiles for Project 'tescase:profile:jar:0.0.1':
The following profiles are active:
- test-profile-ko (source: pom)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
{code}
# fourth step : when i relaunch the compile *{color:red}the profile is still
active{color}*
{code:title=mvn compile|borderStyle=solid}
$ mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building profile 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.3:run (wsdl2java-ko) @ profile ---
[INFO] Executing tasks
[echo] profile test-profile-ko : unfortunately this profile is always
active
[INFO] Executed tasks
...
{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