我有這個ant任務,創建一個webstart jnlp文件。螞蟻replacetoken與多個jar文件名
它取代像@標題和@這樣的令牌從一個模板文件:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="@[email protected]">
<information>
<title>@[email protected]</title>
</information>
<resources>
@[email protected]
</resources>
<application-desc main-class="@[email protected]"/>
</jnlp>
的問題是,我在我的lib /目錄許多罐子: Log4J.jar,xpp.jar,資源。罐... 和1個罐子令牌。
如何將jars @令牌替換爲jars文件名? 使輸出變爲:
<resources>
<jar href="log4J.jar"/>
<jar href="xpp.jar"/>
<jar href="resources.jar"/>
</resources>
這是我的螞蟻項目的一部分:
<target name="webstart" description="Deploy as jnlp webstart">
<copy file="template.jnlp" tofile="test.jnlp">
<filterchain>
<replacetokens>
<token key="codebase" value="myCodebase" />
<token key="title" value="myTitle" />
<token key="jars" value="jar href="xxx.jar" />
</replacetokens>
</filterchain>
</copy>
</target>
<project/>
這似乎是方法的一部分,我認爲他需要的財產內容進行分析動態根據文件集。 – oers 2012-03-21 13:53:33
是的,動態地,我發現pathconvert在這裏[鏈接](http://stackoverflow.com/questions/1978866/is-it-possible-to-replace-text-in-properties-in-ants-build-xml) 並能夠替換 <來自= 「$ lib.dir」 來= replacestring 「< A HREF = "」 filtermapper> 但我將如何替換元素結束「/>」 – Stefan 2012-03-21 14:46:30