2017-03-21 6 views

答えて

0

マニフェストのクラスパスは、外部のjarファイルを参照し、jarファイルの中に入れたクラスは参照しません。

次は私が隣接する「LIB」ディレクトリの中に私のjarファイルの依存関係を配置し、JARマニフェストに入る文字列を構築するためにANT manifestclasspathタスクを使用するためにツタを使用する方法のサンプルです:

<target name="build" depends="compile"> 
    <ivy:retrieve pattern="${dist.dir}/lib/[artifact].[ext]"/> 

    <manifestclasspath property="jar.classpath" jarfile="${dist.jar}"> 
     <classpath> 
     <fileset dir="${dist.dir}/lib" includes="*.jar"/> 
     </classpath> 
    </manifestclasspath> 

    <jar destfile="${dist.jar}" basedir="${build.dir}/classes"> 
     <manifest> 
     <attribute name="Main-Class" value="${dist.main.class}"/> 
     <attribute name="Class-Path" value="${jar.classpath}"/> 
     </manifest> 
    </jar> 
    </target> 
ツタファイルやユニットテストを含め、より詳細な例については

は、以下を参照してください。

関連する問題