Giter Club home page Giter Club logo

maven-replacer-plugin's People

Forkers

guillermodoghel

maven-replacer-plugin's Issues

Option: Don't fail when file not found

1. Try to replace something in non-existent file
2. Build fails when the file is not found.

This failure should be optional.

[INFO] [replacer:replace {execution: mrp1}]
[INFO] Replacing attribute A with attribute B in /.../messaging-service.xml
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] /.../messaging-service.xml (No such file or directory)

Original issue reported on code.google.com by [email protected] on 13 May 2009 at 2:53

Alterative way for specifying includes and excludes

instead of 

                        <includes>
                            <include>target/**/replace-me.*</include>
                        </includes>
                        <excludes>
                            <exclude>target/**/do-not-replace-me.*</exclude>
                        </excludes>


it would be nice if you could specify includes and excludes in such a
format as an alternative way:

              <includes>[ comma separated list of file filters ]</includes>
              <excludes>[ comma separated list of file filters ]</excludes>

this is for example how the maven-dependency-plugin does it.

this format is especially useful if your includes and excludes pattern is
defined by a ${property}

Original issue reported on code.google.com by [email protected] on 6 Mar 2010 at 10:28

Automatic encryption/decryption of values

Provide function for replacing tokens with encrypted values. The value may be 
either readable or encrypted.

In the case of the value being readable, provide a way to replace the token 
with the the encrypted form of the given value. This will include providing 
the mechanism and configuration for performing the encryption.
- This would be useful if values in the built artifact should not be readable 
(with the artifact able to interpret the replaced value).

In the case of the value already being encrypted, provide a mechanism and 
configuration for decrypting the value and replacing the respective token 
with the decrypted form of the value.
- This would be useful if values should not be readable in the code base.

Original issue reported on code.google.com by [email protected] on 29 Nov 2009 at 12:56

Complex statements in token and value ( xml statements )

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 [email protected] on 1 Feb 2010 at 4:10

1.3.6 version not compatible with JDK 1.5

What steps will reproduce the problem?
1. Project with 1.3.6 version of maven-replacer-plugin.
2. Run mvn clean install on project.
3. JDK version 1.5x

What is the expected output? What do you see instead?
Tokens in files specified in filesToInclude should be replaced.

What version of the product are you using? On what operating system?
1.3.6, Windows XP.

Please provide any additional information below.
Running the plugin under JDK 1.5 and version 1.3.6 of the plugin fails with 
error java.lang.NoSuchMethodError: java.lang.String.isEmpty()
1.3.6 of plugin is not JDK 1.5 compatible.

Original issue reported on code.google.com by [email protected] on 12 Feb 2011 at 5:23

Ability to pass multiple token/value as string?

What steps will reproduce the problem?
1. No ability to pass multiple replacement token/value as one string, separated 
by a specified delimiter (like the filesToInclude property).
2. This would be convenient when using a main company pom in which the 
maven-replacer-plugin is defined, but you don't always know how many 
replacements should be done. Passing a replacements string as a pom property 
would be convenient.
3. tokenValueMap partially solves this, but can't include pom properties like 
${pom.version} in the tokenValueMap.

What is the expected output? What do you see instead?
Something like:        
<tokenValueReplacements>##PROGRAM_VERSION##=${program.version},##BUILD_NUMBER##=
${pom.version}</tokenValueReplacements>
where , is separator for each token/value.


What version of the product are you using? On what operating system?
1.3.5.

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 12 Feb 2011 at 6:49

Replacement values are not correctly interpreted when some characters are present (\t,\n, ...)

Use a configuration like this
<replacements>
  <replacement>
    <token>test_token</token>
    <value>
      test_token\nwith carriage return\tand tab
    </value>
  </replacement>
</replacements>

Let's say the input file is:
test_token

The expected output in the result file would be:
test_token
with carriage return    and tab

The current output is:
test_tokennwith carriage returntand tab

It seems that the anti slashes are stripped and not interpreted as escape 
characters.

I'm using the 1.3.5 version of the plugin.

Thanks! (and thank you for this mojo)



Original issue reported on code.google.com by [email protected] on 11 Jan 2011 at 4:10

does not preserve line feeds

Take an xml file which has new lines
Use the config
<plugin>
<groupId>bakersoftware</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<id>broadcast</id>
<phase>process-resources</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<file>src/main/resources/somefile.xml</file>
<token>@TOKEN@</token>
<value>${maven.property}</value>
</configuration>
</execution>

Output file has updated tokens but missing line feeds

