File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes creating jar for specific files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "creating jar for specific files" Watch "creating jar for specific files" New topic

creating jar for specific files

Eshwin Sukhdeve
Ranch Hand

Joined: Mar 15, 2012
Posts: 90
I have one lib folder in this folder it contains java files are there.i need to create the jar file for this java classes.this folder
contains one java file.I dont want to make that class as a part of jar file.

<target name="mainjar" depends="compile">
<jar destfile="ProjectSonnetTest\src\mainProject.jar"
basedir="ProjectSonnetTest\src\src\lib" excludes="ProjectSonnetTest\src\lib\">
here I am dont want to make as a part fo jar file.
I am using this code.but it is creating the jar file for all java classes which is inside the src folder.

Peter Johnson

Joined: May 14, 2008
Posts: 5852

Try using this instead:


or even this:


Also, never use back-slashes (\) in ant scripts - they are too often interpreted as as escape characters.

JBoss In Action
I agree. Here's the link:
subject: creating jar for specific files
It's not a secret anymore!