Maven アセンブリ プラグイン 2.4 を使用して一部の構成ファイルをフィルタリングしていますが、値にコロンが含まれている場合、.bat ファイルでリテラル バックスラッシュがエスケープされないという問題があります。
pom.xml:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<filters>
<filter>src/assembly/filter.properties</filter>
</filters>
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
フィルターのプロパティ:
#Double (escaped) backslashes
testPath1 = a\\b\\c
testPath2 = c:\\test
#testPath3 contains no colon
testPath3 = c\\test
test.bat:
REM ${testPath1}
REM ${testPath2}
REM ${testPath3}
test.properties:
path1=${testPath1}
path2=${testPath2}
path3=${testPath3}
アセンブリ.xml:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>distribution</id>
<formats><format>zip</format></formats>
<files>
<file>
<source>${basedir}/src/assembly/testBat.bat</source>
<outputDirectory>/</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>${basedir}/src/assembly/testProp.properties</source>
<outputDirectory>/</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>
そして、これは...
testBat.bat (バックスラッシュはすべてエスケープされています):
REM a\b\c
REM c:\test\path
REM c\test\path
testProp.properties (パス 2 のバックスラッシュが期待どおりにエスケープされていません!!!):
path1=a\b\c
path2=c:\\test\\path
path3=c\test\path
これがある種の特別な機能なのか、それとも実際にバグなのか、誰にもわかりますか? :)