You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Marvin King (JIRA)" <ji...@codehaus.org> on 2006/04/27 12:00:19 UTC
[jira] Closed: (MRESOURCES-15) Resources plugin does not filter
systemproperties properly
[ http://jira.codehaus.org/browse/MRESOURCES-15?page=all ]
Marvin King closed MRESOURCES-15:
---------------------------------
Resolution: Fixed
> Resources plugin does not filter systemproperties properly
> ----------------------------------------------------------
>
> Key: MRESOURCES-15
> URL: http://jira.codehaus.org/browse/MRESOURCES-15
> Project: Maven 2.x Resources Plugin
> Type: Bug
> Environment: maven 2.0.2, tested on Mac OS X, Windows XP
> Reporter: Janis Schuller
> Assignee: Marvin King
> Fix For: 2.2
> Attachments: possible_fix_for_MRESOURCES15.patch
>
> Original Estimate: 20 minutes
> Remaining: 20 minutes
>
> I tried to use filtering to introduce build-time information into some binaries. I used the filtering mechanism as described in the maven getting started guide, but I did not succeed. If you try to filter e.g. ${os.name} it will be filtered to the same result as using ${pom.name}. Other system properties such as
> java.version=${java.version} are simply not filtered and appear untouched in the resulting file in the target-dir. (Just follow getting started guide section filtering to reproduce)
> I think I located the problem (or a part of it): In the resources-plugin's Mojo Code in ResourcesMojo.java in initializeFiltering()
> private void initializeFiltering()
> throws MojoExecutionException
> {
> // System properties
> filterProperties = new Properties( System.getProperties() );
> .....
> the filter is initialized with default-values from System.getProperties(); These properties are not added to the Hashtable the Properties object is extending but to an internal member of Properties called defaults. In getProperty() a second lookup to the internal member is performed in case of a null return of super.get(key) -- but the filtering is done via org.codehaus.plexus.util.InterpolationFilterReader which just calls
> get() on the supplied variables Map (in our case a properties object)
> Simple solution would be to explicitly add all system properties to the filter object:
> private void initializeFiltering()
> throws MojoExecutionException
> {
> // System properties
> filterProperties = new Properties();
> filterProperties.putAll(System.getProperties());
> .....
> Hope that helps
> Janis
--
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