Original issue reported on code.google.com by [email protected] on 24 Mar 2009 at 2:44

Quiet otion

A quiet configuration option would be nice.
I.e. either don't log anything at all or (IMO better) just log a summary of how 
many files have been processed.

Original issue reported on code.google.com by [email protected] on 7 Dec 2010 at 6:04

Support specifying an output directory as a base for all replaced files

Set an output directory for all replaced files.

The output directory should be created automatically if it does not exist.
Any include based replaced file's path should be maintained in the output 
directory. This should not apply to other files included. (Possible future 
enhancement to make all replacements write out to a flat outputDir).

e.g. use: 
<include>src/main/sql/somefile</include>
<outputDir>target/processed</outputDir>

Should create a replaced version of somefile as target/processed/somefile.

(Similar feature as outputFile but applies to multiple files being replaced).

Original issue reported on code.google.com by [email protected] on 29 Oct 2010 at 11:31

Be like Maven?

What steps will reproduce the problem?
N/A

What is the expected output? What do you see instead?
N/A

What version of the product are you using? On what operating system?
1.3.2/Windows

Please provide any additional information below.
Hi,

Firstly, great plugin.
Secondly, I don't need you to make these changes - I already did it for myself 
on my local version, but I just wanted to offer an idea that might be useful to 
others.

Without boring you with the details (long story) I was using your plugin as a 
solution to a problem that I couldn't easily solve with maven filtering.

My idea for an enhancement is a variable that makes it behave more "like maven" 
filtering.
I made this change to my local version of your plugin and it made things much 
easier for me (and made it consistent with my existing knowledge of maven and 
existing projects).


The changes I made (and submit for your consideration):
1. Value/Map file reads "token=value" rather than "token (newline) value".
2. Value/Map file can contain comments if the line starts with a #.
3. Instead of replacing all instances of "token", I only replaced instances 
that are wrapped in "${" "}".

As my project had been using maven filtering, I had things like

Config file:
db.username=${username}

Properties file
# database login
username=database_user

To use your plugin I would first have to remove all the comments and change it 
to "token (newline) value".
This then produces the output file:
db.database_user=database_user

I then would have to add ${ } around my token names (to avoid unintentional 
replaces) - but this was too much for me, so I changed the plugin.


I changed the readline loop in the "contextsForFile" method of 
TokenValueMapFactory to be:


while ((line = reader.readLine()) != null) {
            lineNumber++;

            line = line.trim();
            if (line.length() == 0 || line.startsWith("#")) {
                continue;
            }

            StringTokenizer tok = new StringTokenizer(line, "=");

            if(tok.countTokens() != 2){
                throw new IllegalArgumentException("Parameters must be defined as <key>=<value> on line " + lineNumber);
            }


            String token = "${" + tok.nextToken().trim() + "}";
            String value = tok.nextToken().trim();

            contexts.add(new Replacement(fileUtils, token, value));
        }

(obviously I'm missing the configuration part of this - I changed it to always 
behave in this fashion which is not what you want).

Enjoy,

Marc

Original issue reported on code.google.com by [email protected] on 6 Sep 2010 at 1:32

The basepath of the FileSet should be ${basedir} and/or configurable

Right now the includes/excludes directives search in the directory of new
File('.') which will point to the current directory where mvn is executed.

So when you do multimodule builds the replacer of one single module
replaces files in all other modules too.

Suggestion: Add a config value directory to the mojo and default it to
${basedir}

Original issue reported on code.google.com by [email protected] on 31 Mar 2010 at 8:55

What regex syntax is used by maven-replacer-plugin?

I'm using Maven-replacer-plugin version is : 1.3.1 on Debian Lenny.

^ in the java syntax means: The beginning of a line. However, when using it , 
maven-replacer-plugin does nothing.

Example:

for something like:"url=abdef" When I use :

^url=.*
url=http://www.google.fr/
#nothing happens.

FYI, this one works:
\burl=.*
url=http://www.google.fr/

Thanks

Original issue reported on code.google.com by reda.abdi on 8 Aug 2010 at 1:38

Resolves absolute paths as relative paths on Linux

When I try the following configuration:

    <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>maven-replacer-plugin</artifactId>
        <version>1.3.6</version>
        <executions>
            <execution>
                <phase>process-resources</phase>
                <goals>
                    <goal>replace</goal>
                </goals>
            </execution>
        <executions>
        <configuration>
            <file>main/resources/index.html</file>
            <outputFile>/var/www/index.html</outputFile>
            <regex>false</regex>
            <replacements>
                <replacement>
                    <token>{HELLO_WORLD}</token>
                    <value>Hello, World!</token>
                </replacement>
            </replacements>
        </configuration>
    </plugin>

