Reputation: 269
I want to pack jar file without containing depedency jar libraries using eclipse IDE. I used these steps to pack but the result jar file always contains jar libraries. Some steps I did
Jar file I want to pack is jar library not runable jar file
Thanks
Upvotes: 2
Views: 3575
Reputation: 1873
I would use an ant task...
<zip destfile="${backupJar}" update="true" basedir="${basedir}/../../"
includes="**/*.xml*, **/*.java"
compress="true"/>
Remember that a jar is really a zip file with a different extension.
See
http://ant.apache.org/manual/Tasks/zip.html
EDIT: you specifically asked how to ignore dependencies. This is achieved by using the excludes attribute of the zip task, for example:
<zip destfile="${backupJar}" update="true" basedir="${remotedir}/../"
excludes="**/lib/testonly.zip,
**/lib/ms*.jar,
**/*.tmp"
includes="exported/**/*.*, exported/jf123/**/*.*" compress="true"/>
Upvotes: 1
Reputation: 7804
In eclipse, when you are creating a jar file, select option named 'JAR file' and not 'Runnable JAR'. When you click on next, you will get a list of items which you need to include while creating your jar file with a check box in front of each item. Just don't select the items you don't want to export (in your case dependent libraries).
Hope this helps.
Upvotes: 2