You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Karl Heinz Marbaise (JIRA)" <ji...@apache.org> on 2016/03/27 15:49:25 UTC

[jira] [Closed] (MRESOURCES-193) Generated properties appear to be ignored by the resources plugin

     [ https://issues.apache.org/jira/browse/MRESOURCES-193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Karl Heinz Marbaise closed MRESOURCES-193.
------------------------------------------
    Resolution: Incomplete

No feedback nor supplemental information for this. If you have further details etc. please don't hesitate to reopen the issue.

> Generated properties appear to be ignored by the resources plugin
> -----------------------------------------------------------------
>
>                 Key: MRESOURCES-193
>                 URL: https://issues.apache.org/jira/browse/MRESOURCES-193
>             Project: Maven Resources Plugin
>          Issue Type: Bug
>          Components: copy
>    Affects Versions: 2.3, 2.4, 2.4.1, 2.4.2, 2.4.3, 2.5, 2.6, 2.7
>         Environment: Running on Mac OS X
> Apache Maven 3.2.3
> Java version: 1.6.0_65, vendor: Apple Inc.
>            Reporter: John Harvey
>         Attachments: pom.xml
>
>
> There are currently two plugins that I'm aware of that can generate a property; one is the build-helper-maven-plugin from org.codehaus.mojo, and the other is 
> gmaven-plugin from org.codehaus.groovy.maven.  What these plugins do is allow you to run a regex on a pre-defined property and therefore generate a new property.
> For my project, I'm trying to transform the 1.6.0-SNAPSHOT project.version into a simpler new string, essentially v1p6p0.  I'm doing this with a regex, and the variable this will be stored in is called target.version.encoded.  I'd like to use that property name to create a directory with that name during resources:resources execution.  Note that I can easily do this with a hardcoded property.
> The regex happens at the validate phase of the build.
> The resources copy happens at the process-resources phase of the build.
> I have an ANT task that runs in-between these two processes during the initialize phase of the build, in order to print out the variable, which verifies that it was created properly.  Unfortunately, when the resources:resources phase runs, the newly-generated property is ignored, and a directory called ${target.version.encoded} is created.  My pom is below, followed by the important part of the log that I see.
> In the pom-file (attached), you can comment out the "TEST 1" plugin section and replace it with the "TEST2" and you'll see similar results.  If you don't run the pom with the "prod" profile, you can also see everything work with the hard-coded property for target.version.encoded.
> The pom is attached to preserve formatting.
> Command: mvn -Pprod clean install
> Log:
> [INFO] --- build-helper-maven-plugin:1.9.1:regex-property (regex-target.version.encoded) @ fake-parent ---
> [INFO] 
> [INFO] --- maven-antrun-plugin:1.1:run (default) @ fake-parent ---
> [INFO] Executing tasks
>      [echo] =======================================
>      [echo] DYNAMIC VARIABLES
>      [echo] =======================================
>      [echo] [target.version.encoded] v1p6p0
>      [echo] =======================================
> [INFO] Executed tasks
> [INFO] 
> [INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ fake-parent ---
> [WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
> [INFO] Copying 1 resource to /Users/user/git/example2/target/${target.version.encoded}
> Result:
>  - You can see that the ant task clearly knows target.version.encoded, whereas the replacer version does not.  When I look in target/, I see a directory called "${target.version.encoded}".
> Note that if you run the command without the -Pprod profile, target.version.encoded becomes "dev", and the target/dev directory is created appropriately.
> I tried with versions 2.3 through 2.7 of the resources plugin, and with both property-creator plugins.  Since both produce the same result, I am suspicious of the resources plugin.  However, the issue could be that those plugins produce non-standard output, although that does not seem to be the case based on the fact that the ant script works fine with the newly-created property.
> Any help would be appreciated.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)