<?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>Markus' Blog &#187; Maven</title>
	<atom:link href="http://markus.heberling.net/lang/en/tag/maven/feed/" rel="self" type="application/rss+xml" />
	<link>http://markus.heberling.net</link>
	<description>Dies und Das und Jenes</description>
	<lastBuildDate>Mon, 31 May 2010 15:12:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using Maven2 to build Cydia Packages for the iPhone</title>
		<link>http://markus.heberling.net/lang/en/2008/08/31/using-maven2-to-build-cydia-packages-for-the-iphone</link>
		<comments>http://markus.heberling.net/lang/en/2008/08/31/using-maven2-to-build-cydia-packages-for-the-iphone#comments</comments>
		<pubDate>Sun, 31 Aug 2008 16:30:48 +0000</pubDate>
		<dc:creator>Markus</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://markus.heberling.net/?p=35&amp;lang=de</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><span lang="en">I am using Maven2 for most Java projects. So I wanted to use it for Phone-Java development, too. This is a little tutorial on how it can be done.</span></p>
<p><span lang="en">iPhone Cydia Packages are Debian .deb files really and luckily there is the <a href="http://wiki.evolvis.org/mvn-pkg-plugin/index.php/Main_Page">mvn-pkg-plugin</a>&nbsp;that supports creating .deb files with Maven2. Unfortunatly the current version has a <a href="http://evolvis.org/tracker/index.php?func=detail&amp;aid=186&amp;group_id=30&amp;atid=169">bug</a>, so that it won&#8217;t work out of the box for creating iPhone packages. So you have to grab the latest svn-snapshot and apply the following patch.</span></p>
<p> <br />
<span lang="en"></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p35code1'); return false;">View Code</a> DIFF</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p351"><td class="code" id="p35code1"><pre class="diff" style="font-family:monospace;">Index: src/main/java/de/tarent/maven/plugins/pkg/map/Parser.java
===================================================================
<span style="color: #888822;">--- src/main/java/de/tarent/maven/plugins/pkg/map/Parser.java	<span style="">&#40;</span>revision <span style="">132</span><span style="">&#41;</span></span>
<span style="color: #888822;">+++ src/main/java/de/tarent/maven/plugins/pkg/map/Parser.java	<span style="">&#40;</span>working copy<span style="">&#41;</span></span>
<span style="color: #440088;">@@ -<span style="">62</span>,<span style="">7</span> +<span style="">62</span>,<span style="">7</span> @@</span>
&nbsp;
       if <span style="">&#40;</span>auxMapDocument != null<span style="">&#41;</span>
         <span style="">&#123;</span>
<span style="color: #991111;">-          s = new State<span style="">&#40;</span>packageMapDocument<span style="">&#41;</span>;</span>
<span style="color: #00b000;">+          s = new State<span style="">&#40;</span>auxMapDocument<span style="">&#41;</span>;</span>
&nbsp;
           s.nextMatch<span style="">&#40;</span>&quot;package-maps&quot;<span style="">&#41;</span>;
           parsePackageMaps<span style="">&#40;</span>s<span style="">&#41;</span>;</pre></td></tr></table></div>

<p></span><br />
 </p>
