2016-09-20 16 views
0

私は非常にantタスクに慣れています。私はこれまでいくつかの引数でexecを呼び出すことができました。今はMETA-IF/MANIFEST.MFファイルからバージョンを読み込もうとしていますこのファイルのImplementation-Versionプロパティを持つexec(これはプロジェクトのバージョン管理されたセットアップを作成するためのものです)。 これまでのところ、プロパティを置き換える方法や、jarファイルからの読み込み方法は見つけられませんでしたが、MANIFEST.MFファイルからではなく、読み込みプロパティを後でantタスクのvarとして使用します。事前に 感謝:)Antタスク:読み込みとユーザーマニフェストの実装のバージョン

+0

あなたはこの質問の答えを参照することができます。http://stackoverflow.com/q/5313438 –

答えて

1

あなたは、ネストされたFilterChain秒で、loadfileタスクを使用することができます。

<loadfile property="implementation.version" srcFile="MANIFEST.MF"> 
    <filterchain> 
     <!-- following filter tokenize input file and return only 
      the lines that match the pattern. Matched string is 
      replaced by an empty string to get only the value of the 
      manifest property. 
     --> 
     <tokenfilter> 
      <containsregex pattern="Implementation-Version:[ \t]*" replace="" flags="i"/> 
     </tokenfilter> 
    </filterchain> 
</loadfile> 
<!-- now 'implementation.version' contains the rest of the line that was matching the regex --> 
<echo>Implementation version is ${implementation.version}</echo> 
+0

作品ありがとう! – n0xew

関連する問題