ant task to remove files from a jar

Have you tried using the zipfileset task? <jar destfile=”stripped.jar”> <zipfileset src=”full.jar” excludes=”files/to/exclude/**/*.file” /> </jar> Example <property name=”library.dir” value=”dist” /> <property name=”library.file” value=”YourJavaArchive.jar” /> <property name=”library.path” value=”${library.dir}/${library.file}” /> <property name=”library.path.new” value=”${library.dir}/new-${library.file}” /> <target name=”purge-superfluous”> <echo>Removing superfluous files from Java archive.</echo> <jar destfile=”${library.path.new}”> <zipfileset src=”${library.path}” excludes=”**/ComicSans.ttf” /> </jar> <delete file=”${library.path}” /> <move file=”${library.path.new}” tofile=”${library.path}” /> </target>

How can I allow an Ant property file to override the value set in another?

The initial problem with your set up is that you’ve got build.properties and build-defaults.properties reversed. Ant Properties are set once and then can never be overridden. That’s why setting any property on the command line via a -Dproperty=value will always override anything you’ve set in the file; the property is set and then nothing can … Read more

Create cross platform Java SWT Application

I’ve just run into the same problem. I haven’t tried it yet, but I plan to include versions of swt.jar for all platforms and load the correct one dynamically in the start of the main method. UPDATE: It worked. build.xml includes all jars: <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_linux_gtk_x86.jar”/> <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_macosx_x86.jar”/> <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_win32_x86.jar”/> <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_linux_gtk_x64.jar”/> … Read more

How to call for a Maven goal within an Ant script?

Since none of the solutions worked for me, this is what I came up with: Assuming you are running on Windows: <target name=”mvn”> <exec dir=”.” executable=”cmd”> <arg line=”/c mvn clean install” /> </exec> </target> or on UNIX: <target name=”mvn”> <exec dir=”.” executable=”sh”> <arg line=”-c ‘mvn clean install'” /> </exec> </target> or if you want it … Read more

How do I check out an SVN project into Eclipse as a Java project?

Here are the steps: Install the subclipse plugin (provides svn connectivity in eclipse) and connect to the repository. Instructions here: http://subclipse.tigris.org/install.html Go to File->New->Other->Under the SVN category, select Checkout Projects from SVN. Select your project’s root folder and select checkout as a project in the workspace. It seems you are checking the .project file into … Read more