<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Spackos62-Java Blog &#187; ant</title>
	<atom:link href="http://java.randgestalten.de/index.php/tag/ant/feed/" rel="self" type="application/rss+xml" />
	<link>http://java.randgestalten.de</link>
	<description>java related stuff</description>
	<lastBuildDate>Fri, 02 Oct 2009 02:08:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Get the current SVN revision number in from Ant</title>
		<link>http://java.randgestalten.de/index.php/2009/05/get-the-current-svn-revision-number-in-from-ant/</link>
		<comments>http://java.randgestalten.de/index.php/2009/05/get-the-current-svn-revision-number-in-from-ant/#comments</comments>
		<pubDate>Thu, 14 May 2009 14:06:46 +0000</pubDate>
		<dc:creator>Thasso</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://java.randgestalten.de/?p=119</guid>
		<description><![CDATA[Another minor Problem I struggled with the last couple times I was updating one of my build scripts was resolving the current SVN revision number from within ant. Google points out a few solutions,  but most of them require optional SVN tasks or do an exec. Someone (sorry, I would put a link if [...]]]></description>
			<content:encoded><![CDATA[<p>Another minor Problem I struggled with the last couple times I was updating one of my build scripts was resolving the current SVN revision number from within ant. Google points out a few solutions,  but most of them require optional SVN tasks or do an exec. Someone (sorry, I would put a link if I could remember) came up with the simple solution of using the stored SVN information from the filesystem. So:</p>
<pre>
<code>    &lt;loadfile property="svn.revision" srcFile="./.svn/entries"&gt;
        &lt;filterchain&gt;
        &lt;headfilter lines="1" skip="3"/&gt;
        &lt;deletecharacters chars="\n"/&gt;
        &lt;/filterchain&gt;
   &lt;/loadfile&gt;</code>
</pre>
<p>loads the current revision number into a property called <code>svn.revision</code>. I use this with svn 1.4 and 1.5 repositories and it works just fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://java.randgestalten.de/index.php/2009/05/get-the-current-svn-revision-number-in-from-ant/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>combine multiple jar files and remove signatures</title>
		<link>http://java.randgestalten.de/index.php/2008/10/combine-multiple-jar-files-and-remove-signatures/</link>
		<comments>http://java.randgestalten.de/index.php/2008/10/combine-multiple-jar-files-and-remove-signatures/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 22:56:48 +0000</pubDate>
		<dc:creator>Thasso</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[jar]]></category>
		<category><![CDATA[signature]]></category>

		<guid isPermaLink="false">http://java.randgestalten.de/?p=65</guid>
		<description><![CDATA[I just came across a situation where I had to join multiple jar files and my own classes into one jar bundle. Ant comes in handy:

&#60;jar destfile="${app.id}-${app.version}.jar"
  index="true"
  filesetmanifest="merge"&#62;
  &#60;fileset dir="${classes.dir}"/&#62;
  &#60;zipgroupfileset dir="${lib.dir}" includes="*.jar" /&#62;
&#60;/jar&#62;

This takes all the files in ${classes.dir}, packs them in a jar and add the content of [...]]]></description>
			<content:encoded><![CDATA[<p>I just came across a situation where I had to join multiple jar files and my own classes into one jar bundle. Ant comes in handy:</p>
<pre>
<code>&lt;jar destfile="${app.id}-${app.version}.jar"
  index="true"
  filesetmanifest="merge"&gt;
  &lt;fileset dir="${classes.dir}"/&gt;
  &lt;zipgroupfileset dir="${lib.dir}" includes="*.jar" /&gt;
&lt;/jar&gt;</code>
</pre>
<p>This takes all the files in <code>${classes.dir}</code>, packs them in a jar and add the content of all the jar files in <code>${lib.dir}</code>. In this case, we merge multiple manifests, but this can be changed according to the jar <a href="http://ant.apache.org/manual/CoreTasks/jar.html">task documentation</a>.<br />
<span id="more-65"></span><br />
This works as long as none of your files is signed. You know that you are in trouble when you get messages like</p>
<pre>
<code>java.lang.SecurityException: no manifiest section for signature file entry ....</code>
</pre>
<p>I found a solution <a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&#038;f=65&#038;t=000103">here</a>, and the say that one has to remove the SUN_MICR files. This can be done manually, but keep it in mind when ever you update your libraries. I find it more elegant when ant just removes the files. Unfortunately it is to possible to specify excludes for zipgroupfileset. The alternative to zipgroupfileset is zipfileset, which allows exclude patterns and extraction of zip files via the src parameter. And thats the problem. You can only specify exactly one file as src. I don&#8217;t want to specify all my jars manually. Therefore I creates a single jar first, using zipgroupfileset and then move this file through a zip/zipfileset where we can exclude specific files. </p>
<pre>
<code>&lt;jar destfile="${app.id}-${app.version}.jar"
  index="true"
  filesetmanifest="merge"&gt;
  &lt;fileset dir="${classes.dir}"/&gt;
  &lt;zipgroupfileset dir="${lib.dir}" includes="*.jar" /&gt;
&lt;/jar&gt;
&lt;zip destfile="temp-jar-file.jar"&gt;
  &lt;zipfileset src="${app.id}-${app.version}.jar" excludes="META-INF/*.RSA, META-INF/*.DSA, META-INF/*.SF" /&gt;
&lt;/zip&gt;
&lt;move file="temp-jar-file.jar" tofile="${app.id}-${app.version}.jar"/&gt;</code>
</pre>
<p>You end up with a single, signature free jar file. This is not the most elegant solution, which would be either to enable multiple src files in zipfileset or an excludes parameter for zipgroupfileset that matches against the content of files, not the input files. But still, its small and does not need any third party ant tasks. </p>
]]></content:encoded>
			<wfw:commentRss>http://java.randgestalten.de/index.php/2008/10/combine-multiple-jar-files-and-remove-signatures/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ANT build.xml template</title>
		<link>http://java.randgestalten.de/index.php/2008/10/ant-buildxml-template/</link>
		<comments>http://java.randgestalten.de/index.php/2008/10/ant-buildxml-template/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 09:37:02 +0000</pubDate>
		<dc:creator>Thasso</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[ant]]></category>

		<guid isPermaLink="false">http://java.randgestalten.de/?p=56</guid>
		<description><![CDATA[Just that I have it at one place. This is my ant build.xml template. It assumes a simple project structure:

src/ - all java soources in here
lib/
  devel/ - development libraries
  runtime/ - runtime libraries

If your project follows this struicture, you can get the following tasks out of the box:

Buildfile: build.xml

Main targets:

 clean  [...]]]></description>
			<content:encoded><![CDATA[<p>Just that I have it at one place. This is my ant build.xml template. It assumes a simple project structure:</p>
<pre>
src/ - all java soources in here
lib/
  devel/ - development libraries
  runtime/ - runtime libraries
</pre>
<p>If your project follows this struicture, you can get the following tasks out of the box:</p>
<pre>
Buildfile: build.xml

Main targets:

 clean          Clean
 compile        Compile all source files
 compile-tests  Compile all source files
 dist           Build library and pack jar file
 dist-one       Build library and pack jar file
 doc            Create Javadoc
 html-reports   Creates HTML from test reports
 test           Run JUnit Tests
Default target: dist
</pre>
<p>You can modify the properties to adapt different names or a different project structure. The script creates a <code>target</code> directory that contains the results.</p>
<p>Compiling and packing should work out of the box, but the test sections expects a junit and ant-junit jars  in <code>lib/devel</code>. They can also be placed in one of Ants lib directories.</p>
<p><a href="http://java.randgestalten.de/files/build.xml">The build file</a></p>
]]></content:encoded>
			<wfw:commentRss>http://java.randgestalten.de/index.php/2008/10/ant-buildxml-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
