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

Thomas Gran commented on MDEP-325:
----------------------------------

I am trying to inject (using filtering) the classpath into a fitnesse 
content.txt file (more on this later). I get simular errors. When a properties 
file is read by Java the '\n' is translated the same way as in Java Strings, so 
is '\r', '\t', '\f' ... as well as '\012' and '\u0020'. This is nice and make 
it simple to inject new lines as well as other specal characters. But setting 
the <fileSeparator> and <pathSeparator> does not work correct:

Example:

<fileSeparator>/</fileSeparator>
<pathSeparator>\n</pathSeparator>

Should produce:

___
C:/myrepo/org/a/a-1.0.jar
C:/myrepo/org/b/b-1.0.jar
^^^
but instead I get:
___
C:/myrepo/org/a/a-1.0.jar/nC:/myrepo/org/b/b-1.0.jar
^^^

All '\' (not only File.separator) is replaced.

When generating a properties file the File.separator should by default be '\\' 
on windows and '/' on Unix.

Note! When generating a fitness classpath I also need to insert whitespace 
(both new lines and space). Since whitespace is trimed of xml elements (even 
CDATA) it is important for me to keep the translation of the '\' character when 
loading the properties file.


HOWTO ON FITNESS:

Here is how a fitness classpath could be generated:

content.txt:

  |!contents -g|

  !path ${classpath}
  !path ../../target/classes


maven-dependency-plugin config:

  <fileSeparator>/</fileSeparator>
  <pathSeparator>\n!path\u0020</pathSeparator>
  <outputFilterFile>true</outputFilterFile>
  <outputFile>myFilter.properties</outputFile>

And then set up resource filtering ... 


> build-classpath adds a newline character when dependency artifact name starts 
> with letter n
> -------------------------------------------------------------------------------------------
>
>                 Key: MDEP-325
>                 URL: https://jira.codehaus.org/browse/MDEP-325
>             Project: Maven 2.x Dependency Plugin
>          Issue Type: Bug
>          Components: build-classpath
>    Affects Versions: 2.1, 2.2, 2.3
>            Reporter: L. Compère
>            Assignee: Brian Fox
>
> I'm using a combination of the maven-dependency-plugin and the 
> maven-assembly-plugin to insert a classpath in a filtered resource.
> It so happens that one of the dependencies to be added to the classpath is 
> "neethi-2.0.4.jar".
> The build-classpath goal of the dependency plugin writes the following in a 
> file (all on one line):
> classpath=%MM_ENV_PATH%J/Lib/\httpcore-nio-4.0-beta1.jar;%MM_ENV_PATH%J/Lib/\neethi-2.0.4.jar;%MM_ENV_PATH%J/Lib/\axiom-api-1.2.7.jar;%MM_ENV_PATH%J/Lib/\axiom-dom-1.2.7.jar;
> When the assembly plugin uses the content of the file generated by the 
> build-classpath goal of the dependency plugin, it translates the \n found in 
> "%MM_ENV_PATH%J/Lib/\neethi-2.0.4.jar;" into a NEWLINE character... causing 
> my classpath to be broken as such (on two lines):
> %MM_ENV_PATH%J/Lib/\httpcore-nio-4.0-beta1.jar;%MM_ENV_PATH%J/Lib/
> eethi-2.0.4.jar;%MM_ENV_PATH%J/Lib/\axiom-api-1.2.7.jar;%MM_ENV_PATH%J/Lib/\axiom-dom-1.2.7.jar;
> notice how neethi-2.0.4.jar has become eethi-2.0.4.jar....
> Has anyone had such a problem?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to