I am using zipgroupfileset to bundle all jars from lib folder to include in my executable application jar file.
<zipgroupfileset dir="${lib.dir}" />
Jars must be getting included in some default order. I want to alter this default order.
A note on why I want this: my Java desktop application uses many third party jars which are included in class path. When I run my code through Eclipse it works fine. But when I build the jar file using ANT it doesn't work as expected. I am sure it is related to jar sequence in classpath as if I change jar order in Eclipse it fails there as well.
Note: I am using Eclipse Kepler, Java 7, Ant 1.8.
Finally I got the solution. I build the Jar after altering my ANT file. Now my ANT build includes 3rd party APIs explicitly in classpath and that was the key to the solution.
<property name="lib.dir" value="lib" />
<manifestclasspath property="jar.classpath" jarfile="${lib.dir}/*.jar">
<classpath refid="project.class.path"/>
</manifestclasspath>
<jar destfile="${jar.dir}/${jar.name}">
<fileset dir="${class.root}" includes="**/*.*" />
<manifest>
<attribute name="Main-Class" value="${Main-Class}" />
<attribute name="Class-Path" value="${jar.classpath}" />
</manifest>
</jar>
Previously I had class-path entry in ANT as follows:
<attribute name="Class-Path" value="." />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.