You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Deepak Abraham (JIRA)" <ji...@codehaus.org> on 2014/07/25 11:35:11 UTC

[jira] (MRESOURCES-39) Filtering fails for command line properties

    [ https://jira.codehaus.org/browse/MRESOURCES-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=350336#comment-350336 ] 

Deepak Abraham commented on MRESOURCES-39:
------------------------------------------

doesn't work in version 2.6 resources plugin

If I specify a property like so in the pom.xml:

    <properties>
         <env.name>local</env.name>
    </properties>

I am using this property to specfiy a folder name in the filter property:

              <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <configuration>
                        <filters>
                            <filter>${basedir}/../deploy/etc/filters/${env.name}/env.properties</filter>
                        </filters>
                    </configuration>
                    <executions>
                ...

Then I am unable to override this property value through the command prompt, i.e., mvn install -Denv.name=dev does not work as expected. 'env.name' is still local instead of dev.

> Filtering fails for command line properties
> -------------------------------------------
>
>                 Key: MRESOURCES-39
>                 URL: https://jira.codehaus.org/browse/MRESOURCES-39
>             Project: Maven Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 2.2
>         Environment: maven-2.0.4 and maven-2.0.5
> Mac OS X
>            Reporter: Matt Brozowski
>            Assignee: Olivier Lamy
>            Priority: Critical
>             Fix For: 2.3
>
>         Attachments: filtering-bug.tar, maven-resources-plugin-prop-filtering-r630241.patch
>
>
> When passing a property on the command line to maven using -D it does not properly override values passed to filters.
> I have attached a sample project that defines a property in the pom.xml called 'filtered'   This property is used as a filter in the filtered.properties file in src/main/filtered/filtered.properties.  I have also included a test that gets passed the filtered property as a System property via the surefire plugin.  It then loaded the filtered.properties file and tests to ensure the filters match.
> The tests pass when run as
> mvn test
> BUT if I run as 
> mvn -Dfiltered=from-cmd-line teset
> They fail.
> I have also included the antrun plugin print its perspective on the value of the property.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)