Rather than the output file being literally "/var/www/index.html", it is 
resolved as "./var/www/index.html". The functionality should be that on *nix 
systems such as Linux, paths beginning with "/" should be regarded as absolute 
paths. This is how the JVM does it. 

Original issue reported on code.google.com by [email protected] on 14 Feb 2011 at 11:09

Maintain directory hirearchy

The replacer recurses through a file structure starting at the baseDir and 
outputs the resulting files to the outputDir.  Currently there is not way to 
maintain the file structure at the outputDir; the resulting file structure is 
flattended and all files are outputted to the root of outputDir.  Is it 
possible to add this feature to future release?

Original issue reported on code.google.com by [email protected] on 2 Nov 2010 at 6:28

Cannot remove BOM characters

I'm trying to remove Byte Order Marks from HTM and CSS files.  When I run mvn 
the files that have the BOM are listed as being replaced by the plugin, and 
their timestamps are updated, but the files are not changed.

    <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>maven-replacer-plugin</artifactId>
        <version>1.3.5</version>
        <executions>
            <execution>
                <phase>clean</phase>
                <goals>
                    <goal>replace</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <encoding>UTF-8</encoding>
            <includes>
                <include>**/*.css</include>
                <include>**/*.htm</include>
            </includes>
            <token>'\xEF\xBB\xBF'</token>
            <regexFlags>
                <regexFlag>CANON_EQ</regexFlag>
                <regexFlag>UNICODE_CASE</regexFlag>
            </regexFlags>
        </configuration>
    </plugin>

Original issue reported on code.google.com by [email protected] on 12 Jan 2011 at 1:03

Regex replacement over several lines

Hi,
it would be useful to add support to regex-replace several lines in a file.
Now its only possible to replace on one line.

Example text in file:

<!--removedByBuildStart-->
 This is text I want to replace....
<!--removedByBuildEnd-->


And with a regex like this to replace all these lines:
<token>(?m)&lt;!--removedByBuildStart(.|\s)*?removedByBuildEnd--&gt;</token>

Thanks for a great plugin!

Original issue reported on code.google.com by magnus%[email protected] on 25 Sep 2009 at 9:21

java.io.FileNotFoundException is thrown when parent path for <outputFile> doesn't exist

Hi,
I want to replace som values in a file and I want to use a different
outputfile than the original. So I have one folder for the original and
another folder for the modified. This works fine for as long as the output
folder structure exist, but if the outputFile:s parent path doesn't exist,
a FileNotFoundException is thrown.

It might be a good feature to try and create the folder structure for
parameter outputFile if such doesn't exist. 

I made a quick-fix just to get around this problem which is attached as a
SVN-patch.

Regards
Johan

Original issue reported on code.google.com by [email protected] on 5 Sep 2009 at 10:30

Attachments:

Could not create directory

Hi,

After upgrading from version 1.0.3 to 1.2. The plugin could not create the
destination directory (note if the directory exists it works fine).

I included the trace for command:
mvn -Dmaven.test.skip=true -P rbjf clean generate-sources  

Original issue reported on code.google.com by [email protected] on 6 Jan 2010 at 4:53

Attachments:

Wrong usage guide

The usage guide on
http://code.google.com/p/maven-replacer-plugin/wiki/UsageGuide contains
wrong XML configuration examples. Using these, you will always receive an
error like “/path/to/project/null (no such file or directory)”.

The reason is that the <configuration> tags are inside the <execution>
elements, whereas they should be inside the <plugin> element directly.

Original issue reported on code.google.com by [email protected] on 27 Apr 2010 at 12:59

Specification of default symbol for the begin and end of a token

What steps will reproduce the problem?
1. Using a <tokenValueMap> in configuration
2. For readability each token in the resource files is surrounded with '${' and 
'}' for instance (or '$'s for simplicity).
3. Every token in the map file needs to be surrounded as well. This overhead 
does not support a quick and easy maintenance.

What is the expected output? What do you see instead?
I thought about the configuration like this:

<delimiters>
  <delimiter>${*}</delimiter>
  <delimiter>@</delimiter>
</delimiters>

I found it in well known plugin: 
http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delim
iters

Maybe the same syntax can be used to define delimiters for your great plugin.

What version of the product are you using? On what operating system?
1.3.5

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 10 Jan 2011 at 5:38