<p><span lang="en">After applying the atch and doing a &#8220;mvn install&#8221;, we can start with the real work. Download the tutorial files from&nbsp;<a href="http://markus.heberling.net/wp-uploads/2008/08/hellomaven.zip">here</a>. I will explain the contents of the archive later. For now unzip it and do a &#8220;mvn package&#8221; in its directory. It will compain about some missing dependencies, so grab the missing jars from your iPhone and install them in your Maven reposiory as directed in the error message. After you have done that another &#8220;mvn package&#8221; shoud produce a .deb file in the target subdirectory. You can upload this to your iphone and install it with dpkg. After a restart of the SpringBoard a new icon HelloMaven should be on your screen, that should start the demo program.</span></p>
<p><span lang="en">Now some explanation of how it works. The main part is done in the pom.xml. Here is the relavant excerpt form this file:</span><br />
<span lang="en"></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p35code2'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p352"><td class="code" id="p35code2"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>de.tarent.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-pkg-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;defaultDistro<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>iphoneos<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/defaultDistro<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;shortDescription<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Arindal Tune Helper<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/shortDescription<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;defaults<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mainClass<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>HelloJava<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mainClass<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;section<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>example<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/section<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;architecture<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>iphoneos-arm<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/architecture<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;datadir<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/Applications/HelloMaven.app
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/datadir<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dataFiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dataFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;from<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Info.plist<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/from<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dataFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dataFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;from<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>icon.png<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/from<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dataFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dataFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;from<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Starter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/from<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dataFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dataFiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;postinstScript<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>postInst.sh<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/postinstScript<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;prermScript<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>preRm.sh<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/prermScript<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/defaults<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;auxPackageMapURL<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>file:${basedir}/pm-iphoneos.xml
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/auxPackageMapURL<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>package<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>pkg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p></span><br />
<span lang="en">The first important part is the defaultDistro tag. Here we tell the plugin, that we want to build a package for the iPhone. Unfortunatly there are no default iPhone mappings contained in the plugin. That is why we have the auxPackageMapURL tag, that tells the plugin where to look for the Maven-to-Cydia-Package-Mapping. Most other things should be pretty self explaining.</span></p>
<p><span lang="en">The files in the dataFiles Section have to reside in src/main/auxfiles icon.png and Info.plist should be pretty clear. The Starter entry needs some explanation though. The plugin automatically generates a start script in /usr/bin. This is good enough for console applications, but if you want to start a GUI-App some more work is needed. The Starter script sets the Java executable path to /Applications/Appname.app/Java and calls the generated script after that. For this to work the starter Script has to get executable permissions and jamvm has to be linked to /Applications/Appname.app/Java. This is done in the postInst.sh script. For more info about those scripts and what you can do there refer to the Debian documentation.</span></p>
<p><span lang="en">This should be enough to get you started, if cou have questions, please feel free to post them in the comments.</span></p>
<script type="text/javascript">
var flattr_wp_ver = '0.9.2';
var flattr_uid = '11334';
var flattr_url = 'http://markus.heberling.net/lang/en/2008/08/31/using-maven2-to-build-cydia-packages-for-the-iphone';
var flattr_btn = 'compact';
var flattr_hide = 0;
var flattr_lng = '';
var flattr_cat = 'text';
var flattr_tle = 'Using Maven2 to build Cydia Packages for the iPhone';
var flattr_dsc = 'I am using Maven2 for most Java projects. So I wanted to use it for Phone-Java development, too. This is a little tutorial on how it can be done.  iPhone Cydia Packages are Debian .deb files really and luckily there is the mvn-pkg-plugin&nbsp;that supports creating .deb files with Maven2. Unfortunatly the current version has a bug, so that it won\'t work out of the box for creating iPhone packages. So you have to grab the latest svn-snapshot and apply the following patch.    Index: src/main/java/de/tarent/maven/plugins/pkg/map/Parser.java =================================================================== --- src/main/java/de/tarent/maven/plugins/pkg/map/Parser.java	(revision 132) +++ src/main/java/de/tarent/maven/plugins/pkg/map/Parser.java	(working copy) @@ -62,7 +62,7 @@         if (auxMapDocument != null)          { -          s = new State(packageMapDocument); +          s = new State(auxMapDocument);             s.nextMatch(\"package-maps\");            parsePackageMaps(s);    After a';
</script>
<script src="http://api.flattr.com/button/load.js?v=0.2" type="text/javascript"></script>]]></content:encoded>
			<wfw:commentRss>http://markus.heberling.net/lang/en/2008/08/31/using-maven2-to-build-cydia-packages-for-the-iphone/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
