<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7052660126437277618</id><updated>2011-10-12T23:24:38.289+13:00</updated><category term='m2eclipse'/><category term='java'/><category term='classnotfoundexception'/><category term='junit'/><category term='maven'/><category term='launcher'/><category term='java logging slf4j exception throwable parameter'/><category term='maven2'/><category term='suppress message'/><category term='release plugin'/><category term='component'/><category term='console'/><category term='testng'/><category term='maven2 release plugin subversion svn'/><category term='output folder'/><category term='eclipse maven'/><category term='spring'/><category term='m2e'/><category term='dependency'/><category term='joran'/><category term='logback'/><category term='javaconfig'/><category term='eclipse subclipse javahl kwallet gnome-keyring java'/><category term='eclipse'/><category term='archiva'/><category term='repository'/><title type='text'>Software on the Inside</title><subtitle type='html'>A candid discussion of Maven2, Spring, DI, Testing, Java and anything else that I feel a burning need to blurt out.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://softwareontheinside.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://softwareontheinside.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Michael McCallum</name><uri>http://www.blogger.com/profile/05572248133570653791</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_4KlN3Oaw3Jw/TDRoQED7gbI/AAAAAAAAABM/dnaabSZNouA/s1600-R/00180655157585b4233b4117d5c29ac1.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7052660126437277618.post-715974311888399177</id><published>2010-09-29T01:15:00.003+13:00</published><updated>2010-09-29T01:24:41.827+13:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='suppress message'/><category scheme='http://www.blogger.com/atom/ns#' term='logback'/><category scheme='http://www.blogger.com/atom/ns#' term='joran'/><category scheme='http://www.blogger.com/atom/ns#' term='console'/><title type='text'>Suppress logback initialisation messages</title><content type='html'>Recently I noticed logback logging lots of joran messages, I'm sure it just started happening one day.&lt;br /&gt;&lt;br /&gt;With a little playing around I believe that the messages are a symptom of the &lt;layout&gt; element deprecation. If you replace the layouts with the correct &lt;encoded&gt; tags the messages go away.&lt;br /&gt;&lt;br /&gt;I used to see this&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;00:52:57,820 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]&lt;br /&gt;00:52:57,820 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]&lt;br /&gt;00:52:57,821 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/home/michael/src/stickycode/trunk/net.stickycode.examples/sticky-example-mockwire/target/classes/logback.xml]&lt;br /&gt;00:52:57,954 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set&lt;br /&gt;00:52:57,962 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]&lt;br /&gt;00:52:57,971 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]&lt;br /&gt;00:52:58,016 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Pushing component ...&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;But by changing&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"&amp;gt;&lt;br /&gt;    &amp;lt;filter class="ch.qos.logback.classic.filter.ThresholdFilter"&amp;gt;&lt;br /&gt;      &amp;lt;level&amp;gt;info&amp;lt;/level&amp;gt;&lt;br /&gt;    &amp;lt;/filter&amp;gt;&lt;br /&gt;    &amp;lt;layout class="ch.qos.logback.classic.PatternLayout"&amp;gt;&lt;br /&gt;      &amp;lt;Pattern&amp;gt;%d{yyyy-MM-dd} %d{HH:mm:ss} %.-1level %thread %logger{36}: %m%n&amp;lt;/Pattern&amp;gt;&lt;br /&gt;    &amp;lt;/layout&amp;gt;&lt;br /&gt;  &amp;lt;/appender&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;to&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; &amp;lt;appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"&amp;gt;&lt;br /&gt;    &amp;lt;filter class="ch.qos.logback.classic.filter.ThresholdFilter"&amp;gt;&lt;br /&gt;      &amp;lt;level&amp;gt;info&amp;lt;/level&amp;gt;&lt;br /&gt;    &amp;lt;/filter&amp;gt;&lt;br /&gt;    &amp;lt;encoder&amp;gt;&lt;br /&gt;      &amp;lt;pattern&amp;gt;%d{yyyy-MM-dd} %d{HH:mm:ss} %.-1level %thread %logger{36}: %m%n&amp;lt;/pattern&amp;gt;&lt;br /&gt;    &amp;lt;/encoder&amp;gt;&lt;br /&gt;  &amp;lt;/appender&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;All the joran/logback messages have disappeared. Yay.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7052660126437277618-715974311888399177?l=softwareontheinside.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareontheinside.blogspot.com/feeds/715974311888399177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://softwareontheinside.blogspot.com/2010/09/suppress-logback-initialisation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/715974311888399177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/715974311888399177'/><link rel='alternate' type='text/html' href='http://softwareontheinside.blogspot.com/2010/09/suppress-logback-initialisation.html' title='Suppress logback initialisation messages'/><author><name>Michael McCallum</name><uri>http://www.blogger.com/profile/05572248133570653791</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_4KlN3Oaw3Jw/TDRoQED7gbI/AAAAAAAAABM/dnaabSZNouA/s1600-R/00180655157585b4233b4117d5c29ac1.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7052660126437277618.post-5577893153183650567</id><published>2010-09-20T01:23:00.004+12:00</published><updated>2010-09-20T01:28:24.767+12:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='eclipse subclipse javahl kwallet gnome-keyring java'/><title type='text'>Subversion, kwallet and eclipse hangs</title><content type='html'>I noticed recently that subversion had added kwallet support, awesome.&lt;br /&gt;&lt;br /&gt;But it makes eclipse hang if you use javahl with subclipse and most like other integrations.&lt;br /&gt;&lt;br /&gt;There are two possible solutions that i've found&lt;br /&gt;&lt;br /&gt;1) use svnkit with subclipse&lt;br /&gt;&lt;br /&gt;2)Or you can tell svn command line to use a different config, eclipse will store the password encrypted as well but thats ok as long as its not plain text.&lt;br /&gt;&lt;br /&gt;I just copied my .subversion/ to .subversion-cli and added an alias to .bashrc&lt;br /&gt;&lt;br /&gt;alias svn='svn --config-dir ~/.subversion-cli'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7052660126437277618-5577893153183650567?l=softwareontheinside.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareontheinside.blogspot.com/feeds/5577893153183650567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://softwareontheinside.blogspot.com/2010/09/subversion-kwallet-and-eclipse-hangs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/5577893153183650567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/5577893153183650567'/><link rel='alternate' type='text/html' href='http://softwareontheinside.blogspot.com/2010/09/subversion-kwallet-and-eclipse-hangs.html' title='Subversion, kwallet and eclipse hangs'/><author><name>Michael McCallum</name><uri>http://www.blogger.com/profile/05572248133570653791</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_4KlN3Oaw3Jw/TDRoQED7gbI/AAAAAAAAABM/dnaabSZNouA/s1600-R/00180655157585b4233b4117d5c29ac1.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7052660126437277618.post-7197334521312167770</id><published>2010-06-29T12:15:00.005+12:00</published><updated>2010-06-29T12:33:40.574+12:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java logging slf4j exception throwable parameter'/><title type='text'>Finally exceptions as parameters in slf4j 1.6</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Exceptional parameters&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So with &lt;a href="http://www.slf4j.org/faq.html#paramException"&gt;slf4j 1.6.0&lt;/a&gt; you can do&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;try {&lt;br /&gt; something&lt;br /&gt;}&lt;br /&gt;catch (SomeException e) {&lt;br /&gt; log.error("some message {}", parameter, e);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That just makes slf4j that much easier to use. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Gotcha&lt;/span&gt;&lt;br /&gt;Be aware it is ONLY the last parameter. If the last parameter is an exception the stacktrace will be logged. Looking briefly it appears that the exception remains available for replacement so &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;log.error("Message {} error {}", "parameter", exception)"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Would look like "Message parameter error exception.getMessage", with a trace after. Don't quote me though, try it for your self.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;The old way&lt;/span&gt;&lt;br /&gt;It used to be that the &lt;span style="font-weight:bold;"&gt;e&lt;/span&gt; would just be ignored which is very substandard. As you would just never know until you deployed it and it failed and you really wanted the error.&lt;br /&gt;&lt;br /&gt;Or you would have to write&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;try {&lt;br /&gt; something&lt;br /&gt;}&lt;br /&gt;catch (SomeException e) {&lt;br /&gt; log.error("some message " + parameter, e);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Logback&lt;/span&gt;&lt;br /&gt;If you use logback you should use 0.9.22 to go with slf4j 1.6.0 I found other combinations troublesome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7052660126437277618-7197334521312167770?l=softwareontheinside.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareontheinside.blogspot.com/feeds/7197334521312167770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://softwareontheinside.blogspot.com/2010/06/finally-exceptions-as-parameters-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/7197334521312167770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/7197334521312167770'/><link rel='alternate' type='text/html' href='http://softwareontheinside.blogspot.com/2010/06/finally-exceptions-as-parameters-in.html' title='Finally exceptions as parameters in slf4j 1.6'/><author><name>Michael McCallum</name><uri>http://www.blogger.com/profile/05572248133570653791</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_4KlN3Oaw3Jw/TDRoQED7gbI/AAAAAAAAABM/dnaabSZNouA/s1600-R/00180655157585b4233b4117d5c29ac1.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7052660126437277618.post-891938066320368590</id><published>2010-05-14T20:23:00.005+12:00</published><updated>2010-05-28T22:32:09.922+12:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='maven2 release plugin subversion svn'/><title type='text'>The correct Maven release plugin in may 2010 UPDATED</title><content type='html'>In my current contract we use subversion for source control and maven2 for release management.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Release plugin running even when there are mods&lt;br /&gt;&lt;/strong&gt;I've been using the maven-release-plugin for years without issue however recently we realised that using maven 2.1.0 and release plugin 2.0-beta-8 allowed releases with working copy modifications. This is a major drawback it means if different people makes tags of the same artifact they might be different even if made seconds apart and one of the reasons for using the release plugin in the first place.&lt;br /&gt;&lt;br /&gt;After a day of testing different combinations i've ended up using Maven 2.1.0 and release-plugin 2.0-beta-9 with remoteTagging disabled. Why?&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;strong&gt;Why Maven 2.1.0 and maven-release-plugin 2.0-beta-9&lt;/strong&gt;&lt;br /&gt;We use ranges and release plugin v2.0 can't resolve ranges.&lt;br /&gt;&lt;br /&gt;Maven 2.2.1 generates bad checksums for the repository metadata (or calculates it incorrectly locally) so when you are resolving dependencies you get checksum warnings everywhere, not a good look for a professional contractor to leave warning all over and build and release process. So Maven 2.2.1 is out.&lt;br /&gt;&lt;br /&gt;Release plugin 2.0-beta-8 does not fail when there are working copy modifications.&lt;br /&gt;&lt;br /&gt;Remote tagging. Well after thinking about that for a few minutes I realised it was a terrible idea so I switched it off.&lt;br /&gt;&lt;br /&gt;In nearly every project I've ever worked on you don't need to generate a site for each artifact, attaching the sources is sufficient for IDE's and well they don't really have a site. If there was decent aggregation my depedencies into one site I might use it. But doing site just slows it down. All the test reports are in hudson anyway.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;And then I realised it didn't work&lt;/span&gt;&lt;br /&gt;You have to force the scm version being used too. Which is not too hard  just set the dependency for the plugin&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The resultant config&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;plugin&amp;gt;&lt;br /&gt;&amp;lt;artifactId&amp;gt;maven-release-plugin&amp;lt;/artifactId&amp;gt;&lt;br /&gt;&amp;lt;version&amp;gt;2.0-beta-9&amp;lt;/version&amp;gt;&lt;br /&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;&amp;lt;preparationGoals&amp;gt;clean enforcer:enforce verify&amp;lt;/preparationGoals&amp;gt;&lt;br /&gt;&amp;lt;goals&amp;gt;enforcer:enforce deploy&amp;lt;/goals&amp;gt;&lt;br /&gt;&amp;lt;tagBase&amp;gt;${svn.repo.base.url}/tags/release/${project.groupId}/&amp;lt;/tagBase&amp;gt;&lt;br /&gt;&amp;lt;remoteTagging&amp;gt;false&amp;lt;/remoteTagging&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;br /&gt;&amp;lt;dependencies&amp;gt;&lt;br /&gt;&amp;lt;dependency&amp;gt;&lt;br /&gt;&amp;lt;groupId&amp;gt;org.apache.maven.scm&amp;lt;/groupId&amp;gt;&lt;br /&gt;&amp;lt;artifactId&amp;gt;maven-scm-provider-svnexe&amp;lt;/artifactId&amp;gt;&lt;br /&gt;&amp;lt;version&amp;gt;1.3&amp;lt;/version&amp;gt;&lt;br /&gt;&amp;lt;/dependency&amp;gt;&lt;br /&gt;&amp;lt;/dependencies&amp;gt;&lt;br /&gt;&amp;lt;/plugin&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7052660126437277618-891938066320368590?l=softwareontheinside.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareontheinside.blogspot.com/feeds/891938066320368590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://softwareontheinside.blogspot.com/2010/05/correct-maven-release-plugin-in-may.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/891938066320368590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/891938066320368590'/><link rel='alternate' type='text/html' href='http://softwareontheinside.blogspot.com/2010/05/correct-maven-release-plugin-in-may.html' title='The correct Maven release plugin in may 2010 UPDATED'/><author><name>Michael McCallum</name><uri>http://www.blogger.com/profile/05572248133570653791</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_4KlN3Oaw3Jw/TDRoQED7gbI/AAAAAAAAABM/dnaabSZNouA/s1600-R/00180655157585b4233b4117d5c29ac1.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7052660126437277618.post-6651721087407338952</id><published>2010-03-24T21:11:00.010+13:00</published><updated>2010-03-25T22:40:47.088+13:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='output folder'/><category scheme='http://www.blogger.com/atom/ns#' term='release plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse maven'/><title type='text'>Eclipse is building my maven release!</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Who will find this article useful?&lt;br /&gt;&lt;/span&gt;&lt;span&gt;If you want to develop with eclipse and use the maven-release-plugin, and not have to have a special working copy for doing release:prepare&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Hold on I can't clean&lt;/span&gt;&lt;br /&gt;You will find that if you use eclipse and maven and share output directories, doing a clean from the command line will trigger eclipse to rebuild the project.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Whos is really compiling those classes&lt;/span&gt;&lt;br /&gt;It looks innocent initially but consider that eclipse is using a different compiler and classpath. Eclipse does not understand scopes for classpaths so you end up with compiler errors not being seen - i.e. class leaks from test scope for example - until someone else tries you build the project later.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How to configure it the right way using the maven-eclipse-plugin and m2elipse&lt;/span&gt;&lt;br /&gt;You should alway configure eclipse and maven to use different output directories. See an &lt;a href="http://gholam.googlecode.com/svn/trunk/net.gholam.example/m2eclipse/pom.xml"&gt;example pom&lt;/a&gt; that shows how to configure the maven-eclipse-plugin to allow you to generate eclipse project files.&lt;br /&gt;&lt;br /&gt;With that configuration you should run &lt;span style="color: rgb(0, 153, 0);"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;mvn eclipse:clean eclipse:m2eclipse&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How to configure it the right way using eclipse without the m2eclipse plugin&lt;/span&gt;&lt;br /&gt;Configure the output path to be &lt;span style="font-style: italic;"&gt;target-eclipse/classes&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How to configure when using IAM&lt;/span&gt;&lt;br /&gt;I imagine the process would be similar to the m2eclipse plugin but I've never tried, sorry.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The release plugin is your friend&lt;/span&gt;&lt;br /&gt;When using the maven release plugin - which you should do if you are thinking of using maven at all - makes this all the more important as the standard release process involves, clean, build, tag. If that build is done by eclipse you don't have the two factor validation i.e. command line and IDE to show you build is coherent.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Get rid of the extra working copy&lt;/span&gt;&lt;br /&gt;A common solution is to release from a separate working directory than the one you use to develop. Its just an extra overhead you just don't need.&lt;br /&gt;&lt;br /&gt;Hope this is useful for people out there, anything to encourage people to use the release plugin.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7052660126437277618-6651721087407338952?l=softwareontheinside.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareontheinside.blogspot.com/feeds/6651721087407338952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://softwareontheinside.blogspot.com/2010/03/eclipse-is-building-my-maven-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/6651721087407338952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/6651721087407338952'/><link rel='alternate' type='text/html' href='http://softwareontheinside.blogspot.com/2010/03/eclipse-is-building-my-maven-release.html' title='Eclipse is building my maven release!'/><author><name>Michael McCallum</name><uri>http://www.blogger.com/profile/05572248133570653791</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_4KlN3Oaw3Jw/TDRoQED7gbI/AAAAAAAAABM/dnaabSZNouA/s1600-R/00180655157585b4233b4117d5c29ac1.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7052660126437277618.post-2450021326246149896</id><published>2009-11-24T22:16:00.004+13:00</published><updated>2010-03-24T21:11:18.857+13:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='m2eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='dependency'/><category scheme='http://www.blogger.com/atom/ns#' term='archiva'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='m2e'/><category scheme='http://www.blogger.com/atom/ns#' term='repository'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>M2Eclipse and the case of the missing sources</title><content type='html'>I overheard Richard complaining the other day that no matter what he did eclipse would not download the source for one of his dependencies. The source was for a third party library that we manually added to &lt;a href="http://archiva.apache.org/"&gt;archiva&lt;/a&gt; but forgot the source the first time around.&lt;br /&gt;&lt;br /&gt;I just remembered reading a note about &lt;a href="http://maven.apache.org/plugins/maven-dependency-plugin/sources-mojo.html"&gt;dependency:sources&lt;/a&gt; caching unsuccessful requests. The cache is stored in the target directory so using mvn clean will clear it. I can't imagine why you would want this at the artifact level esp when its cached in the target directory. The whole repository manager idea is a ad-hoc solution to solve a fundamental flaw in the approach to artifact management. But I'll leave that for another day.&lt;br /&gt;&lt;br /&gt;I assume that a similar thing happens in m2e. So if you Right click on project -&gt; Maven -&gt; Download sources and nothing happens, try doing a project clean first. And see if that helps.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7052660126437277618-2450021326246149896?l=softwareontheinside.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareontheinside.blogspot.com/feeds/2450021326246149896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://softwareontheinside.blogspot.com/2009/11/m2eclipse-and-case-of-missing-sources.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/2450021326246149896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/2450021326246149896'/><link rel='alternate' type='text/html' href='http://softwareontheinside.blogspot.com/2009/11/m2eclipse-and-case-of-missing-sources.html' title='M2Eclipse and the case of the missing sources'/><author><name>Michael McCallum</name><uri>http://www.blogger.com/profile/05572248133570653791</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_4KlN3Oaw3Jw/TDRoQED7gbI/AAAAAAAAABM/dnaabSZNouA/s1600-R/00180655157585b4233b4117d5c29ac1.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7052660126437277618.post-6285459731924971730</id><published>2009-11-20T20:55:00.000+13:00</published><updated>2009-11-23T14:03:33.072+13:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='m2eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='maven2'/><category scheme='http://www.blogger.com/atom/ns#' term='testng'/><category scheme='http://www.blogger.com/atom/ns#' term='launcher'/><category scheme='http://www.blogger.com/atom/ns#' term='m2e'/><category scheme='http://www.blogger.com/atom/ns#' term='junit'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><category scheme='http://www.blogger.com/atom/ns#' term='classnotfoundexception'/><title type='text'>M2Eclipse and the dreaded ClassNotFound</title><content type='html'>&lt;h5 style="font-weight: bold;"&gt;M2Eclipse and split output directories&lt;br /&gt;&lt;/h5&gt;Recently I had the experience of some pain using &lt;a href="http://m2eclipse.sonatype.org/"&gt;m2eclipse&lt;/a&gt;, &lt;a href="http://maven.apache.org/"&gt;maven&lt;/a&gt; and &lt;a href="http://www.eclipse.org/"&gt;eclipse&lt;/a&gt;. I thought i would share this with you and hopefully save you the same pain.&lt;br /&gt;&lt;br /&gt;If you use maven2 and eclipse, m2e is very handy tool.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;It resolves dependencies and gives you a classpath as defined by the pom.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;You can edit the pom live and autocomplete things like dependency names and plugin configurations&lt;/li&gt;&lt;li&gt;It will link snapshoted projects together for refactoring&lt;/li&gt;&lt;li&gt;It will automatically link up source jars so you can browse the source of dependencies&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;I think those benefits outweight many of the issues that other people seem to baulk at.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Eclipse is my IDE&lt;/span&gt;&lt;br /&gt;&lt;p&gt;To me it seems natural that Eclipse is my IDE I use it to develop quickly with refactoring support and all the other goodness. I use maven to manage my dependencies and releases. I keep them separate so always had separate output paths for eclipse and maven. I never run maven from inside eclipse. &lt;/p&gt;&lt;p&gt;If you ask why, consider I want to do a release:prepare which does a clean, test then a tag. Now if eclipse is open and using the same output paths it will rebuild the classes as soon as I do the clean. The whole point of using maven for the release is that the classpath is &lt;span style="font-weight: bold;"&gt;very&lt;/span&gt; well defined for main compile. Eclipse merges test and compile scope and add its own jars in if you're not careful. So that means the class that are compiled might not be using the well defined classpath and I've wasted my time.&lt;br /&gt;&lt;/p&gt;So everything in my world was good until I started a new project and was forced to install a new machine. Naturally I got the latest version of the M2Eclipse plugin and everything went to custard.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;ClassNotFound&lt;/span&gt;&lt;p&gt;So I carried on with my standard approach of defining different output folders for eclipse. Maven would build to target/classes and eclipse to target-eclipse/classes. However without rhyme nor reason junit or my application runners would not find classes that eclipse had built.&lt;/p&gt;&lt;p&gt;Richard mentioned the note on the m2eclipse website saying that as of 0.9.4 the classpath was tweaked for maven in eclipse.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;So I'm running Junit in eclipse so why should I care? Well I went trawling in the code base and comparing revisions to see what was going on and this is what I found.&lt;/p&gt;&lt;ol&gt;&lt;li&gt;It was actually the third 0.9.4 release that made the change. I was previously using the first 0.9.4 release and had no problems.&lt;/li&gt;&lt;li&gt;M2Eclipse intercepts the application, junit and testng launchers and scopes them properly. That means application run in runtime scope only. Tests run in test scope.&lt;/li&gt;&lt;li&gt;Did you click?... that means that the output folders in the classapth for applications, unit and testng are the maven ones NOT the eclipse ones.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;M2Eclipse stores the output directoris in the workspace metadata separately from how eclipse defines them. It &lt;span style="font-weight: bold;"&gt;IS&lt;/span&gt; possible for this to be stale and that is incredibly confusing. This is when everything looks right everywhere but regardless your classes are still not found.&lt;/li&gt;&lt;/ol&gt;On pondering for a while I can see the reasons&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;This was too allow proper scoping of tests and applications to stop the eclipse scope bleed.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;And because of this pearler... some maven plugins hardcode there paths and won't run in eclipse. I would have thought fixing the plugins would be a better idea but in any case...&lt;/li&gt;&lt;/ol&gt;It was a bit mean to just change the default rather than allowing a new option to configure it so if you had issues with a plugin you could work around it till the plugin was fixed. As stated above I think its pretty crazy to share the output paths cause you never know what you are actually getting.&lt;br /&gt;&lt;br /&gt;Not to the solution...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How to set things up properly&lt;/span&gt;&lt;br /&gt;So you should follow the instructions on the m2eclipse &lt;a href="http://m2eclipse.sonatype.org/project-faq.html#8"&gt;website&lt;/a&gt; and set up a profile for maven in your parent pom. Or check out my &lt;a href="http://gholam.googlecode.com/svn/trunk/net.gholam.example/m2eclipse/pom.xml"&gt;example&lt;/a&gt;. The following assume you are using my example which differs only in the profile name.&lt;br /&gt;&lt;br /&gt;Because you are configuring how maven will run in eclipse as well as eclipse the easier approach is to use the maven-eclipse-plugin with the m2clipse goal&lt;br /&gt;&lt;blockquote&gt;mvn eclipse:m2eclipse&lt;br /&gt;&lt;/blockquote&gt;You will need to make sure however that&lt;br /&gt;&lt;ol&gt;&lt;li&gt;You enable the profile when you do that... mvn -Prunning-in-eclipse eclipse:m2eclipse&lt;/li&gt;&lt;li&gt;You run eclipse:clean do remove the old config file mvn -Prunning-in-eclipse eclipse:clean eclipse:m2eclipse&lt;br /&gt;&lt;/li&gt;&lt;li&gt;You don't have the project open in eclipse otherwise the workspace will end up stale and m2eclipse will see the old path. You might even need to clean your workspace if things go pear shaped&lt;/li&gt;&lt;li&gt;Configure the maven eclipse plugin to enable the profile by default otherwise when you regenerate it will be turned off again&lt;/li&gt;&lt;/ol&gt;The easiest way to see this in action is to check out&lt;br /&gt;&lt;br /&gt;svn co  http://gholam.googlecode.com/svn/trunk/net.gholam.example/m2eclipse&lt;br /&gt;&lt;br /&gt;and look at the README, you will find instruction for using the maven-eclipse-plugin in the different ways to see it generate correctly.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Don't panic&lt;/span&gt;&lt;br /&gt;Ultimately using maven2 and eclipse you will get unexpected thing happening. M2Eclipse is only 0.9.8 so still not a release. Hopefully I have provided a little insight into the things that might go wrong when spliting output directories in eclipse.&lt;br /&gt;&lt;br /&gt;If you done everything and you still have issues try starting eclipse with -clean to refresh your workspace and then opening and closing the relevant projects and see if that helps.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Credits&lt;/span&gt;&lt;br /&gt;Thanks to Richard Vowles for encouraging me to start a blog, and for announcing it on&lt;a href="http://www.illegalargument.com/"&gt; IllegalArgument.com.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7052660126437277618-6285459731924971730?l=softwareontheinside.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareontheinside.blogspot.com/feeds/6285459731924971730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://softwareontheinside.blogspot.com/2009/11/m2eclipse-and-dreaded-classnotfound.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/6285459731924971730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/6285459731924971730'/><link rel='alternate' type='text/html' href='http://softwareontheinside.blogspot.com/2009/11/m2eclipse-and-dreaded-classnotfound.html' title='M2Eclipse and the dreaded ClassNotFound'/><author><name>Michael McCallum</name><uri>http://www.blogger.com/profile/05572248133570653791</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_4KlN3Oaw3Jw/TDRoQED7gbI/AAAAAAAAABM/dnaabSZNouA/s1600-R/00180655157585b4233b4117d5c29ac1.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7052660126437277618.post-7772579941830087358</id><published>2009-11-06T09:52:00.000+13:00</published><updated>2011-10-12T23:23:06.700+13:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><category scheme='http://www.blogger.com/atom/ns#' term='javaconfig'/><category scheme='http://www.blogger.com/atom/ns#' term='component'/><title type='text'>Containment vs Configuration</title><content type='html'>&lt;font style="font-weight: bold;"&gt;What is it that I don't like about xml driven configuration for &lt;/font&gt;&lt;a style="font-weight: bold;" href="http://static.springsource.com/"&gt;spring&lt;/a&gt;&lt;font style="font-weight: bold;"&gt;?&lt;/font&gt;&lt;br /&gt;I find the xml configuration duplicates (or worse doesn't) the dependencies I have configured in the project. Its basically about coding with intention, but I'll need to give you a little background.&lt;br /&gt;&lt;br /&gt;Because I make heavy use of dependencies and fine grained artifacts (thanks &lt;a href="http://maven.apache.org/"&gt;Maven&lt;/a&gt;) containment is the natural way to define applications. If I want to use a component then I add it to the dependencies and its appears in the war. That does not mean much unless I have a way of putting them together, which is where Spring comes in.&lt;br /&gt;&lt;br /&gt;Now of course I could now define the beans in my applicationContext.xml, but didn't I just say I wanted them? I intended to include the services from the project otherwise why add the dependency, if so isn't the extra definition redundant?&lt;br /&gt;&lt;br /&gt;On discovery of the Component annotation and ClassPathBeanDefinitionScanner it was a natural fit. I could construct the context defined by the containment of the project and it would be that same containment defined by the deployed war.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;GenericApplicationContext context = new GenericApplicationContext();&lt;br /&gt;ClassPathBeadDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context, true); // true == use the default spring component filters&lt;br /&gt;scanner.scan("base.package");&lt;br /&gt;context.refresh();&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;font style="font-weight: bold;"&gt;What actually happens when this scanning occurs?&lt;/font&gt;&lt;br /&gt;Spring will look into the Classpath from base.package down and find every class thats annotated with Component, that class will be registered with the context based on its Scope which defaults to Singleton. Thats awesome but ultimately by itself useless.&lt;br /&gt;&lt;br /&gt;For example&lt;br /&gt;&lt;blockquote&gt;@Component&lt;br /&gt;public class NotVeryUsefulService {&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Gives me a bean with id &lt;font style="font-style: italic;"&gt;notVeryUsefulService&lt;/font&gt; and its not very useful. To make it useful I could give it something to play with.&lt;br /&gt;&lt;br /&gt;For example&lt;br /&gt;&lt;blockquote&gt;@Component&lt;br /&gt;public class UsefulService {&lt;br /&gt;&lt;br /&gt;private final IUsefulDataRepository usefulDataRepository;&lt;br /&gt;&lt;br /&gt;@Autowired&lt;br /&gt;public UsefulService(IUsefulDataRepository usefulDataRepository) {&lt;br /&gt;this.usefulDataRepository = usefulDataRepository;&lt;br /&gt;}&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Spring has handy things called &lt;font style="font-style: italic;"&gt;BeanPostProcessor&lt;/font&gt; that maniplate beans at various stages of their lifecycle. The Autowired post processor will require that a bean of type &lt;font style="font-style: italic;"&gt;IUsefulDataRepository&lt;/font&gt; exists in the context or throw a BeanCreationException. This is _really_ important because it ensures the &lt;a href="http://www.merriam-webster.com/dictionary/coherence"&gt;coherency&lt;/a&gt; of the context.&lt;br /&gt;&lt;br /&gt;When using a decent release process like that defined by the maven release plugin, I will always verify that my context is coherent when releasing. It is simple define a test to validate this.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;public class SanityTest {&lt;br /&gt;&lt;br /&gt;@Test&lt;br /&gt;public void verify() {&lt;br /&gt;GenericApplicationContext context = new GenericApplicationContext();&lt;br /&gt;ClassPathBeadDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context, true); // true == use the default spring component filters&lt;br /&gt;scanner.scan("base.package");&lt;br /&gt;context.refresh();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Environment configuration&lt;br /&gt;&lt;br /&gt;Strategies&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;What does that mean?&lt;br /&gt;That means that&lt;br /&gt;&lt;br /&gt;Too many moving parts&lt;br /&gt;&lt;br /&gt;Somehow I always seem to end up being heavily involved in deployment, and I've noticed that just like real machines software suffers by the number of moving parts. Everything you write a piece of code and need to configure it, you have a moving part.&lt;br /&gt;&lt;br /&gt;Let me elaborate, consider your standard operations technician who takes your war and decides to have a nosey. Every piece of code thats not configured to be used is still there.&lt;br /&gt;&lt;br /&gt;Will I ever accidentally add project with services that I don't want?&lt;br /&gt;Sure its possible but what is the impact, if I define some simple processes to review things for each Release then it will be obvious.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7052660126437277618-7772579941830087358?l=softwareontheinside.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://softwareontheinside.blogspot.com/feeds/7772579941830087358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://softwareontheinside.blogspot.com/2009/11/containment-vs-configuration.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/7772579941830087358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7052660126437277618/posts/default/7772579941830087358'/><link rel='alternate' type='text/html' href='http://softwareontheinside.blogspot.com/2009/11/containment-vs-configuration.html' title='Containment vs Configuration'/><author><name>Michael McCallum</name><uri>http://www.blogger.com/profile/05572248133570653791</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_4KlN3Oaw3Jw/TDRoQED7gbI/AAAAAAAAABM/dnaabSZNouA/s1600-R/00180655157585b4233b4117d5c29ac1.png'/></author><thr:total>0</thr:total></entry></feed>