using maven 2.0.9 this plugin is a no-op.

What steps will reproduce the problem?
1. build with maven 2.0.9
2.
3.

What is the expected output? What do you see instead?
either an error message saying minimum version is not met and halt, or carry 
out search and replace

What version of the product are you using? On what operating system?


Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 19 Mar 2011 at 8:39

NullPointerException when <file> is not used and <ignoreMissingFile> is "true"

What steps will reproduce the problem?
1. Trying to do replacements in multiple files (either through 
<includes:include> or <filesToInclude>) without providing a <file> parameter 
and with <ignoreMissingFile> set to "true", plugin config:

<plugin>
    <groupId>com.google.code.maven-replacer-plugin</groupId>
    <artifactId>maven-replacer-plugin</artifactId>
    <version>1.3.4</version>
    <executions>
        <execution>
            <phase>process-test-classes</phase>
            <goals>
                <goal>replace</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <includes>
            <include>target/${project.build.finalName}/META-INF/context.xml</include>
            <include>target/${project.build.finalName}/WEB-INF/classes/porting_manager.properties</include>
        </includes>
        <ignoreMissingFile>true</ignoreMissingFile>
        <replacements>
            <replacement>
                <token>$DBHOST$</token>
                <value>localhost:5432</value>
            </replacement>
            <replacement>
                <token>$DBNAME$</token>
                <value>PortaManagerWS</value>
            </replacement>
        </replacements>
        <regex>false</regex>
    </configuration>
</plugin>

2. On building, the plugin runs into a NullPointerException:

java.lang.NullPointerException
at java.io.File.<init>(File.java:222)
at 
com.google.code.maven_replacer_plugin.file.FileUtils.fileNotExists(FileUtils.jav
a:8)
at 
com.google.code.maven_replacer_plugin.ReplacerMojo.execute(ReplacerMojo.java:191
)
at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.ja
va:490)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycl
eExecutor.java:694)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(Def
aultLifecycleExecutor.java:556)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycle
Executor.java:535)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:387)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultL
ifecycleExecutor.java:348)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExec
utor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

What is the expected output? What do you see instead?
The Tokens should be replaced in both files. A NullPointerException is thrown 
instead and the build fails.

What version of the product are you using? On what operating system?
1.3.4 on linux

Please provide any additional information below.
The problem is the check for missing files on line 211 of ReplacerMojo.java. 
"file" is not checked for null values before calling 
"fileUtils.fileNotExists(file)" which therefore runs into a 
NullPointerException.

To fix this, one could either check all destinations for missing ones or simply 
check "file" for null values:
if (ignoreMissingFile && (file != null) && fileUtils.fileNotExists(file)) {
    getLog().info("Ignoring missing file");
    return;
}

Original issue reported on code.google.com by [email protected] on 23 Nov 2010 at 4:28

Character encoding problem

Hi,

When using maven-replacer-plugin to replace some configuration files that 
contain accent 
mark like : é è à ..., it works well but when I open my files that was 
packaged in the war, 
I found that all character with accent mark had been replaced by a question 
mark "?" 

Of course, only files that were rewritten by maven-replacer-
plugin are concerned.

It seems like the plugin is writing file with its charset.

I've specified the charset to UTF-8 but with no luck :
<encoding>UTF-8</encoding>

I'm using the version : 1.3.1 of the plugin on debian lenny.

Thanks

PS : Very nice to be the first one other than baker.steven.83 to report an 
issue. Keep the 
good work ;)

Original issue reported on code.google.com by reda.abdi on 16 May 2010 at 9:55

Tokens starting with # no longer accepted in tokenValueMap

What steps will reproduce the problem?
1. use a tokenValueMap with a token that starts with #
2. mvn replacer:replace

What is the expected output? What do you see instead?

I'm expecting the token to be replaced.

I'm probably one of the few people who has tokens that start with a # and hence 
got bitten by the solution issue 36.  There was a suggestion there to be able 
to toggle comments on and off...?

Something else to note is that tokens starting with # still work if you're 
declaring the tokens in the pom, which makes it inconsistent with the way the 
tokens are read in from tokenValueMap.

What version of the product are you using? On what operating system?

1.3.4 on Linux.

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 15 Nov 2010 at 9:32

Maven-replace plugin version 1.2.0 broke the maven process

What steps will reproduce the problem?
1. mvn clean  
2. java version Java version: 1.5.0_14
3. mvn 2.2.1

