Setting property in profiles is not evaluated for POM validation
----------------------------------------------------------------

                 Key: MNG-2632
                 URL: http://jira.codehaus.org/browse/MNG-2632
             Project: Maven 2
          Issue Type: Bug
          Components: POM
    Affects Versions: 2.0.4
         Environment: WinXP
            Reporter: Christoph Amshoff


There seems to be a problem concerning POM validation and setting properties in 
profiles.xml: when I set a property in my profiles.xml it is not evaluated for 
POM validation in a multi module build. 

The details: My project C depends on module B, which itself is a child of 
module A. Module A defines a system scope dependency like this: 

{code}
<dependency> 
  <groupId>db2</groupId> 
  <artifactId>db2</artifactId> 
  <version>8.2</version> 
  <scope>system</scope> 
  <systemPath>${path.db2jar}</systemPath> 
</dependency>
{code}

The path to db2.jar depends on the developer's machine and is specified in the 
profiles.xml, toghether with other settings. Both A and B are building and 
deploying fine. 

Now, when I try to build C, it complains about missing definition for 
'path.db2jar': 

{code}
[WARNING] POM for '...B:pom:4.4.0-SNAPSHOT:compile' is invalid. It will be 
ignored for artifact resolution. Reason: 
Failed to validate POM 
[DEBUG] Reason: Failed to validate POM 
[DEBUG] 
Validation Errors: 
[DEBUG] For dependency Dependency {groupId=db2, artifactId=db2, version=8.2, 
type=jar}: system-scoped dependency 
must specify an absolute path systemPath. 
{code}

I'm using a profiles.xml section like this one: 

{code}
<profile> 
  <id>env-nb</id> 
  <activation> 
    <property> 
      <name>env</name> 
      <value>nb</value> 
    </property> 
  </activation> 
  <properties> 
    <path.db2jar>c:/programme/IBM/SQLLIB/java/db2java.zip</path.db2jar> 
    ... 
  </properties> 
</profile> 
{code}

which is triggered by -Denv=nb, and this activation is working fine since 
'help:effective-pom' is correctly showing me something like 

{code}
<properties> 
  <path.db2jar>c:/programme/IBM/SQLLIB/java/db2java.zip</path.db2jar> 
  ... 
</properties> 
{code}

So the profiles.xml seems to be evaluated correctly, but the property is not 
used for validating the POM of dependent modules.

And yes, when I run Maven without the profiles.xml, but with specifying the 
property on command line (like '-Dpath.db2jar=...'), all is working fine! But 
that's not exactly what we want, since profiles are meant to encapsulate those 
kind of settings... 


-- 
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