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

Fahd Siddiqui updated MNG-6259:
-------------------------------
    Description: 
This is an error consistently seen on Mac (OS X 10.11.6), but it seems to work 
fine on linux (our jenkins agent).

Basically, when `filtering` is set to true in the resources plugin, the 
resource file contents are copied incorrectly converting \${something} to 
${something}. Note the missing back-slash, and also that "something" is not a 
maven variable. The expected behavior is to keep it unchanged. Here is a unit 
test that shows the issue:
1. First, create a resource text file "new.test" with just the string 
{code}\${something }{code}
2. Make sure that resource plugin has filtering set to "true":
{code}
<testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
      </testResource>
{code}

3. Create the unit test below:
{code}
@Test
public void test() throws IOException {
    URL url = Resources.getResource("conf/new.test");
    String text = Resources.toString(url, Charsets.UTF_8);
    String expectedText = "\\${something }" ;
    System.out.println("actual: " + text);
    System.out.println("expected: " + expectedText);

    assertEquals(expectedText, text);
}
{code}
3. Note that when you run the above test from the IDE directly, it passes.
4. Run `mvn clean install` from command line and verify the following error:
{code}
actual: ${something }
expected: \${something }

org.junit.ComparisonFailure: 
Expected :\${something }
Actual   :${something }
{code}


  was:
This is an error consistently on Mac (OS X 10.11.6), but it seems to work fine 
on linux (our jenkins agent).

Basically, when `filtering` is set to true in the resources plugin, the 
resource file contents are copied incorrectly converting \${something} to 
${something}. Note the missing back-slash, and also that "something" is not a 
maven variable. The expected behavior is to keep it unchanged. Here is a unit 
test that shows the issue:
1. First, create a resource text file "new.test" with just the string 
{code}\${something }{code}
2. Make sure that resource plugin has filtering set to "true":
{code}
<testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
      </testResource>
{code}

3. Create the unit test below:
{code}
@Test
public void test() throws IOException {
    URL url = Resources.getResource("conf/new.test");
    String text = Resources.toString(url, Charsets.UTF_8);
    String expectedText = "\\${something }" ;
    System.out.println("actual: " + text);
    System.out.println("expected: " + expectedText);

    assertEquals(expectedText, text);
}
{code}
3. Note that when you run the above test from the IDE directly, it passes.
4. Run `mvn clean install` from command line and verify the following error:
{code}
actual: ${something }
expected: \${something }

org.junit.ComparisonFailure: 
Expected :\${something }
Actual   :${something }
{code}



> Maven Resources Plugin copy error when filtering is true on a Mac
> -----------------------------------------------------------------
>
>                 Key: MNG-6259
>                 URL: https://issues.apache.org/jira/browse/MNG-6259
>             Project: Maven
>          Issue Type: Bug
>          Components: Errors
>    Affects Versions: 3.2.5
>            Reporter: Fahd Siddiqui
>
> This is an error consistently seen on Mac (OS X 10.11.6), but it seems to 
> work fine on linux (our jenkins agent).
> Basically, when `filtering` is set to true in the resources plugin, the 
> resource file contents are copied incorrectly converting \${something} to 
> ${something}. Note the missing back-slash, and also that "something" is not a 
> maven variable. The expected behavior is to keep it unchanged. Here is a unit 
> test that shows the issue:
> 1. First, create a resource text file "new.test" with just the string 
> {code}\${something }{code}
> 2. Make sure that resource plugin has filtering set to "true":
> {code}
> <testResources>
>       <testResource>
>         <directory>src/test/resources</directory>
>         <filtering>true</filtering>
>       </testResource>
> {code}
> 3. Create the unit test below:
> {code}
> @Test
> public void test() throws IOException {
>     URL url = Resources.getResource("conf/new.test");
>     String text = Resources.toString(url, Charsets.UTF_8);
>     String expectedText = "\\${something }" ;
>     System.out.println("actual: " + text);
>     System.out.println("expected: " + expectedText);
>     assertEquals(expectedText, text);
> }
> {code}
> 3. Note that when you run the above test from the IDE directly, it passes.
> 4. Run `mvn clean install` from command line and verify the following error:
> {code}
> actual: ${something }
> expected: \${something }
> org.junit.ComparisonFailure: 
> Expected :\${something }
> Actual   :${something }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to