jmporterog / maven-replacer-plugin

Automatically exported from code.google.com/p/maven-replacer-plugin
MIT License
0 stars 0 forks source link

Complex statements in token and value ( xml statements ) #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create TokenValueMap file
2. put complex statement token = value pair 
   Example : <![CDATA[<level value="warn" /> <!--VAR-->]]> =
<![CDATA[<level value="error" />]]>
3. run the replacer plugin

let's use a file such as log4j.xml to run replacer on.

What is the expected output? What do you see instead?
  replace <level value="warn" /> <!--VAR-->  with <level value="error" />
  Instead, get undesired replace or no replace at all.

What version of the product are you using? On what operating system?
maven-replacer-plugin 1.2  Windows XP

Please provide any additional information below.

I like the tokenValueMap file approach. But it looks like it cannot handle
complex replace statements.
I would actually much rather use inline configuration
I see there is a issue for that already 
http://code.google.com/p/maven-replacer-plugin/issues/detail?id=23

my pom config is
<plugin>
    <groupId>com.google.code.maven-replacer-plugin</groupId>
    <artifactId>maven-replacer-plugin</artifactId>
    <version>1.2</version>
    <executions>
        <execution>
            <phase>process-resources</phase>
            <goals>
                <goal>replace</goal>
            </goals>
            <configuration>
                <file>target/classes/log4j.xml</file>

<tokenValueMap>target/classes/log-optimized.replacer</tokenValueMap>
                <regex>false</regex>
            </configuration>
        </execution>
    </executions>
</plugin>

Original issue reported on code.google.com by Martin.Jozef@gmail.com on 1 Feb 2010 at 4:10

GoogleCodeExporter commented 9 years ago
Thanks for the report. I will look into this.

Original comment by baker.st...@gmail.com on 1 Feb 2010 at 9:57

GoogleCodeExporter commented 9 years ago
I believe the issue is caused by the token/value pair not being in standard Java
properties format.
The pair:
<![CDATA[<level value="warn" /> <!--VAR-->]]> = <![CDATA[<level value="error" 
/>]]>

Equates to multiple pairs because of the ='s and spaces:
<![CDATA[<level=value="warn" /> <!--VAR-->]]> = <![CDATA[<level value="error" 
/>]]>

To fix this would either require revamping the token/value pair reading in a
tokenValueMap or, as you said, to use multiple replacements setup as described 
in
Issue 23.

Original comment by baker.st...@gmail.com on 3 Feb 2010 at 9:06

GoogleCodeExporter commented 9 years ago
Issue 23 implemented but not yet released.
I will go ahead with that implementation rather than the revamp to the 
tokenValueMap.

Original comment by baker.st...@gmail.com on 3 Feb 2010 at 10:24

GoogleCodeExporter commented 9 years ago
1.3 has been released. You should now be able to use the same functionality as 
Issue 
23.

Original comment by baker.st...@gmail.com on 9 Feb 2010 at 10:23

GoogleCodeExporter commented 9 years ago
Thanks, that feature works great

Original comment by Martin.Jozef@gmail.com on 9 Feb 2010 at 2:08