<?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>Shizzle &#187; java</title>
	<atom:link href="http://lenni.info/blog/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://lenni.info/blog</link>
	<description>My little notebook</description>
	<lastBuildDate>Sun, 29 Jan 2012 20:47:31 +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>Configuring the Maven Site Plugin to accept scp-URLs for site:deploy</title>
		<link>http://lenni.info/blog/2011/04/configuring-the-maven-site-plugin-to-accept-scp-urls-for-sitedeploy/</link>
		<comments>http://lenni.info/blog/2011/04/configuring-the-maven-site-plugin-to-accept-scp-urls-for-sitedeploy/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 10:03:09 +0000</pubDate>
		<dc:creator>Leonard</dc:creator>
				<category><![CDATA[Mixed]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[site]]></category>

		<guid isPermaLink="false">http://lenni.info/blog/?p=461</guid>
		<description><![CDATA[I ran into a slightly puzzling problem while upgrading from Maven2 to Maven3 this week. In hindsight the solution wasn&#8217;t all that complicated but it threw me a little because Maven is usually quite good at pulling all its required dependencies. Basically, I was having trouble uploading files generated by Maven&#8217;s site plugin to a [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a slightly puzzling problem while upgrading from Maven2 to Maven3 this week. In hindsight the solution wasn&#8217;t all that complicated but it threw me a little because Maven is usually quite good at pulling all its required dependencies.</p>
<p>Basically, I was having trouble uploading files generated by Maven&#8217;s site plugin to a host. The URL was specified as follows</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;site<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>scp://server:/some/long/path<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/site<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>In Maven2 this worked out of the box without extra configuration.</p>
<p>In Maven3 this threw the following error during <code>site-deploy</code>:</p>
<p><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:2.2:deploy (default-cli) on project $PROJECT_NAME: Unsupported protocol: 'scp': Cannot find wagon which supports the requested protocol: scp: java.util.NoSuchElementException</code></p>
<p>The trouble was that the Site Plugin apparently doesn&#8217;t automatically pull the Apache Wagon SSH implementation. You have to tell it manually to do that like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  ...
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<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>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.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-site-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;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<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>org.apache.maven.wagon<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>wagon-ssh<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;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0-beta-7<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependencies<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>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  ...
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://lenni.info/blog/2011/04/configuring-the-maven-site-plugin-to-accept-scp-urls-for-sitedeploy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mavens&#8217;s &#8220;The artifact has no valid ranges&#8221;</title>
		<link>http://lenni.info/blog/2009/10/mavenss-the-artifact-has-no-valid-ranges/</link>
		<comments>http://lenni.info/blog/2009/10/mavenss-the-artifact-has-no-valid-ranges/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 07:10:05 +0000</pubDate>
		<dc:creator>Leonard</dc:creator>
				<category><![CDATA[Mixed]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://lenni.info/blog/?p=189</guid>
		<description><![CDATA[I have just learned to use the really great Java build and project management tool Maven. It makes managing large projects with dozens of components a lot easier and its build configuration is simpler and less imperative compared to Ant, since it relies a lot on convention over configuration. Basically, Maven knows that pretty much [...]]]></description>
			<content:encoded><![CDATA[<p>I have just learned to use the really great Java build and project management tool <a href="http://maven.apache.org/">Maven</a>. It makes managing large projects with dozens of components a lot easier and its build configuration is simpler and less imperative compared to Ant, since it relies a lot on convention over configuration. Basically, Maven knows that pretty much every project needs to be</p>
<ul>
<li>compiled</li>
<li>JavaDoc&#8217;d</li>
<li>unit tested</li>
</ul>
<p>These things don&#8217;t need to be declared and are automatically done by Maven. Maven&#8217;s great advantage over Ant is it&#8217;s ability to handle the dependencies of your project, ie. the old &#8220;Hunt the JAR&#8221; game is a thing of the past as Maven will simply download whatever libraries or frameworks you will need. Most of the time your build will run smoothly and Maven will spit out a nice JAR or WAR without problems.</p>
<h3>The curious error message</h3>
<p>However, if there are build errors they tend to be on the cryptic side. &#8220;The artifact has no valid ranges&#8221; is one of those. Basically it means that you <em>do have</em> a valid range, however you have defined two (or more) <em>different version ranges of an artifact</em> in a fixed way. Most likely you haven&#8217;t defined those dependencies in the same project but through a transitive dependency.</p>
<p>Let&#8217;s have an example. Your project <em>my-app</em>, depends on an artifact <em>super-framework</em> at version 1.0, and only 1.0, nothing else. <em>my-app</em> also depends on another of your apps called<em> my-app2</em>. <em>my-app2</em> has a dependency on <em>super-framework</em> but only for versions 0.5 to 0.9. This means that you have incompatible version ranges and you need to resolve this. You will have to edit <em>my-app</em> or <em>my-app2</em> and change their version ranges for <em>super-framework</em>.</p>
<p>This took me a little while to figure out myself since the error kinda suggests to look in the wrong place. The range is perfectly valid, it&#8217;s just that there is too many of them.</p>
<h3>Debugging this message</h3>
<p>That is a little tricky. You can try running Maven with the -X flag, which will show a running log of how the version is chosen. Also, sometimes the Maven plugin for Eclipse can give you some clues, but sometimes it is way off.</p>
<p>One word of advice though, it seems to matter in which order you include your dependencies in the the POM file. So, if you include a dependency on</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">super-framework [0.5,1.5)</pre></div></div>

<p>it will fetch the latest available version, say 1.1.</p>
<p>If you then have a transitive dependency further down that includes</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">super-framework [0.5, 1.0)</pre></div></div>

<p>Maven will generate this misleading error, since it will not select anything other than the 1.1 it already has, even though it could just select 0.9 without producing a version conflict. If you swap the order, weirdly, it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://lenni.info/blog/2009/10/mavenss-the-artifact-has-no-valid-ranges/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In praise of Netbeans (and how I learned to hate Eclipse)</title>
		<link>http://lenni.info/blog/2009/08/in-praise-of-netbeans-and-how-i-learned-to-hate-eclipse/</link>
		<comments>http://lenni.info/blog/2009/08/in-praise-of-netbeans-and-how-i-learned-to-hate-eclipse/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 11:02:14 +0000</pubDate>
		<dc:creator>Leonard</dc:creator>
				<category><![CDATA[Mixed]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://lenni.info/blog/?p=138</guid>
		<description><![CDATA[The dark ages I use a MacBook for my development and until recently I have done my Java development in Eclipse. It is a very popular IDE and apparently very flexible and can be made to do absolutely everything. Also, all the Google Java products plugins only worked for Eclipse and that was the main [...]]]></description>
			<content:encoded><![CDATA[<h3>The dark ages</h3>
<p>I use a MacBook for my development and until recently I have done my Java development in Eclipse. It is a very popular IDE and apparently very flexible and can be made to do absolutely everything. Also, all the Google Java products plugins only worked for Eclipse and that was the main reason for me to not switch.</p>
<p>However, it shortcomings became more and more apparent during the time I wrote my dissertation and became more serious about Java development. I noticed the following things about the OS X variant of Eclipse.</p>
<ol>
<li><strong>It. Is. Slow.</strong> It is painful to work with an IDE that locks up every 5 minutes and whenever you open a menu that has so far not been opened. I heard something about the Java-Carbon bindings not being very good and I think performance is better on Windows but this was a real issue for me.</li>
<li><strong>Usability is abysmal.</strong> There are millions of message areas that pop up all the time, buttons are tiny and appear and disappear seemingly randomly. I know software development is supposed to be difficult but this is just unbearably hostile to the user.</li>
<li><strong>It is very much a Windows app. </strong>It feels a lot like they wrote the app to fit with the windows UI guidelines, realised that there is Mac developers too and just copied the UI button by button. I know us Mac people are demanding when it comes to OS integration but Eclipse is simply not cutting it.</li>
</ol>
<h3>The conversion</h3>
<p>One day I was frustrated enough by how rubbish Eclipse was, that I was ready to switch IDE mid-project. I kept saying to myself that I would give Netbeans a spin at the next project but my patience with Eclipse was wearing thin. I have not looked back.</p>
<p>The main issue I was worried about was the project conversion process and I have to tell you it was the most seamless thing I have ever experienced. Absolutely <em>no errors or incompatibilities</em> turned up. I was impressed. It also turned out that Netbeans is much better at managing your classpath automatically, so conversion even resolved a few issues. The only thing I had to redo was the tomcat configuration but that took about 30 mins.</p>
<h3>I didn&#8217;t know Java development could be bearable on a Mac</h3>
<p>After trying Netbeans out for a few days I have the following things about it.</p>
<ol>
<li><strong>It has a nicer UI</strong>. I know this will not get me any cred with the emacs crowd but if an application doesn&#8217;t shout &#8220;I&#8217;M UGLY!&#8221; all day long I like using it better than one that does. Call me superficial.<br />
I also managed to install a dark editor skin which makes Netbeans resemble Textmate a bit more which has also earned some plus points with me.</li>
<li><strong>Usability is way better</strong>. Buttons are clear and there are fewer of them. Netbeans also gives you more sane default behaviour so you don&#8217;t have to poke around in the settings too often.</li>
<li><strong>Classpath and lib folder management works.</strong> When you put something in the lib folder, it will be put on the classpath and copied into WEB-INF/lib. I couldn&#8217;t get Eclipse to do that no matter how hard I tried. I had to enable this for every JAR I downloaded.</li>
<li><strong>It&#8217;s faster.</strong> Not Textmate-fast but fast enough to not annoy me constantly. I like.</li>
<li><strong>Mercurial works out of the box.</strong> I didn&#8217;t install a plugin, I never activated anything. Netbeans just knew I was using it and started marking files as edited. (I guess this works for other SCMs too.)</li>
</ol>
<div class="wp-caption aligncenter" style="width: 754px"><a href="http://www.flickr.com/photos/24003367@N00/3806848435/"><img class="   " title="Netbeans with Dark Theme" src="http://farm4.static.flickr.com/3419/3806848435_639202d05c_o.png" alt="Netbeans screenshot with Textmate style dark theme" width="744" height="515" /></a><p class="wp-caption-text">Netbeans screenshot with Textmate-style dark theme</p></div>
<p>In retrospect, switching to Netbeans has been a huge boost in terms of productivity for me. I&#8217;m wondering why I didn&#8217;t try it earlier.</p>
]]></content:encoded>
			<wfw:commentRss>http://lenni.info/blog/2009/08/in-praise-of-netbeans-and-how-i-learned-to-hate-eclipse/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>[Fixed] Eclipse editor text bouncing up and down under OS X</title>
		<link>http://lenni.info/blog/2008/10/eclipse-squashing-lines/</link>
		<comments>http://lenni.info/blog/2008/10/eclipse-squashing-lines/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 13:53:02 +0000</pubDate>
		<dc:creator>Leonard</dc:creator>
				<category><![CDATA[Mixed]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[os x]]></category>

		<guid isPermaLink="false">http://internetshizzle.wordpress.com/2008/10/15/eclipse-squashing-lines/</guid>
		<description><![CDATA[Eclipse squashing lines Originally uploaded by Lenniboy I used to have terrible problems with Eclipse on my MacBook running OS X. Editor text was bouncing up and down and all my lines were squashing. Have a look at the photo if you think I&#8217;m crazy. Finally I have managed to find out what has caused [...]]]></description>
			<content:encoded><![CDATA[<div style="float:right;margin-left:10px;margin-bottom:10px;"><a title="photo sharing" href="http://www.flickr.com/photos/24003367@N00/2943744255/"><img style="border:solid 2px #000000;" src="http://farm4.static.flickr.com/3042/2943744255_d5591d74a9_m.jpg" alt="" /></a></p>
<p><span style="font-size:.9em;margin-top:0;"><br />
<a href="http://www.flickr.com/photos/24003367@N00/2943744255/">Eclipse squashing lines</a></span></p>
<p>Originally uploaded by <a href="http://www.flickr.com/people/24003367@N00/">Lenniboy</a></div>
<p>I used to have terrible problems with Eclipse on my MacBook running OS X. Editor text was bouncing up and down and all my lines were squashing. Have a look at the photo if you think I&#8217;m crazy.</p>
<p>Finally I have managed to find out what has caused this behaviour: It is the font size, which was set to 9.5. I&#8217;m not sure if the small size or the .5 bit that is to blame but but as soon as I set it to 11pt everything was fine.</p>
<p>I&#8217;m happy I found this because I was very short of changing over to XCode.</p>
]]></content:encoded>
			<wfw:commentRss>http://lenni.info/blog/2008/10/eclipse-squashing-lines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