[INFO] Internal error in the plugin manager getting plugin
'com.google.code.maven-replacer-plugin:maven-replacer-plugin': Plugin
'com.google.code.maven-replacer
-plugin:maven-replacer-plugin:1.2.0' has an invalid descriptor:
1) Plugin's descriptor contains the wrong version: 1.2

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 24 Feb 2010 at 9:50

Inheritance of ignoreMissingFile

It seems that IgnoreMissingFile is not properly inherited to child poms in a 
multi-module project. 
If I execute mvn in the child pom, the missing file is ignored (configuration 
is taken from the parent). If I execute mvn on the parent pom, build breaks on 
the child pom because of the missing file.

What steps will reproduce the problem?
1. Untar the provided example
2. Run mvn generate-sources on the child pom and notice that the missing file 
is ignored correctly.
3. Run mvn generate-sources on the parent pom and notice that the build breaks 
when processing the child pom... puzzling

What is the expected output? What do you see instead?
When executing the parent pom, the build should work correctly and the missing 
file in the child module shouldn't cause the build to fail

What version of the product are you using? On what operating system?
I'm using v1.3.4 of the plugin
Reproduced with 
-------------------------------------------------
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.6.0_22
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: es_ES, platform encoding: MacRoman
OS name: "mac os x" version: "10.6.5" arch: "x86_64" Family: "mac"
-------------------------------------------------
and
-------------------------------------------------
Apache Maven 2.2.1 (rdebian-1)
Java version: 1.6.0_22
Java home: /usr/lib/jvm/java-6-sun-1.6.0.22/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.32-26-generic-pae" arch: "i386" Family: "unix"
-------------------------------------------------

Original issue reported on code.google.com by [email protected] on 26 Nov 2010 at 9:59

Attachments:

Extension to regex support

Thanks for this plugin!  A much needed capability that I'm surprised maven
didn't ship with.

Regex matching is really useful, but being able to reference portions of
the regex in your substitution string would make it nearly unstoppable. 
For example, in perl:

s/beginning\(.*\)middle\(.*\)end/b\2m\1e/g

will not only take the strings "beginning", "middle" and "end" and replace
them with b, m, and e (only if they occur in the same line), it will also
take the two series of characters that match the expressions between them
and transpose them according to the replacement string, so:

beginning-stuff-middle-here-end 

will become:

b-here-m-stuff-end

This is a contrived example, but I've found this capability to be insanely
powerful in vi, and supporting it here would allow me to do the same thing
automatically in a project.

Original issue reported on code.google.com by [email protected] on 21 Jan 2010 at 1:05

Plugin adds additional newline at the end of each file

What steps will reproduce the problem?
1. Plugin adds additional newline (0D0A) at the end of each processed file

What is the expected output? What do you see instead?
Expecting not to do it

What version of the product are you using? On what operating system?
maven-replacer-plugin 1.2
Maven version: 2.0.9
Java version: 1.6.0_18
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 3 Feb 2010 at 10:41

Maven-Replacer-plugin 1.2 introduces control m characters in unix script files

What steps will reproduce the problem?
1. Replace a token with a value in unix launch scripts through pom.xml 
2. Run maven build to generate a zip file containing unix launch scripts
3. Unzip on unix. then do a 'vi *.sh'

What is the expected output? What do you see instead?
I see ^M charcaters in file which are not present if i don't replace token with 
value i.e. i just copy and zip my launch scripts

What version of the product are you using? On what operating system?

Maven version 2.2.1 on Windows 

Please provide any additional information below.

Excerpts from my pom.xml:

<plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>maven-replacer-plugin</artifactId>
                <version>1.2</version>
                <executions><execution>
                       <id>launchScripts</id>
                       <phase>prepare-package</phase>
                       <goals>
                       <goal>replace</goal>
                       </goals>
                       <configuration>             <includes><include>target/config/mkvexec_engine*</include></includes>
                       <token>@VERSION@</token>
                       <value>${pom.version}</value>
                       </configuration>
                   </execution>
                </executions>

Original issue reported on code.google.com by [email protected] on 1 Jul 2010 at 1:33

Value containing backslashes not supported

What steps will reproduce the problem?
1. Replace token in file with value (from a property, such as ${basedir})
2. Contents of replaced value do not contain the backslashes

What is the expected output? What do you see instead?
Expected:
c:\test\test.txt
Saw instead:
c:testtest.txt


Original issue reported on code.google.com by [email protected] on 13 Oct 2009 at 5:14

includes:include and filesToInclude ignore .. operation

