<?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>biotext.org.uk &#187; eclipse</title>
	<atom:link href="http://biotext.org.uk/tag/eclipse/feed/" rel="self" type="application/rss+xml" />
	<link>http://biotext.org.uk</link>
	<description>Not a typewriter</description>
	<lastBuildDate>Sat, 05 Feb 2011 14:18:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Best new feature in Eclipse 3.6 Helios</title>
		<link>http://biotext.org.uk/best-new-feature-in-eclipse-3-6-helios/</link>
		<comments>http://biotext.org.uk/best-new-feature-in-eclipse-3-6-helios/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 13:20:44 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[LJC]]></category>

		<guid isPermaLink="false">http://biotext.org.uk/?p=487</guid>
		<description><![CDATA[&#8230; is hidden away on the last tab of the Java Formatting Profile editor (Preferences -> Java -> Code Style -> Formatter -> Edit). They&#8217;ve finally (after nearly six years) added the ability to temporarily turn the code formatter off for a tricksy block that needs its own custom formatting. e.g.: // @formatter:off xml .append&#40; [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230; is hidden away on the last tab of the Java Formatting Profile editor (Preferences -> Java -> Code Style -> Formatter -> Edit).</p>
<p>They&#8217;ve finally (after <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=76435">nearly six years</a>) added the ability to temporarily turn the code formatter off for a tricksy block that needs its own custom formatting. e.g.:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">			<span style="color: #666666; font-style: italic;">// @formatter:off</span>
			xml
			.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;&lt;node id='&quot;</span> <span style="color: #009900;">&#41;</span>
			.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span> protein <span style="color: #009900;">&#41;</span>
			.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;'&gt;&lt;data key='class'&gt;&quot;</span> <span style="color: #009900;">&#41;</span>
			.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span> cls <span style="color: #009900;">&#41;</span>
			.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;&lt;/data&gt;&lt;data key='label'&gt;&quot;</span> <span style="color: #009900;">&#41;</span>
			.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span> protein <span style="color: #009900;">&#41;</span>
			.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;&lt;/data&gt;&lt;/node&gt;&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// @formatter:on</span></pre></div></div>

<p>See the Off/On Tags tab for details.</p>
<p>Nice one guys&#8230; Eventually.</p>
]]></content:encoded>
			<wfw:commentRss>http://biotext.org.uk/best-new-feature-in-eclipse-3-6-helios/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>NoSuchMethodError when running JUnit tests in Eclipse</title>
		<link>http://biotext.org.uk/nosuchmethoderror-when-running-junit-tests-in-eclipse/</link>
		<comments>http://biotext.org.uk/nosuchmethoderror-when-running-junit-tests-in-eclipse/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 12:25:49 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[LJC]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://biotext.org.uk/?p=439</guid>
		<description><![CDATA[This is worth a quick post as I couldn&#8217;t find a solution on Google and it took me an hour or two of fiddling. I have a Maven project, call it frontend-war, which contains the main service code for FuncNet. A unit test kept failing in Eclipse with NoSuchMethodError, one of my least favourite screw-ups [...]]]></description>
			<content:encoded><![CDATA[<p>This is worth a quick post as I couldn&#8217;t find a solution on Google and it took me an hour or two of fiddling.</p>
<p>I have a Maven project, call it <code>frontend-war</code>, which contains the main service code for <a href="http://funcnet.eu/">FuncNet</a>. A unit test kept failing in Eclipse with <code>NoSuchMethodError</code>, one of my least favourite screw-ups to disentangle.</p>
<p>In this case it was particularly frustrating, as the method (on a class in one of the main project&#8217;s dependent jars, called <code>service-utils</code>) definitely existed, was public, and had the right signature. Also, even more weirdly, when I ran the tests in Maven from the command line, they passed.</p>
<p>Cue all the usual Eclipse cargo-cult dead-chicken-waving &#8212; cleaning everything, closing and reopening projects, etc. etc. No joy.</p>
<p>Then it hit me&#8230; (solution below the jump)</p>
<p><span id="more-439"></span><br />
One of the other jars included by <code>frontend-war</code>, called <code>sessionDB</code>, <em>also</em> included <code>service-utils</code> &#8212; and was using an out-of-date version. This version didn&#8217;t include the method I was calling (at least not with that signature). The dependency hierarchy looked something like:</p>
<p><code>frontend-war-CURRENT</code><br />
&nbsp;&nbsp;&nbsp;&nbsp;<code>service-utils-1.2.9</code><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8230;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<code>sessionDB-1.3.3</code><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>service-utils-1.2.4</code><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8230;</p>
<p>So I rebuilt <code>sessionDB</code> against the latest version of <code>service-utils</code>, then rebuilt <code>frontend-war</code> against that, and it worked.</p>
<p>So, my fault for getting myself into <a href="http://en.wikipedia.org/wiki/Java_Classloader#JAR_hell">jar hell</a>, although even if you don&#8217;t bring it on yourself, it&#8217;s hard to avoid it if you use a lot of open-source components, and Maven &#8212; which I still argue is a timesaver overall &#8212; tends to exacerbate it. Take a look at the Dependency Graph view in Eclipse&#8217;s POM Editor sometime &#8212; if you see any red arrows, that means two or more different versions of a dependency are being requested by different modules within your project.</p>
<p>So why did it work on the command line and not in Eclipse? To be honest, I don&#8217;t know in detail. But in cases like this, the classloader will (AFAIK) just pull in whichever version is requested first, so Eclipse&#8217;s classpath management must have happened to process the dependencies in a different order from Maven&#8217;s &#8212; meaning it worked by pure luck.</p>
<p><strong>Note:</strong> My solution &#8212; updating <code>sessionDB</code> to use the latest <code>service-utils</code> &#8212; wasn&#8217;t a problem, because all three of the modules in the unholy <i>ménage à trois</i> belonged to me. But what do you do if two third-party libraries request different versions of the same jar?</p>
<p>A <del datetime="2010-03-17T11:50:48+00:00">famous</del> notorious example of this tends to happen with <a href="https://www.hibernate.org/">Hibernate</a>, which depends on a really out-of-date version of <a href="http://asm.ow2.org/">ASM</a> &#8212; or at least it used to, I haven&#8217;t checked recently. Lots of open-source projects use ASM but more recent versions clash nastily with the old one Hibernate requires.</p>
<p>The <a href="http://blog.springsource.com/2007/06/11/asm-version-incompatibilities-using-spring-autowired-with-hibernate/">solution in this case</a> is to use Maven&#8217;s exclusions clause to specifically exclude ASM from Hibernate&#8217;s transitive dependencies. Thankfully it can just use the more recent versions without problems.</p>
<p>But what would you do if one of the libraries you were using depended on a method that was <em>no longer available</em> in a more recent jar? Then you&#8217;re really in jar hell. Answers on a postcard&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://biotext.org.uk/nosuchmethoderror-when-running-junit-tests-in-eclipse/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Help! Eclipse won’t believe I have Maven 2.2.1</title>
		<link>http://biotext.org.uk/help-eclipse-won%e2%80%99t-believe-i-have-maven-2-2-1/</link>
		<comments>http://biotext.org.uk/help-eclipse-won%e2%80%99t-believe-i-have-maven-2-2-1/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 19:25:57 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Questions]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://biotext.org.uk/?p=423</guid>
		<description><![CDATA[I have a project (built from an AppFuse template) that requires Maven 2.2.1. So I upgraded to this (from 2.1.0) and set my path and my M2_HOME and MAVEN_HOME env variables. Then I ran mvn eclipse:eclipse and imported the project into Eclipse (Galileo). However, in the problems list for the project (and at the top [...]]]></description>
			<content:encoded><![CDATA[<p>I have a project (built from an AppFuse template) that requires Maven 2.2.1. So I upgraded to this (from 2.1.0) and set my path and my M2_HOME and MAVEN_HOME env variables.</p>
<p>Then I ran mvn eclipse:eclipse and imported the project into Eclipse (Galileo).</p>
<p>However, in the problems list for the project (and at the top of the pom.xml GUI editor) it says:</p>
<blockquote><p>Unable to build project &#8216;/export/people/clegg/data/GanymedeWorkspace/funcserve/pom.xml; it requires Maven version 2.2.1</p></blockquote>
<p>This persists whether I set Eclipse to use its Embedded Maven implementation, or the external 2.2.1 installation, in the Preferences -> Maven -> Installations dialog.</p>
<p>I&#8217;ve tried closing and reopening the project, reindexing the repository, cleaning the project, restarting the IDE, logging out and back in again, everything I can think of! But Eclipse still won&#8217;t believe I have Maven 2.2.1.</p>
<p>I just did a plugin update so I have the latest version of Maven Integration for Eclipse &#8212; 0.9.8.200905041414.</p>
<p>Does anyone know how to convince Eclipse I really do have the right version of Maven? It&#8217;s like it&#8217;s recorded the previous version somewhere else and won&#8217;t pay any attention to my changes :-(</p>
<p>If you have any clue whatsoever &#8212; <a href="http://stackoverflow.com/questions/1805274/eclipse-wont-believe-i-have-maven-2-2-1">please drop an answer here</a>&#8230;</p>
<p>Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://biotext.org.uk/help-eclipse-won%e2%80%99t-believe-i-have-maven-2-2-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

