2012-01-27 69 views
2

我有這個我想優化的參數字符串

<path id="bootclasspath"> 
     <pathelement path="${J2MEWTK.HOME}/lib/cldcapi10.jar"/> 
     <pathelement path="${J2MEWTK.HOME}/lib/cldcapi11.jar"/> 
     <pathelement path="${J2MEWTK.HOME}/lib/midpapi10.jar"/> 
     <pathelement path="${J2MEWTK.HOME}/lib/midpapi20.jar"/> 
     <pathelement path="${J2MEWTK.HOME}/lib/midpapi21.jar"/> 
</path> 

巫婆我somewere也somwhere我有這樣的需要:

<arg line="-classpath ${dir.classes};${J2MEWTK.HOME}/lib/cldcapi10.jar;${J2MEWTK.HOME}/lib/cldcapi11.jar;{J2MEWTK.HOME}/lib/midpapi10.jar;${J2MEWTK.HOME}/lib/midpapi20.jar;${J2MEWTK.HOME}/lib/midpapi21.jar -d ${dir.classes} ${dir.classes} "/> 

它的工作原理,這是確定的,但問題是:如何我可以寫入從路徑元素生成的參數字符串嗎?

回答

1

聽起來像一個工作,一個pathconvert task,是這樣的:

<pathconvert refid="bootclasspath" property="bootcp" pathsep=";"/> 
... 
<arg line="-classpath ${dir.classes};${bootcp} -d ${dir.classes} ${dir.classes} "/> 
+0

:o它就像一個魅力!謝謝 :) – 2012-01-27 23:59:46