You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Ivan (JIRA)" <ji...@codehaus.org> on 2010/06/03 10:20:12 UTC

[jira] Created: (MNG-4699) Properties appending, changing, self-reference, scope and other

Properties appending, changing, self-reference, scope and other
---------------------------------------------------------------

                 Key: MNG-4699
                 URL: http://jira.codehaus.org/browse/MNG-4699
             Project: Maven 2 & 3
          Issue Type: Improvement
    Affects Versions: 2.2.1
         Environment: Any
            Reporter: Ivan


1. Currently property mechanism is not very strong in Maven. So I think property management should be complemented with such things:
1) "overridden-by" option - is a comma-separated list of values ('parent', 'children', 'profiles', 'env', 'cli', maybe some other) which specifies which properties with the same name can override this one. For example value "env,cli,profiles" means property can be overridden by environment variables, command line params and by profiles.
2) "scope" option (related to "overridden-by") - scope of variable. Values at least: 'local' (visible only in current context, e.g. not visible in profiles if declared in project), 'global' (visible everywhere), some other scopes).
3) "read-only" (true/false) - 'true' means that variable can be changed somewhere, possibly !!!self-referenced!!!
So pom will look like:
<properties>
  <property>
    <name>_name_</name>
    <value>_value_</value>
    <overridden-by>env,cli,profiles</overridden-by>
    <scope>global</scope><!-- default-->
    <read-only></read-only><!-- default-->
  </property>
</properties>

2. Of course old style of properties can be left (left also), because additional options are not extremely important in practice. But what is really important here - is ability to append/self-reference properties.
For example in our current project we have different feature sets, unnecessary of which are excluded with the help of profiles, like this:

<project> <!-- simplified syntax -->
  <properties>
    <ex1></ex1>
    <ex2></ex2>
    ...
    <exN></exN>
  <properties>

  <profile id="p1">
    <properties>
      <ex1>,path1</ex1>
    <properties>
  </profile>
  <profile id="p2">
    <properties>
      <ex2>,path2</ex2>
    <properties>
  </profile>
  ...

  <build>
    <war-plugin>
      <packagingExcludes>${ex1}${ex2}...${exN}</packagingExcludes>
    </war-plugin>
  </build>
</project>

It would be much better if only one property is necessary ("ex"), so in each profile we can write <ex>${ex},pathI</ex>, so war-plugin configuration will not be aware of profiles count.
If this problem can be solved in some other way (but without antrun-plugin), I would be grateful if somebody tell me the solution.
I apologize if this is duplication or can be solved in another way.

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