What steps will reproduce the problem?
1.Take a default configuration that has includes:include in it.  With an 
includes that looks like this:
<includes>
<include>target/somefilename.properties</include>
</includes>
3.Do a build to make sure the replace is working
4.Modify the includes to look like the follow from before
<includes>
<include>target/../target/somefilename.properties</include>
</includes>

What is the expected output? What do you see instead?
It is expected that it would replace the file still, but it does not.  The 
<file> element is able to process the folder up (..) just fine, but the 
includes:include and filesToInclude both fail.

What version of the product are you using? On what operating system?
plugin version:1.3.5
maven version:2.2.1
os:win xp pro

Please provide any additional information below.
I need this because I have moved my target folder out of the project folder to 
the folder above.  I need the .. to get access to it.  If you are wonder why I 
have a target folder outside of the project, it is to keep eclipse from seeing 
it.  The .. should be a standard operation, please add it in.  Thanks

Original issue reported on code.google.com by [email protected] on 3 Dec 2010 at 8:32

Change to be able to use the path to the replaced file directly to the pom.xml (which is not always the same as execution path)

What steps will reproduce the problem?
1. Create simple pom.xml with the plugin execution.
2. run the build process beeing in a different directory than the pom.xml
is placed (i.e. app server deployment scripts)
3. Plugin does nothing as it executes on a 'file' which is specified
directly to execution path and not the pom.xml path.

Would be good to have specific run option to set.

Original issue reported on code.google.com by [email protected] on 30 Nov 2009 at 1:00

TokenValueMap should no be loaded by Properties.load() since it breaks regex syntax

using a TokenValueMap with regex=true does not work as expected. the
problem is that Properties.load() silently drops backslashes which
basically breaks the expression. there are other limitations with
Properties.load(), e.g. that the first whitespace character in the key will
be treated as the key/value separator, even if a '=' or ':' follows.


Original issue reported on code.google.com by [email protected] on 22 Mar 2010 at 12:23

multi-file replacements should allow to transform output filename

What steps will reproduce the problem?
1. use multiple file replacements e.g. via <includes>*.template</includes>
2. run maven build

What is the expected output? What do you see instead?
since you have used <includes> you can not specify an <outputFile>, this
means that the replacement is done directly in the input files.
it would be great if there would be a possibility to write to different
output files. For example, they could be based on the input filename:
<include>
   <includes>*.template</includes>
</include>
<outputFiles>
   <inputFilePattern>(.*).template</inputFilePattern>
   <replacement>$1.xml</replacement>
</outputFilePattern>

internally, this could be done like that for example:
inFile.getAbsolutePath().replaceAll(inputFilePattern, replacement)

What version of the product are you using? On what operating system?
1.3

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 5 Mar 2010 at 4:55

Enhancement: Multiple token/value pairs per configuration.

It would be nice to be able to do something like this:

<configuration>
    <replacements>
        <replacement>
            <token>firsttoken</token>
            <value>firstvalue</value>
        </replacement>
        <replacement>
            <token>secondtoken</token>
            <value>secondvalue</value>
        </replacement>
        ...
    </replacements>
</configuration>

The same affect can already be achieved through multiple executions, but 
something like this 
should be a bit more concise.

Thanks for this plugin!

Original issue reported on code.google.com by [email protected] on 11 Jan 2010 at 6:56

Multiline replace support

It would be great to be able to specify the multiline regexp flags:
Pattern.MULTILINE and Pattern.DOTALL

i.e. instead of 
    contents.replaceAll(token, valueToReplaceWith)
in bakersoftware.maven_replacer_plugin.TokenReplacer

to do the following
    Pattern.compile(token, flags).matcher(str).replaceAll(valueToReplaceWith)
and set flags according to parameters.

Original issue reported on code.google.com by [email protected] on 23 Dec 2009 at 12:48

Regex-based replacing in multiple files

Hi -

I downloaded your source and modified it to fit my need of inserting the
maven project version to relative paths to static resources in my jsp files.

I'd be happy to contribute the changes to this project if you add me.

Thanks

--
Lauri


Original issue reported on code.google.com by [email protected] on 17 Apr 2009 at 5:27

Using $ delimited tokens does not work

What steps will reproduce the problem?
1. use a $ delimited token like $token$
2. try to replace it

What is the expected output? What do you see instead?
That replacement works. Replacement does not happen.

What version of the product are you using? On what operating system?
1.0

Please provide any additional information below.
On OSX, Maven 2.1

Original issue reported on code.google.com by [email protected] on 12 Aug 2009 at 3:24

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.