<?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>Shaun Abram</title>
	<atom:link href="http://www.shaunabram.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shaunabram.com</link>
	<description>Java and Technology weblog</description>
	<lastBuildDate>Fri, 06 Apr 2012 15:57:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>First experiment with Cloud Foundry</title>
		<link>http://www.shaunabram.com/cloud-foundry-first-experiment/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cloud-foundry-first-experiment</link>
		<comments>http://www.shaunabram.com/cloud-foundry-first-experiment/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 22:27:52 +0000</pubDate>
		<dc:creator>sabram</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[charity]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[cloudfoundry]]></category>
		<category><![CDATA[givecamp]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=1582</guid>
		<description><![CDATA[I&#8217;m at a Cloud Foundry conference today. Cloud Foundry is an open source &#8220;cloud&#8221; platform as a service (PaaS). I decided to dive in and try to deploy the server we developed at GiveCamp last week for the &#8216;Big Brothers and Big Sisters&#8217; charity project. I started by mavenizing the project, so I had a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m at a Cloud Foundry <a href="opentour.cloudfoundry.com/2012/sanfrancisco">conference</a> today. Cloud Foundry is an open source &#8220;cloud&#8221; platform as a service (PaaS). </p>
<p>I decided to dive in and try to deploy the server we developed at <a href="http://centralcalgivecamp.blogspot.com/p/home.html">GiveCamp</a> last week for the &#8216;Big Brothers and Big Sisters&#8217; charity project. I started by mavenizing the project, so I had a war to deploy.</p>
<p>Then, I created a free Cloud Foundry account, installed their &#8216;vmc&#8217; command line tool and ran the &#8216;vmc push&#8217; command to deploy my way to the cloud. And it worked straight off! Don&#8217;t you just love it when tools just work?</p>
<p>Our webservice is now running on a remote server that can be accessed by the iPhone and Android apps the team is developing. We still have some database work to complete, but this feels like a nice step forward.</p>
<p>In the mean time, I am now officially a Cloud Foundry fan&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/cloud-foundry-first-experiment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Central California GiveCamp Review</title>
		<link>http://www.shaunabram.com/central-california-givecamp-review/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=central-california-givecamp-review</link>
		<comments>http://www.shaunabram.com/central-california-givecamp-review/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 04:54:25 +0000</pubDate>
		<dc:creator>sabram</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[charity]]></category>
		<category><![CDATA[givecamp]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=1578</guid>
		<description><![CDATA[Had a great weekend at the Central California GiveCamp in Fresno this weekend. I joined the Big Brothers and Big Sisters team, working on a mobile app (Android &#038; iPhone). I helped out on the server &#038; database side where we created a Java WebService talking JSON, with a MySQL database. Most of the team [...]]]></description>
			<content:encoded><![CDATA[<p>Had a great weekend at the <a href="http://centralcalgivecamp.blogspot.com/p/home.html">Central California GiveCamp</a> in Fresno this weekend. I joined the Big Brothers and Big Sisters team, working on a mobile app (Android &#038; iPhone). I helped out on the server &#038; database side where we created a Java WebService talking JSON, with a MySQL database. Most of the team were from <a href="http://www.csufresno.edu/fresnostate/">Fresno State</a>. Still some work do to deploying the solution to the cloud, but we made good progress.</p>
<p>It was a really enjoyable weekend, and all for a good cause. Thanks to Walt Read and Iran Rodrigues for setting up and running it all so smoothly, and Dr Alex Liu from Fresno State for organizing the team&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/central-california-givecamp-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GitHub SSH key audit</title>
		<link>http://www.shaunabram.com/github-ssh-key-audit/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=github-ssh-key-audit</link>
		<comments>http://www.shaunabram.com/github-ssh-key-audit/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 21:09:16 +0000</pubDate>
		<dc:creator>sabram</dc:creator>
				<category><![CDATA[Products]]></category>
		<category><![CDATA[github]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=1574</guid>
		<description><![CDATA[Got this error recently when trying to do a fetch from github in Intellij: fatal: The remote end hung up unexpectedly ERROR: Hi sabram, it&#8217;s GitHub. We&#8217;re doing an SSH key audit. Vague error but finally figured out that it is related to Github&#8217;s recent security compromise and that I needed to verify my SSH [...]]]></description>
			<content:encoded><![CDATA[<p>Got this error recently when trying to do a fetch from github in Intellij:</p>
<blockquote><p>fatal: The remote end hung up unexpectedly<br />
ERROR: Hi sabram, it&#8217;s GitHub. We&#8217;re doing an SSH key audit.</p></blockquote>
<p>Vague error but finally figured out that it is related to Github&#8217;s <a href="https://github.com/blog/1068-public-key-security-vulnerability-and-mitigation">recent security compromise</a> and that I needed to <a href="https://github.com/settings/ssh/audit">verify my SSH keys</a>. </p>
<p>Couldn&#8217;t find much about the error on Google, so maybe this post will help someone else!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/github-ssh-key-audit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Going to Central California GiveCamp</title>
		<link>http://www.shaunabram.com/central-california-givecamp/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=central-california-givecamp</link>
		<comments>http://www.shaunabram.com/central-california-givecamp/#comments</comments>
		<pubDate>Fri, 23 Mar 2012 01:02:25 +0000</pubDate>
		<dc:creator>sabram</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[OpenSource]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=1570</guid>
		<description><![CDATA[Heading to Central California GiveCamp tomorrow for a weekend of coding for charitable causes. Should be fun!]]></description>
			<content:encoded><![CDATA[<p>Heading to <a href="http://centralcalgivecamp.blogspot.com/p/home.html">Central California GiveCamp</a> tomorrow for a weekend of coding for charitable causes. Should be fun! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/central-california-givecamp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Steve Jobs quote</title>
		<link>http://www.shaunabram.com/steve_jobs_quote/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=steve_jobs_quote</link>
		<comments>http://www.shaunabram.com/steve_jobs_quote/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 02:59:48 +0000</pubDate>
		<dc:creator>sabram</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=1564</guid>
		<description><![CDATA[Came across this quote from Steve Jobs today. Love it. Life can be much broader, once you discover one simple fact, and that is that everything around you that you call life was made up by people that were no smarter than you. And you can change it, you can influence it, you can build [...]]]></description>
			<content:encoded><![CDATA[<p>Came across this <a href="http://www.brainpickings.org/index.php/2011/12/02/steve-jobs-1995-life-failure/">quote</a> from Steve Jobs today. Love it.</p>
<blockquote><p>Life can be much broader, once you discover one simple fact, and that is that everything around you that you call life was made up by people that were no smarter than you. And you can change it, you can influence it, you can build your own things that other people can use. Once you learn that, you’ll never be the same again.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/steve_jobs_quote/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Swing, Webstart and Maven &#8211; An Example</title>
		<link>http://www.shaunabram.com/swing-webstart-maven-example/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=swing-webstart-maven-example</link>
		<comments>http://www.shaunabram.com/swing-webstart-maven-example/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 02:05:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[helloworld]]></category>
		<category><![CDATA[jnlp]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[mvn]]></category>
		<category><![CDATA[swing]]></category>
		<category><![CDATA[webstart]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=1427</guid>
		<description><![CDATA[Following my introductory rant on the subject, this post is a working example of using Swing and Webstart with a multi-module maven project. Complete source can be downloaded from here. Simplest possible example I am posting the simplest possible example I could get working. It is a grossly over-simplified example designed to focus purely on [...]]]></description>
			<content:encoded><![CDATA[<p>Following my <a href="http://www.shaunabram.com/swing-webstart-maven">introductory rant</a> on the subject, this post is a working example of using Swing and Webstart with a multi-module maven project.</p>
<p>Complete source can be downloaded from <a href="http://www.shaunabram.com/wp-content/uploads/2012/01/SwingWebstartMaven.zip">here</a>.<br />
<span id="more-1427"></span></p>
<h4>Simplest possible example</h4>
<p>I am posting the simplest possible example I could get working. It is a grossly over-simplified example designed to focus purely on getting the Swing/Webstart/Maven combination working.<br />
For example:</p>
<ul>
<li>The Swing client is the simplest possible Swing app you could possibly create (it just displays &#8216;Hello World&#8217;), since the focus is on the Swing/Webstart/Maven setup, not complex  Swing coding</li>
<li>There are very few dependencies on other projects, to keep the poms simple. Obviously real apps are likely to be much more complicated</li>
<li>The example uses just 2 maven modules (client and web) when in reality, a real enterprise project would likely have many more (e.g. client, web, service, persist). The web module in this example could act as your entry point to those other modules.</li>
</ul>
<p>Anyway, hopefully those simplifications keep the example easy to follow.</p>
<h4>Basic overview</h4>
<p>The example uses a simple 2 module (client and web) maven project, with the jnlp defined in the client module. You then need to build and deploy the artifacts (a zip containing the built jnlp bundle for the client module and a war for the web module) to a maven repository. The final piece of the puzzle is then downloading the client zip and web war to your app server of choice (e.g. tomcat). </p>
<h4>Setup</h4>
<p>Steps:</p>
<ul>
<a href="#1">
<li>1. Setup maven folder structure</li>
<p></a><br />
<a href="#2">
<li>2. Create a simple Swing app</li>
<p></a><br />
<a href="#3">
<li>3. Create web.xml file</li>
<p></a><br />
<a href="#4">
<li>4. Create the template.vm file</li>
<p></a><br />
<a href="#5">
<li>5. Create our maven poms</li>
<p></a></p>
<ul>
<a href="#5.1">
<li>5.1 Parent project pom</li>
<p></a><br />
<a href="#5.2">
<li>5.2 Create the client module&#8217;s pom</li>
<p></a><br />
<a href="#5.3">
<li>5.3 Create the webapp module&#8217;s pom</li>
<p></a>
</ul>
<p><a href="#6">
<li>6. Build, deploy and run!</li>
<p></a>
</ul>
<p>Note that the Maven project structure I am using here is (loosely) based on the <a href="http://www.sonatype.com/books/mvnex-book/reference/multimodule.html">maven multi module example</a> from the maven docs. The dir structure is just the <a href="http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html">standard maven directory layout</a>. We wont be using the test and resources folders for this simple example, but they are included as a placeholder.</p>
<p><a name="1"><br />
<h2>1. Setup maven folder structure</h2>
<p></a><br />
I don&#8217;t know of a maven archetype for creating a multi-module project, so we need to do it manually. Create the following directory structure:</p>
<pre>
SwingWebstartMaven
-SwingWebstartMaven-Client
--src
---main
----java
----jnlp
----resources
---test
--SwingWebstartMaven-Webapp
---main
----java
----resources
----webapp
-----WEB-INF
---test
</pre>
<p><a name="2"><br />
<h2>2. Create a simple Swing app</h2>
<p></a><br />
For our simple Swing app, we are using the simplest example possible &#8211; HelloWorld. This code needs to be placed in our client project, here</p>
<blockquote><p><code>SwingWebstartMaven\SwingWebstartMaven-Client\src\main\java\com\shaunabram\swingwebstartmaven\HelloWorldSwing.java</code></p></blockquote>
<pre><code>package com.shaunabram.swingwebstartmaven;

import javax.swing.JFrame;
import javax.swing.JLabel;

public class HelloWorldSwing {
  public static void main(String[] args) {
    JFrame frame = new JFrame("HelloWorldSwing");
    final JLabel label = new JLabel("Hello World");
    frame.getContentPane().add(label);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
  }
}</code></pre>
<p><a name="3"><br />
<h2>3. Create web.xml</h2>
<p></a><br />
Next, we create the simplest possible web.xml i.e. an empty one. For this example, we just need the webapp to serve our jnlp file (and associated jars). In a real application, the web module would be the interface your your server. For example, you might use <a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/remoting.html#remoting-httpinvoker">Spring Remoting and HTTP invokers</a> to allow your Swing client to communicate with a service layer via your web module.</p>
<blockquote><h5>JnlpDownladServlet</h5>
<p>Note that our example does not use the JnlpDownloadServlet, purely to keep the example as simple as possible. You however, may want to configure our webapp&#8217;s web.xml to use the JnlpDownladServlet as it adds some extra benefits such as allowing you to use $$codebase instead of having to maintain hardcoded project URLs (e.g. the template.vm file in the next section would benefit from its use as it contains a hardcoded url). See some background info on the JnlpDownloadServlet <a href="http://docs.oracle.com/javase/1.5.0/docs/guide/javaws/developersguide/downloadservletguide.html">here</a>, and notes on how to configure your webapp to use JnlpDownloadServlet <a href="http://mojo.codehaus.org/webstart/webstart-maven-plugin/jnlp101.html">here</a>.</p></blockquote>
<p>Your web.xml should look something like below.<br />
This file will be located here: </p>
<blockquote><p><code>SwingWebstartMaven\SwingWebstartMaven-Webapp\src\main\webapp\WEB-INF\web.xml</code></p></blockquote>
<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd"&gt;
&lt;web-app&gt;

&lt;/web-app&gt;</code></pre>
<p><a name="4"><br />
<h2>4. Create the template.vm file</h2>
<p></a><br />
Next, create the template.vm file. This file is the template used to generate the jnlp file.<br />
This file will be located here: </p>
<blockquote><p><code>SwingWebstartMaven\SwingWebstartMaven-Webapp\src\main\jnlp\template.vm</code></p></blockquote>
<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;jnlp spec="1.0+" codebase="http://localhost:8080/SwingWebstartMaven-Web/webstart" href="$outputFile"&gt;
 &lt;information&gt;
    &lt;title&gt;Swing Webstart Maven Project&lt;/title&gt;
    &lt;vendor&gt;ShaunAbram&lt;/vendor&gt;
 &lt;/information&gt;
 &lt;security&gt;
 &lt;all-permissions/&gt;
 &lt;/security&gt;
 &lt;resources&gt;
    &lt;j2se version="1.5+" initial-heap-size="32m" max-heap-size="128m" /&gt;
    &lt;property name="jnlp.versionEnabled" value="false"/&gt;
    $dependencies
 &lt;/resources&gt;
 &lt;application-desc main-class="$mainClass"&gt;
 &lt;/application-desc&gt;
&lt;/jnlp&gt;</code></pre>
<p>Note the use of the hardcoded URL for the codebase. You may need to change this for your local environment. For more options how the codebase is used, see <a href="http://www.oracle.com/technetwork/java/javase/jnlp-136707.html#CODEBASE">here</a>. Also, as noted above, utilising the JnlpDownloadServlet would allow use to remove the hardcoded URL and use $$codebase instead.</p>
<p><a name="5"><br />
<h2>5. Create our maven poms</h2>
<p></a><br />
<a name="5.1"><br />
<h3>5.1 Parent project pom</h3>
<p></a><br />
Next, we define the pom for our parent project, SwingWebstartMaven.<br />
This file will be located here: </p>
<blockquote><p><code>SwingWebstartMaven\SwingWebstartMaven\pom.xml</code></p></blockquote>
<pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;

    &lt;groupId&gt;com.shaunabram.swingwebstartmaven&lt;/groupId&gt;
    &lt;artifactId&gt;SwingWebstartMaven&lt;/artifactId&gt;
    &lt;packaging&gt;pom&lt;/packaging&gt;
    &lt;version&gt;1.0&lt;/version&gt;
    &lt;name&gt;SwingWebstartMaven Project&lt;/name&gt;

    &lt;modules&gt;
        &lt;module&gt;SwingWebstartMaven-Client&lt;/module&gt;
        &lt;module&gt;SwingWebstartMaven-Web&lt;/module&gt;
    &lt;/modules&gt;

    &lt;build&gt;
        &lt;pluginManagement&gt;
            &lt;plugins&gt;

                &lt;plugin&gt;
                    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                    &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                    &lt;configuration&gt;
                        &lt;source&gt;1.5&lt;/source&gt;
                        &lt;target&gt;1.5&lt;/target&gt;
                    &lt;/configuration&gt;
                &lt;/plugin&gt;

            &lt;/plugins&gt;
        &lt;/pluginManagement&gt;
    &lt;/build&gt;

&lt;/project&gt;</code></pre>
<p><a name="5.2"><br />
<h3>5.2 Client module pom</h3>
<p></a><br />
Next, we define the pom for our client module.<br />
This file will be located here: </p>
<blockquote><p><code>SwingWebstartMaven\SwingWebstartMaven-Client\pom.xml</code></p></blockquote>
<p>This pom is the most important part of this example as it is where we specify the details for the jnlp file generation. See here for <a href="http://mojo.codehaus.org/webstart/webstart-maven-plugin/jnlp-mojos-overview.html#JNLP_file_generation">JNLP File generation details</a>.</p>
<pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;parent&gt;
        &lt;groupId&gt;com.shaunabram.swingwebstartmaven&lt;/groupId&gt;
        &lt;artifactId&gt;SwingWebstartMaven&lt;/artifactId&gt;
        &lt;version&gt;1.0&lt;/version&gt;
    &lt;/parent&gt;
    &lt;artifactId&gt;SwingWebstartMaven-Client&lt;/artifactId&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
    &lt;name&gt;SwingWebstartMaven Client&lt;/name&gt;

    &lt;build&gt;
        &lt;plugins&gt;
            &lt;plugin&gt;
                &lt;groupId&gt;org.codehaus.mojo.webstart&lt;/groupId&gt;
                &lt;artifactId&gt;webstart-maven-plugin&lt;/artifactId&gt;
                &lt;version&gt;1.0-beta-2&lt;/version&gt;

                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;id&gt;package&lt;/id&gt;
                        &lt;phase&gt;package&lt;/phase&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;jnlp-inline&lt;/goal&gt;
                        &lt;/goals&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;

                &lt;configuration&gt;
                    &lt;jnlp&gt;
                        &lt;outputFile&gt;launch.jnlp&lt;/outputFile&gt;
                        &lt;mainClass&gt;com.shaunabram.swingwebstartmaven.HelloWorldSwing&lt;/mainClass&gt;
                    &lt;/jnlp&gt;

                    &lt;libPath&gt;lib&lt;/libPath&gt;

                    &lt;sign&gt;
                        &lt;keystore&gt;SwingWebstartMavenExample-KeyStore&lt;/keystore&gt;
                        &lt;keypass&gt;YourPassword&lt;/keypass&gt;
                        &lt;storepass&gt;YourPassword&lt;/storepass&gt;
                        &lt;alias&gt;SwingWebstartMavenExample&lt;/alias&gt;
                        &lt;validity&gt;3650&lt;/validity&gt;

                        &lt;dnameCn&gt;Your Name&lt;/dnameCn&gt;
                        &lt;dnameOu&gt;Organizational Unit&lt;/dnameOu&gt;
                        &lt;dnameO&gt;Organization&lt;/dnameO&gt;
                        &lt;dnameL&gt;City or Locality&lt;/dnameL&gt;
                        &lt;dnameSt&gt;State or Province&lt;/dnameSt&gt;
                        &lt;dnameC&gt;US&lt;/dnameC&gt;

                        &lt;verify&gt;true&lt;/verify&gt;
                        &lt;keystoreConfig&gt;
                            &lt;delete&gt;true&lt;/delete&gt;
                            &lt;gen&gt;true&lt;/gen&gt;
                        &lt;/keystoreConfig&gt;
                    &lt;/sign&gt;

                    &lt;pack200&gt;false&lt;/pack200&gt;
                    &lt;gzip&gt;true&lt;/gzip&gt;
                    &lt;outputJarVersions&gt;false&lt;/outputJarVersions&gt;
                    &lt;verbose&gt;true&lt;/verbose&gt;

                &lt;/configuration&gt;
            &lt;/plugin&gt;
        &lt;/plugins&gt;
    &lt;/build&gt;

&lt;/project&gt;</code></pre>
<p><a name="5.3"><br />
<h3>5.3 Webapp module pom</h3>
<p></a><br />
Next, we define the pom for our webapp module.<br />
This file will be located here: </p>
<blockquote><p><code>SwingWebstartMaven\SwingWebstartMaven-Webapp\pom.xml</code></p></blockquote>
<pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;parent&gt;
        &lt;groupId&gt;com.shaunabram.swingwebstartmaven&lt;/groupId&gt;
        &lt;artifactId&gt;SwingWebstartMaven&lt;/artifactId&gt;
        &lt;version&gt;1.0&lt;/version&gt;
    &lt;/parent&gt;

    &lt;artifactId&gt;SwingWebstartMaven-Web&lt;/artifactId&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
    &lt;name&gt;SwingWebstartMaven Web&lt;/name&gt;

    &lt;dependencies&gt;

    &lt;/dependencies&gt;

&lt;/project&gt;</code></pre>
<p><a name="6"><br />
<h2>6. Build, deploy and run</h2>
<p></a></p>
<h3>Build</h3>
<p>To build, simply do:</p>
<blockquote><p><code>mvn clean install</code></p></blockquote>
<h3>Deploy</h3>
<p>Deploying is a slightly trickier matter&#8230;</p>
<h5>Web module</h5>
<p>For the web module, you can simply build and ensure the generated war is placed in your tomcat webapps dir, by whichever mechanism suits you best.<br />
For example,<br />
1) Manually copy the war from the target dir to your tomcat dir (although if doing is manually like this, you may want to remove any version number i.e. it should be named SwingWebstartMaven-Webapp.war rather than SwingWebstartMaven-Webapp-1.0.war).<br />
2) Add the following to the build/pluginManagement/plugins section of your parent pom (SwingWebstartMaven\SwingWebstartMaven\pom.xml)</p>
<pre><code>                &lt;plugin&gt;
                    &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                    &lt;artifactId&gt;tomcat-maven-plugin&lt;/artifactId&gt;
                    &lt;configuration&gt;
                        &lt;url&gt;http://localhost:8080/manager&lt;/url&gt;
                        &lt;username&gt;your-tomcat-username&lt;/username&gt;
                        &lt;password&gt;your-tomcat-password&lt;/password&gt;
                    &lt;/configuration&gt;
                &lt;/plugin&gt;</code></pre>
<p>And the simply do </p>
<blockquote><p><code>mvn clean tomcat:redeploy</code></p></blockquote>
<p>3) Write a script on your server than will pull the generated war from your maven repository (e.g. using <a href="http://en.wikipedia.org/wiki/Wget">wget</a> to download from Nexus) and place it in your tomcat dir.</p>
<h5>Client module</h5>
<p>For the client module however, deploying it is a slightly trickier matter.<br />
My preferred approach is to to utilise the script approach mentioned in step 3) above to also pull down the client zip (e.g. SwingWebstartMaven\SwingWebstartMaven-Client\target\SwingWebstartMaven-Client-1.0.zip), and extract the contents into the tomcat webapps dir (I like to put it in a webstart folder e.g. tomcat\webapps\SwingWebstartMaven-Web\webstart).<br />
For example, the script could, among other things,</p>
<ul>
<li>Stop tomcat</li>
<li>Determine the latest version of the project available in the maven repository</li>
<li>Pull down the web module&#8217;s war tomcat/webapps</li>
<li>Start tomcat (so the war will be extracted and deployed)</li>
<li>Pull down the client module&#8217;s zip</li>
<li>Unzip to (for example) tomcat/webapps/SwingWebstartMaven-Web/webstart</li>
</ul>
<p><strong>These are all just suggestions for deployment of course &#8211; how you do it is up to you. But my point is that I found extracting the client module&#8217;s generated zip file (containing the jnlp bundle) to be the easiest way to deploy a JNLP project to an app server to make it easily accessible for users.<br />
</strong> </p>
<h3>Run</h3>
<p>Whatever build and deployment method you choose, you should now be able to access your Webstart enabled Swing app from a URL like this:</p>
<blockquote><p><code>http://localhost:8080/SwingWebstartMaven-Web/webstart/launch.jnlp</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/swing-webstart-maven-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Swing, Webstart, Maven &#8211; a difficult combination</title>
		<link>http://www.shaunabram.com/swing-webstart-maven/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=swing-webstart-maven</link>
		<comments>http://www.shaunabram.com/swing-webstart-maven/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 02:00:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[helloworld]]></category>
		<category><![CDATA[jnlp]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[mvn]]></category>
		<category><![CDATA[swing]]></category>
		<category><![CDATA[webstart]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=1500</guid>
		<description><![CDATA[I have spent the last few weeks struggling with a Swing app that I wanted to deploy via Webstart and build using Maven, via the the Webstart Maven Plugin. It has been a hugely painful process. I found the plugin documentation difficult to follow, struggled to understand the subtle config differences in jnlp, took longer [...]]]></description>
			<content:encoded><![CDATA[<p>I have spent the last few weeks struggling with a Swing app that I wanted to deploy via <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/javaws/developersguide/contents.html">Webstart </a>and build using <a href="http://maven.apache.org/">Maven</a>, via the the <a href="http://mojo.codehaus.org/webstart/webstart-maven-plugin/">Webstart Maven Plugin</a>. It has been a hugely painful process. I found the plugin documentation difficult to follow, struggled to understand the subtle config differences in jnlp, took longer than I expected to get jar signing working, had problems with webstart caching and suffered through a plethora of vague error messages. I found this posting where the author vowed to <a href="http://kylecordes.com/2006/auto-update-no-web-start">never use Webstart again</a>, and I can empathize. Postings of people asking for help with Webstart problems certainly aren&#8217;t difficult to find. Using maven to build the jnlp provides some conveniences, but introduces new problems too. Overall, I&#8217;d prefer to avoid using a Swing/Webstart/Maven solution again.<br />
<span id="more-1500"></span></p>
<p>I did finally get everything up and running. You can skip ahead to my next post about the final <a href="http://www.shaunabram.com/swing-webstart-maven-example">working solution</a>. Otherwise read below for the various options I experimented with before first, but either couldn&#8217;t get working or chose not to use.</p>
<h3>Alternative approaches</h3>
<h4>1) Putting the jnlp details directly in the web module</h4>
<p>I had the idea that putting the jnlp details directly in the web module so that when it came to generating the web module war, it would already contain the jnlp bundle, making deployment to the server easier. See my attempted solution <a href="http://www.shaunabram.com/wp-content/uploads/2012/02/swingwebstartmaven-alternative1.zip">here</a>.<br />
And I did get this solution working &#8211; for this simple example. </p>
<p>The issue I ran into was when I tried to extend the example to my real project which uses versioning (via the <a href="http://maven.apache.org/plugins/maven-release-plugin/">maven release plugin</a>). As soon as I tried using version numbers other than 1.0 all round, I had issues, specifically with the jnlpFile/jarResources/version section. The web module suddenly had difficulty finding the client artifact in the maven repo. I suspect it was attempting to download the artifact before it had actually been deployed to the repository. I&#8217;m sure there is a way to make this solution work, but I couldn&#8217;t figure it out.</p>
<h4>2) Bundling the jnlp files in a war using the dependency-maven-plugin</h4>
<p>I tried following <a href="http://mojo.codehaus.org/webstart/webstart-maven-plugin/jnlp-mojos-overview.html#jnlp_goals_configuration_overview">this example</a> for the client, and <a href="http://mojo.codehaus.org/webstart/webstart-maven-plugin/examples/war_bundle_1.html">this example</a> for the web module which uses the <a href="http://maven.apache.org/plugins/maven-dependency-plugin/">dependency-maven-plugin</a> with the objective of packaging up the JNLP bundle with the web&#8217;s module war to produce a single war that could be deployed to tomcat. See my attempt <a href="http://www.shaunabram.com/wp-content/uploads/2012/02/swingwebstartmaven-alternative2.zip">here</a>. </p>
<p>The issue that I ran into was that the jnlp folder gets generated in the client target directory (e.g. SwingWebstartMaven\SwingWebstartMaven-Client\target in my example), but only the contents of the target/classes directory actually seemed to get copied to the web module. I tried working around this by modifying the client to generate the jnlp in classes directory e.g.</p>
<pre><code>&lt;jnlp&gt;&lt;outputFile&gt;../classes/launch.jnlp&lt;/outputFile&gt;&lt;/jnlp&gt;</code></pre>
<p>But then I seemed to run into issues with the webapp module being built before the client module.<br />
Again, I&#8217;m sure there is a way to make this solution work, but I couldn&#8217;t figure it.</p>
<h4>3) Use assembly plugin to combine client and web module outputs</h4>
<p>I spent some time looking into <a href="http://mojo.codehaus.org/webstart/webstart-maven-plugin/examples/war_bundle_2.html">this example</a> which suggests creating a new module (which it calls webapp-bundle) whose sole purpose is to combine the output of the client and web modules by using using the <a href="http://maven.apache.org/plugins/maven-assembly-plugin/">maven-assembly-plugin</a>. It aims to combine the web module&#8217;s war with the client module&#8217;s zip into a single deployable war.<br />
I think this is probably a viable solution, but mid way through I decided it was just going to be easier to take the existing zip that is generated by the client module and unzip it to the application server (e.g. tomcat/webapps). That is basically what I did in my final solution. See my <a href="http://www.shaunabram.com/swing-webstart-maven-example/">next posting</a> for the details.</p>
<h3>Some useful bookmarks</h3>
<ul>
<li>
<a href="http://mojo.codehaus.org/webstart/webstart-maven-plugin/jnlp-mojos-overview.html">JNLP goals overview</a><br />
Gives 2 pom examples, one using jnlp, jnlp-inline or jnlp-single goal and one using the jnlp-download-servlet goal</li>
<li><a href="http://mojo.codehaus.org/webstart/webstart-maven-plugin/examples/simple_jnlp_download_servlet.html ">JNLP Download Servlet example</a><br />
I omitted the from the example in my next posting, but I did end up using it in my real project. This link shows how to incorporate the JnlpDownloadServlet into your project. At time of writing the servlet wasn&#8217;t available in many nexus repos, so you will likely need to install in your local repo yourself.
</li>
<li><a href="http://mojo.codehaus.org/webstart/webstart-maven-plugin/jnlp101.html">JNLP 101</a><br />
Some things that are not directly related to the Webstart Maven Plugin but can help you make good use of it.
</li>
<li><a href="http://docs.oracle.com/javase/1.5.0/docs/guide/javaws/developersguide/syntax.html">JNLP File Syntax</a><br />
Oracle page describing the JNLP file elements.
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/swing-webstart-maven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaOne: Tuesday&#8217;s Keynote</title>
		<link>http://www.shaunabram.com/javaone2011-tuesday-keynote/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javaone2011-tuesday-keynote</link>
		<comments>http://www.shaunabram.com/javaone2011-tuesday-keynote/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 18:28:53 +0000</pubDate>
		<dc:creator>sabram</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[javaone]]></category>
		<category><![CDATA[javaone2011]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=1416</guid>
		<description><![CDATA[This morning&#8217;s Keynote at JavaOne contained a few interesting announcements, including JDK7 for MacOS X Developer Preview announced by Hasan Rizvi (SVP @ Oracle). Available here. Java FX to be open sourced, and it will be proposed to the JCP (Confirmed, see press release) JDK8 will be released in the summer of 2013 (not 2012 [...]]]></description>
			<content:encoded><![CDATA[<p>This morning&#8217;s Keynote at JavaOne contained a few interesting announcements, including</p>
<ul>
<li>JDK7 for MacOS X Developer Preview announced by Hasan Rizvi (SVP @ Oracle). Available <a href="http://jdk7.java.net/macportpreview/">here</a>.</li>
<li>Java FX to be open sourced, and it will be proposed to the JCP (Confirmed, see <a href="http://www.oracle.com/us/corporate/press/512728">press release</a>)</li>
<li>JDK8 will be released in the summer of 2013 (not 2012 as previously discussed), as announced by Adam Messinger from Oracle</li>
</ul>
<p>There was also mention of an <a href="http://www.oracle.com/technetwork/java/javamagazine/index.html">Oracle Java Magazine</a>, which I confess I had never heard of before.</p>
<p>For a summary of this morning&#8217;s announcements, see <a href="http://blogs.oracle.com/otn/entry/the_most_exciting_oracle_openworld">here</a>.</p>
<p>Overall, not the most exciting keynote I have seen. It opened with a presentation from Juniper Networks. I didn&#8217;t find the topic of &#8220;Programming the network&#8221; to bring networks and apps closer together particular relevant for me personally. They then rolled out a bunch of other corporate folks from the likes of Intel, Redhat, IBM and ARM. The Twitter guy did announce that Twitter are joining OpenJDK as well as the JCP though.</p>
<p>On to the sessions&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/javaone2011-tuesday-keynote/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaOne: Comparing Java Web Frameworks</title>
		<link>http://www.shaunabram.com/javaone-web-frameworks/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javaone-web-frameworks</link>
		<comments>http://www.shaunabram.com/javaone-web-frameworks/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 05:07:06 +0000</pubDate>
		<dc:creator>sabram</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[javaone]]></category>
		<category><![CDATA[javaone2011]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[tapestry]]></category>
		<category><![CDATA[webframework]]></category>
		<category><![CDATA[wicket]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=1398</guid>
		<description><![CDATA[The first talk I attended at this year&#8217;s JavaOne was &#8220;Choosing Your Java Web Framework&#8221; by Richard Pack from salesforce.com Overall, I found this a really interesting talk. It was lacking in any sales pitch, nor did it have the unquestioning devotion to one particular framework that I felt some of the Java FX talks [...]]]></description>
			<content:encoded><![CDATA[<p>The first talk I attended at this year&#8217;s <a href="http://www.oracle.com/javaone/index.html">JavaOne</a> was &#8220;Choosing Your Java Web Framework&#8221; by Richard Pack from salesforce.com</p>
<p>Overall, I found this a really interesting talk. It was lacking in any sales pitch, nor did it have the unquestioning devotion to one particular framework that I felt some of the Java FX talks had. Instead it seemed like an unbiased look at web frameworks in general and a handful of frameworks in more detail, based on Richard&#8217;s extensive and hands on experience and SalesForce and Hyperic.<br />
<span id="more-1398"></span></p>
<p>Richard started by listing some of the web frameworks that are out there today. He managed to list over 100 and there were still many missing (e.g. I couldn&#8217;t see <a href="http://liftweb.net/">Lift</a> or <a href="http://www.playframework.org/">Play</a> listed).</p>
<p>Given the abundance of choices, I think it was wise to start with a broad definition of what a web framework is. His definition included something that uses <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter">MVP</a> or <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">MVC</a> and provides an event model, resource management, data binding and that is ideally stateless.</p>
<p>He then talked about the evolution that has taken place from server side rendering to client side rendering (where you have a stateless server, with the component model living on the client side), and had a few interesting &#8216;Architecture Evolution&#8217; diagrams in <a href="http://bit.ly/jwf-2011">his slides</a>.</p>
<p>Next, Richard talked about the consequences of &#8216;choosing poorly&#8217;, i.e. picking a framework not best suited to your project&#8217;s needs (steep learning curves, excessive boilerplate code, unable to debug templates etc). I got the feeling Richard had learned many of these the hard way. He followed with a set of criteria to help better define your web framework requirements and selection criteria to avoid such issues, including usage scenarios, environment (intranet, mobile) and team competencies. On a side note, he pointed out that using forms for posting had become old hat (and those &#8216;Are you sure you wish to resend&#8217; popups are certainly annoying).</p>
<p>Then, on to the main event. Richard ran through 4 of the most popular web frameworks: <a href="http://grails.org/">Grails</a>, <a href="http://tapestry.apache.org/">Tapestry</a>, <a href="http://wicket.apache.org/">Wicket</a> and <a href="http://code.google.com/webtoolkit/">GWT</a>. In each case he compared them using criteria such as AJAX support, friendly URLs, open source license etc. I won&#8217;t try to recreate his findings (again, see <a href="http://bit.ly/jwf-2011">his slides</a>), but I did come away with a higher opinion of both Tapestry (its Form builder using POJOs sounds particularly cool) and Wicket and I am definitely keen to learn more on GWT (which Salesforce.com use extensively).</p>
<p>In some of the follow up questions, Richard was asked about <a href="http://www.oracle.com/technetwork/java/javaee/javaserverfaces-139869.html">JSF</a>, which he didn&#8217;t have very high opinion of (and he <a href="http://ptrthomas.wordpress.com/2009/05/15/jsf-sucks/">is</a> <a href="http://www.dzone.com/links/jsf_sucks_compendium_of_jsf_rantsreviews.html">not</a> <a href="http://blog.brunoborges.com.br/2010/12/top-10-reasons-why-i-dont-like-jsf.html">alone</a>). I was however disappointed to not hear some info (merits or otherwise) on <a href="http://javafx.com/">JavaFX</a>, especially considering its high visibility at this year&#8217;s conference, but I also understand no one can know all frameworks.</p>
<p>Finally, he finished with an interesting thought &#8211; that one of the main scalability issues with any web framework is people i.e. the competencies and preferences of the developers on the team.</p>
<p>Find Richard&#8217;s slides <a href="http://bit.ly/jwf-2011">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/javaone-web-frameworks/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>@JavaOne</title>
		<link>http://www.shaunabram.com/javaone2011/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javaone2011</link>
		<comments>http://www.shaunabram.com/javaone2011/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 00:26:57 +0000</pubDate>
		<dc:creator>sabram</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[javaone]]></category>
		<category><![CDATA[javaone2011]]></category>

		<guid isPermaLink="false">http://www.shaunabram.com/?p=1403</guid>
		<description><![CDATA[I am at JavaOne 2011 right now. Always fun and it seems to be bigger than last year, with a huge selection of talks and presentations (although frustratingly flaky wifi!). Some of the themes of this morning&#8217;s keynote talk were JavaFX 2.0, what will be coming in Java 8 and a new Oracle NoSQL Database. [...]]]></description>
			<content:encoded><![CDATA[<p>I am at JavaOne 2011 right now. Always fun and it seems to be bigger than last year, with a huge selection of talks and presentations (although frustratingly flaky wifi!).</p>
<p>Some of the themes of this morning&#8217;s keynote talk were JavaFX 2.0, what will be coming in Java 8 and a new Oracle NoSQL Database. There are some links <a href="http://blogs.oracle.com/otn/entry/the_most_exciting_oracle_openworld">here</a>, <a href="http://www.theserverside.com/feature/JavaOne-Keynote-Duke-Cloud-JavaFX-and-Glassfish">here</a> and <a href="http://www.infoq.com/news/2011/10/javaone-tech-keynote">here</a> (and I believe the videos will be posted soon <a href="http://www.oracle.com/javaone/live/on-demand/index.html">here</a>).</p>
<p>I just attended a very useful Java Web Framework comparison talk that I will try to post about shortly. I also met up with some of the <a href="http://java.dzone.com/">DZone</a> team. For now, I am going to some JavaFX talks.</p>
<p>If any of you are attending, let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunabram.com/javaone2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

