我在 Eclipse 中有一个项目,它使用 ant 来编译和 jar 类文件和引用的 jar。使用eclipse中默认java builder生成的class文件生成的jar文件工作正常,但是使用ant编译源码然后jar结果时,报错“错误:尝试打开文件时发生意外错误... ....jar" 在目标构建上执行 java -jar 时产生结果。有谁知道我做错了什么?下面是构建 xml 内容。这是我传递给 ant 的论点
-DInTouchV.SrcPath=${InTouchV.SrcPath} -DInTouchV.DropPath=${workspace_loc:/InTouchVTransferService/dist}
<project default="create_run_jar" name="Create Runnable Jar for Project InTouchVTransferService">
<!--this file was created by Eclipse Runnable JAR Export Wizard-->
<!--ANT 1.7 is required -->
<property name="Version" value="1.3"></property>
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<target name="Compile_Source">
<javac srcdir="${InTouchV.SrcPath}/InTouchVTransferService/src"
destdir="${InTouchV.SrcPath}/InTouchVTransferService/bin"
classpath="${InTouchV.SrcPath}/lib/AtomClasses.jar"
debug="on"
includeantruntime="yes"
/>
</target>
<target name="create_run_jar">
<mkdir dir="${InTouchV.SrcPath}/InTouchVTransferService/bin"/>
<jar destfile="${InTouchV.DropPath}/InTouchVTransferClient.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="com.emdat.inTouchV.main.Main"/>
<attribute name="Class-Path" value="."/>
<section name="common">
<attribute name="Build-Version" value="${Version}"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="JVM Version" value="${java.runtime.name} - ${java.runtime.version}" />
</section>
</manifest>
<fileset dir="${InTouchV.SrcPath}/InTouchVTransferService/bin"/>
<zipfileset excludes="META-INF/*.SF" src="${InTouchV.SrcPath}/lib/AtomClasses.jar"/>
</jar>
<touch file="${InTouchV.DropPath}/Version.txt" />
<echo file="${InTouchV.DropPath}/Version.txt">${Version}</echo>
</target>
</project>