DhanaGitHub / maven-replacer-plugin

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

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 gauravgo...@gmail.com on 1 Jul 2010 at 1:33

GoogleCodeExporter commented 9 years ago
I just checked that version plugin version 1.3.1  also has the same problem.

Original comment by gauravgo...@gmail.com on 1 Jul 2010 at 1:49

GoogleCodeExporter commented 9 years ago
Hi gauravgoyal29,

This issue is occurring because you are running the build in Windows and 
Windows end of line characters are presented as ^M within Unix.

I will look into whether or not end of line characters are being replaced by 
the native system's characters.

Thanks,
Steven

Original comment by baker.st...@gmail.com on 2 Jul 2010 at 4:00

GoogleCodeExporter commented 9 years ago
Yes, i understand that Windows end of line characters are presented as ^M in 
Unix. My question is if i don't replace the token by value, then there is no 
control M introduced which suggests that when maven writes to that file and 
save, maven is not saving the file in Unix supported format.

As Java allows to build on one OS and run on any, shouldn't packaging be 
expected to behave similarly as well. I don't want to run packaging part 
differently for different OS.

Excerpts of script file before token replacement:

# Launches the component
if [ -n "$hosts" ] 
then 
    exec ${JAVACMD} ${JAVAARGS} -jar "${mkvexec_engineBINDIR}/mkvexec_engine@VERSION@.jar" $* -cshost "$hosts" -csport "$ports" 2> error.txt
else
    exec ${JAVACMD} ${JAVAARGS} -jar "${mkvexec_engineBINDIR}/mkvexec_engine@VERSION@.jar" $* 2> error.txt
fi

After Token replacement:

# Launches the component
if [ -n "$hosts" ] 
then 
    exec ${JAVACMD} ${JAVAARGS} -jar "${mkvexec_engineBINDIR}/mkvexec_engine302d4-SNAPSHOT.jar" $* -cshost "$hosts" -csport "$ports" 2> error.txt
else
    exec ${JAVACMD} ${JAVAARGS} -jar "${mkvexec_engineBINDIR}/mkvexec_engine302d4-SNAPSHOT.jar" $* 2> error.txt
fi

Original comment by gauravgo...@gmail.com on 2 Jul 2010 at 4:55

GoogleCodeExporter commented 9 years ago
 Hi,

Any updates on this one ? This is a blocking issue for us.

Thanks,
Gaurav Goyal
India

Original comment by gauravgo...@gmail.com on 6 Jul 2010 at 4:40

GoogleCodeExporter commented 9 years ago
Hi Gaurav Goyal,

No update at this stage. At this stage all I can suggest is double checking 
that all the files being run through this plugin are the correct encoding. 

If they are all UNIX encoded, try using cygwin and performing a dos2unix on 
each file after the replacements via the execute plugin or ant plugin.

I hope this helps,
Steven

Original comment by baker.st...@gmail.com on 6 Jul 2010 at 5:13

GoogleCodeExporter commented 9 years ago
Thanks !

Original comment by gauravgo...@gmail.com on 7 Jul 2010 at 4:39

GoogleCodeExporter commented 9 years ago
Hi Gaurav Goyal,

I'm sorry, I am a little confused. Did you resolve the issue with one of the 
previously mentioned suggestions? Or is this still an outstanding issue?

Steven

Original comment by baker.st...@gmail.com on 7 Jul 2010 at 6:06

GoogleCodeExporter commented 9 years ago
This is still an issue with maven-replacer-plugin  but i have used 
maven-antrun-plugin which has resolved the issue.

Thanks,
Gaurav

Original comment by gauravgo...@gmail.com on 8 Jul 2010 at 3:25

GoogleCodeExporter commented 9 years ago
Fixed in version 1.3.2
Please update and verify.

Original comment by baker.st...@gmail.com on 21 Aug 2010 at 3:08

GoogleCodeExporter commented 9 years ago
Thanks . I will verify and update in some time.

Original comment by gauravgo...@gmail.com on 26 Aug 2010 at 1:45

GoogleCodeExporter commented 9 years ago
Just issue clean up.

Original comment by baker.st...@gmail.com on 17 Sep 2012 at 12:42

GoogleCodeExporter commented 9 years ago
I am getting this error with maven-replacer-plugin version 1.5.2.  I am running 
it on a Mac, so I don't know that this is the same problem, but it is the exact 
same symptom.

I am using Maven 3.0.5 on Mavericks OS.

Original comment by johnfr...@gmail.com on 31 Oct 2013 at 4:36