I want to call a task <proguard>in Ant and pass it the paths to various JAR files, for example. equivalent:
<proguard>
-injars /some/path/jar1;/some other path/jar2
</proguard>
The problem is that some of these paths may contain spaces or special characters, they must be specified as described in the proguard manual :
<proguard>
-injars /some/path/jar1;"/some other path/jar2"
</proguard>
This does not work to quote the entire argument; separate paths must be specified separately. The Ant file I am editing uses properties to pass the various JARs paths to proguard, and my problem is how to correctly quote separate paths for -injars and -libraryjars. Example:
<property name="libraryjars" refid="some.classpath" />
<proguard>
@${proguard.config}
-libraryjars ${libraryjars}
</proguard>
I just changed the property to look like this:
<property name="libraryjars.unquoted" refid="some.classpath"/>
<property name="libraryjars" value="'${libraryjars.unquoted}'"/>
, ? ? , "path1; path2", , . , script, Ant :-) , , , (, , Windows, Mac Linux), , , Ok - Ant script.
[Update] @martin, , , pathconvert mapper chain:
<pathconvert property="dest.path" refid="source.path">
<firstmatchmapper>
<regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
<identitymapper/>
</firstmatchmapper>
</pathconvert>
C:\path\jar 1;C:\my path\jar2;C:\path\jar3 "C:\path\jar 1";"C:\my path\jar2";C:\path\jar3. . , . , - , - , .