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

Graham Leggett commented on MRESOURCES-166:
-------------------------------------------

Just tried to build the MRESOURCES-166.tar project, and it contained the 
following that I didn't understand:

{code}
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>@pom.version@</version>
        </plugin>
      </plugins>
    </pluginManagement>
{code}

It tried to set the version of the maven-resources-plugin to the same as the 
project version, which is "1.0-SNAPSHOT", using an unsupported @ delimiter:

{code}
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:@pom.version@ or 
one of its dependencies could not be resolved: Failed to read artifact 
descriptor for 
org.apache.maven.plugins:maven-resources-plugin:jar:@pom.version@: Failure to 
find org.apache.maven.plugins:maven-resources-plugin:pom:@pom.version@ in 
http://repo1.maven.org/maven2 was cached in the local repository, resolution 
will not be reattempted until the update interval of central has elapsed or 
updates are forced -> [Help 1]

{code}

Swapping @pom.version@ for ${pom.version} results in the version number being 
inserted correctly, and you get a version not found error (expected, there is 
no such thing on my machine as maven-resources-plugin-1.0-SNAPSHOT):

{code}
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:1.0-SNAPSHOT or 
one of its dependencies could not be resolved: Failed to read artifact 
descriptor for 
org.apache.maven.plugins:maven-resources-plugin:jar:1.0-SNAPSHOT: Could not 
find artifact org.apache.maven.plugins:maven-resources-plugin:pom:1.0-SNAPSHOT 
-> [Help 1]
{code}

Putting the correct version in causes the project to build and install, with no 
escaping present:

{code}
fileValue=bar
export SERVER_ENV=\${SERVER_ENV:${httpd.server.env}}
envserver=sandbox
{code}

Turning escaping on in the maven-resources-plugin as follows:

{code}
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.6-SNAPSHOT</version>
          <configuration>
            <escapeString>\</escapeString>
          </configuration>
        </plugin>
{code}

Causes the output as follows, which is correct:

{code}
fileValue=bar
export SERVER_ENV=${SERVER_ENV:sandbox}
envserver=sandbox
{code}

It looks like it all works - Can you confirm I am looking at this correctly?

                
> Escaping on a line suppresses filtering for the rest of the token/line
> ----------------------------------------------------------------------
>
>                 Key: MRESOURCES-166
>                 URL: https://jira.codehaus.org/browse/MRESOURCES-166
>             Project: Maven 2.x Resources Plugin
>          Issue Type: Bug
>          Components: escape string
>    Affects Versions: 2.5
>         Environment: java version "1.6.0_33"
> Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-10M3720)
> Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
>            Reporter: Graham Leggett
>            Assignee: Olivier Lamy
>             Fix For: 2.6
>
>         Attachments: MRESOURCES-166.tar
>
>
> When an attempt is made to filter the following shell script with the 
> filtering option on the maven-resource-plugin, attempting to resolve one 
> variable while keeping another variable intact, the second variable is not 
> resolved:
> export SERVER_ENV=\${SERVER_ENV:${httpd.server.env}}
> The escape character "\" ends up escaping the entire token, or failing that 
> the entire line, and the filter "${httpd.server.env}" is unresolved.
> Expected:
> export SERVER_ENV=${SERVER_ENV:sandbox}
> Actual:
> export SERVER_ENV=${SERVER_ENV:${httpd.server.env}}
> The problem lies inside maven-filtering, and a fix and patch has been 
> submitted in http://jira.codehaus.org/browse/MSHARED-228 for maven-filtering 
> v1.1-SNAPSHOT.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to