Exclude Jar from Ant Build using zipgroupfileset
问题 I have created a Jar Project which contains Filter . I need to use servlet-api.jar when I compile the Filter code. But when I want to use the Jar in another application, I want to build the jar in such a way that it will exclude servlet-api.jar . I am using Apache Ant with NetBeans 8: I have added below code in build.xml . <target name="-post-jar"> <jar destfile="dist/MyJar.jar"> <zipfileset src="dist/MyJarAsLibrary.jar"/> <zipgroupfileset dir="dist/lib/." excludes="javax/*"/> </jar> </target