maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oumar Aziz OUATTARA (JIRA)" <j...@codehaus.org>
Subject [jira] Commented: (MINSTALL-50) provide property filtering on .pom files placed in local repo
Date Thu, 04 Jun 2009 07:16:42 GMT

    [ http://jira.codehaus.org/browse/MINSTALL-50?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=179255#action_179255
] 

Oumar Aziz OUATTARA commented on MINSTALL-50:
---------------------------------------------

Hi, 

I would like to see this feature implemented in Maven. However, the request doesn't take into
account one use case that I am having. 
It's valid to want to have some properties not filtered in a pom.xml , while having some others
filtered. 
You can imagine that in the same file, I would like to use a property called ${java.home}
and another one called '${my.version}'

*  ${my.version} is to be set when publishing the artifact. 
*  ${java.home}  is platform dependent. so I don't want to set it to a static value.

So my guess is, there should be a way to distinguish properties that we want to change when
publishing from the others. We can use for that a naming scheme. Let's say that :
 * for backward compatibility, everything that is of the form '\$\{[a-zA-Z0-9\._-]+\}' is
a property that we don't want to filter
 * and '\$\{m2filtered.[a-zA-Z0-9_-]+\}' is a property that we want to change. 

But this could create a regression on some projects which named their properties with the
chosen prefix.

Another option would be to define a new naming of properties like '#{[a-zA-Z0-9\._-]+}'  that
would be filtered. But I guess, this would impact a lot more than install and deploy plugins.
It would be more maven-core.


> provide property filtering on .pom files placed in local repo
> -------------------------------------------------------------
>
>                 Key: MINSTALL-50
>                 URL: http://jira.codehaus.org/browse/MINSTALL-50
>             Project: Maven 2.x Install Plugin
>          Issue Type: New Feature
>          Components: install:install
>    Affects Versions: 2.3
>         Environment: independent
>            Reporter: Stefan Armbruster
>         Attachments: MNG-maven-install.patch, MNG-maven-install.patch
>
>
> When maven installs an artifact, it's pom is also copied into the artifact's directory.
Unfortunately, if the pom contains a property reference (e.g. ${myprop}), this will not be
replaced upon copying the pom file.
> I've created a patch for the install plugin that switches on property filtering by setting
a mojo parameter "filteringEnabled". Since this defaults to "false", backward compatibility
is kept 100%. 
> Some implementation notes:
> * the dirty work is done in FilteredProjectArtifactMetadata.java, the property resolution
code has been inspired by ResourcesMojo.
> * I've added a unit test, that replaces ${basedir} with the value of a system property.
> * since "svn diff" does not handle binary files, src/test/resources/unit/basic-install-test-with-filtering/target/maven-install-test-1.0-SNAPSHOT.jar
is not included in the patch. This file is the same as 
> src/test/resources/unit/basic-install-test/target/maven-install-test-1.0-SNAPSHOT.jar
> Since my knowledge of Maven API is more than limited, there might be a more elegant way
to provide this feature ... but it works! I'd be happy to see this in a future release of
maven.

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

        

Mime
View raw message