2011-08-24 5 views
6

私は冗長モードで1.8.0を実行しています。 Implementation-Title、-Version、および-Vendorを含むマニフェストを作成しました。その結果のJARには、マニフェストが含まれています。 JARのクラスは正常に動作します。しかし、アリからの出力は、ant claim実装 - タイトル/バージョン/ベンダーが設定されていないが、それらは

[jar]いいえ実装 - タイトルセット。いいえ実装バージョンセット。実装ベンダーセットはありません。

これはちょうどアリのバグですか、私はここに何か不足していますか?ここで

おかげ

は私のアリコードです:

<?xml version="1.0" encoding="UTF-8"?> 
<project name="helloworld.makejar" default="makejar" basedir="."> 
    <target name ="makejar" description="Create a JAR for the HelloWorld project"> 
    <delete file="helloworld.jar" /> 
    <delete file="MANIFEST.MF" /> 

    <manifest file="MANIFEST.MF"> 
     <attribute name="Built-By" value="${user.name}" /> 
     <attribute name="Main-Class" value="project.builder.example.HelloWorld" /> 
     <section name="common"> 
     <attribute name="Specification-Title" value="Example" /> 
     <attribute name="Specification-Version" value="1.0.0" /> 
     <attribute name="Specification-Vendor" value="Example Organization" /> 
     <attribute name="Implementation-Title" value="common" /> 
     <attribute name="Implementation-Version" value="1.0.0 today" /> 
     <attribute name="Implementation-Vendor" value="Acme Corp." /> 
     </section> 
    </manifest> 

    <jar jarfile="helloworld.jar" 
     includes="**/*.class" 
     basedir="bin" 
     manifest="MANIFEST.MF" 
    /> 
    </target> 
    <javac srcdir="src" destdir="bin" /> 
</project> 
+0

マニフェストはどのように作成していますか?あなたは手でそれを作成しましたか、Antのjarタスクのマニフェストのネストされた要素を使用していますか?マニフェストファイルの内容を投稿できますか? –

+0

ありがとう、ケビン。私は自分のantコードを追加して、マニフェストがどのように作成され消費されているかを見ることができます。 –

答えて

4

私はこの問題は、ネストされたセクションの子供であることとは対照的に、属性は、マニフェスト要素の子として定義されなければならないということだと思います。たぶん違いになるだろうインラインマニフェスト要素を使用して更新

。次のスニペットはAntのドキュメントです:

<jar destfile="test.jar" basedir="."> 
    <include name="build"/> 
    <manifest> 
     <!-- Who is building this jar? --> 
     <attribute name="Built-By" value="${user.name}"/> 
     <!-- Information about the program itself --> 
     <attribute name="Implementation-Vendor" value="ACME inc."/> 
     <attribute name="Implementation-Title" value="GreatProduct"/> 
     <attribute name="Implementation-Version" value="1.0.0beta2"/> 
     <!-- details --> 
     <section name="common/MyClass.class"> 
      <attribute name="Sealed" value="false"/> 
     </section> 
    </manifest> 
</jar> 
+0

セクション階層を削除しても問題は解決されませんでした。さらに、私はこれがコマンドラインからうまくいかないことを観察します。おそらくこれはEclipseを実行するAntの特異性ですか? –

+0

別のマニフェスト要素ではなく、jarタスクでインラインマニフェスト要素を使用することも違いがあります。回答は上記のとおりです。 –

+0

ビンゴ!それはEclipseで動作します。ありがとう。 –

関連する問題