<?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>Molindo Techblog &#187; Maven</title>
	<atom:link href="http://techblog.molindo.at/category/java/maven/feed" rel="self" type="application/rss+xml" />
	<link>http://techblog.molindo.at</link>
	<description>Molindo Techblog – formerly known as talk-on-tech.blogspot.com</description>
	<lastBuildDate>Tue, 20 Dec 2011 10:22:19 +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>Maven/Eclipse: Build path specifies execution environment J2SE-1.5</title>
		<link>http://techblog.molindo.at/2009/04/maven-eclipse-build-path-specifies-execution-environment-j2se-15.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=maven-eclipse-build-path-specifies-execution-environment-j2se-15</link>
		<comments>http://techblog.molindo.at/2009/04/maven-eclipse-build-path-specifies-execution-environment-j2se-15.html#comments</comments>
		<pubDate>Mon, 06 Apr 2009 12:16:30 +0000</pubDate>
		<dc:creator>Stefan Fußenegger</dc:creator>
				<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://techblog.molindo.at/?p=109</guid>
		<description><![CDATA[After running `mvn eclipse:eclipse` this morning, we got a warning from eclipse, telling us that &#8220;Build path specifies execution environment J2SE-1.5. There are no JREs in the workspace strictly compatible with this environment.&#8221; We didn&#8217;t make any changes that could cause this warning, though. We deceided to leave the problem as it was and fix [...]]]></description>
			<content:encoded><![CDATA[<p>After running `mvn eclipse:eclipse` this morning, we got a warning from eclipse, telling us that <strong>&#8220;Build path specifies execution environment J2SE-1.5. There are no JREs in the workspace strictly compatible with this environment.&#8221;</strong> We didn&#8217;t make any changes that could cause this warning, though. We deceided to leave the problem as it was and fix it later &#8211; it&#8217;s only a warning anyway. However, when trying to start another project, I got another exception I haven&#8217;t ever received before. It was caused by mixing up wrong versions of different <a href="http://www.slf4j.org/">slf4j</a> JARs.</p>
<p><span id="more-109"></span>I suddenly had the feeling that ther&#8217;s something fishy with the <a href="http://maven.apache.org/plugins/maven-eclipse-plugin/">maven-eclipse-plugin</a>. And in deed, a look into the ~/.m2/repository/org/apache/maven/plugins/maven-eclipse-plugin proved me right. There is <a href="http://www.nabble.com/-ANN--Maven-Eclipse-Plugin-2.6-Released-to22835650.html">a brand new version 2.6 of the plugin</a>.</p>
<p>This new version automagically adds projects from the workspace rather than JARs from the local repository (which is cool, basically). However, that caused Eclipse to load the wrong JARs: One project depended on sl4j 1.3, another one on 1.5 and the other project. Maven perfectly resolves the version of this transient depenedency, while Eclipse picks one by chance. Gotcha#1!</p>
<p>The first warning was caused by <a href="http://maven.apache.org/plugins/maven-compiler-plugin/">maven-compiler-plugin</a> beeing configured to compile for Java 1.5 while only a 1.6 JDK was available. Gotcha#2!</p>
<p>Hopefully this post will save other people from being as clueless as I&#8217;ve been <img src='http://techblog.molindo.at/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.molindo.at/2009/04/maven-eclipse-build-path-specifies-execution-environment-j2se-15.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spotting duplicate classes in Jar files</title>
		<link>http://techblog.molindo.at/2008/10/spotting-duplicate-classes-in-jar-files.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=spotting-duplicate-classes-in-jar-files</link>
		<comments>http://techblog.molindo.at/2008/10/spotting-duplicate-classes-in-jar-files.html#comments</comments>
		<pubDate>Mon, 20 Oct 2008 17:29:00 +0000</pubDate>
		<dc:creator>Stefan Fußenegger</dc:creator>
				<category><![CDATA[Maven]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://tech.molindo.at/2008/10/spotting-duplicate-classes-in-jar-files.html</guid>
		<description><![CDATA[After more than a month it&#8217;s time for another post. Sorry to all of you for keeping you waiting &#8230; well, honestly I don&#8217;t think somebody even noticed Today, I stumbled upon a classpath related problem &#8211; once again. As I doubt that I am the only one to ever face this problem, I want [...]]]></description>
			<content:encoded><![CDATA[<p>After more than a month it&#8217;s time for another post. Sorry to all of you for keeping you waiting &#8230; well, honestly I don&#8217;t think somebody even noticed <img src='http://techblog.molindo.at/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Today, I stumbled upon a classpath related problem &#8211; once again. As I doubt that I am the only one to ever face this problem, I want to share a short shell script that came to the rescue.</p>
<p>But first, what was the problem? After adding some additional dependencies to our <a href="http://maven.apache.org/">POM</a> &#8211; quite carelessly I have to admit &#8211; <a href="http://www.setlist.fm/">our application</a> started sending mails without subject, sender address and messed up special characters. Interestingly enough, I didn&#8217;t touch the mail part at all. I added <a href="http://cxf.apache.org/">Apache CXF</a> dependencies, i.e. web service stuff. So what was wrong?<br />
<span id="more-29"></span><br />
CXF comes with quite a lot of transitive dependencies (that should be declared optional, I&#8217;d say), including some <a href="http://geronimo.apache.org/">Geronimo</a> Spec jars. One of them was org.apache.geronimo.specs:geronimo-javamail_1.4_spec that superseded classes from <a href="http://java.sun.com/products/javamail/">javax.mail:mail</a>. A simple <a href="http://www.google.at/search?q=maven+exclusion">exclusion</a> fixed the problem.</p>
<p>However, I wanted to be prepared for the next time as this tends to happen quite regularly with a growing number of transitive dependencies. There are packages with same content and different id, (e.g. org.mortbay.jetty:servlet-api and javax.servlet:servlet-api), artifacts that contain subsets of other artifacts (e.g. org.springframework:spring contains everything from org.springframework:spring-web), and artifacts that should be replaced in favor of others (e.g. <a href="http://www.slf4j.org/">slf4j</a> instead of <a href="http://commons.apache.org/logging/">commons-logging</a>.</p>
<p>That&#8217;s why I wrote this little bash script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">for</span> lib <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.jar'</span><span style="color: #000000; font-weight: bold;">`</span>; <span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #000000; font-weight: bold;">for</span> class <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">unzip</span> <span style="color: #660033;">-l</span> <span style="color: #007800;">$lib</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #660033;">-o</span> <span style="color: #ff0000;">'[^ ]*.class$'</span><span style="color: #000000; font-weight: bold;">`</span>; <span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #007800;">class</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$class</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> s<span style="color: #000000; font-weight: bold;">/</span>\\.class<span style="color: #000000; font-weight: bold;">//</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> s<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>-.\<span style="color: #000000; font-weight: bold;">/</span>$<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">/</span>_<span style="color: #000000; font-weight: bold;">/</span>g<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">existing</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #ff0000;">&quot;echo <span style="color: #007800;">$CLS_</span><span style="color: #007800;">${class}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$existing</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$lib</span> <span style="color: #007800;">$existing</span>&quot;</span>; <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">eval</span> CLS_<span style="color: #800000;">${class}</span>=<span style="color: #ff0000;">&quot;(&quot;</span><span style="color: #800000;">${lib}</span> <span style="color: #800000;">${existing}</span><span style="color: #ff0000;">&quot;)&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">uniq</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-nr</span></pre></div></div>

<p>These few lines of code print packages and the number of their common classes. Sample output is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">stf<span style="color: #000000; font-weight: bold;">@</span>crabman:<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>my<span style="color: #000000; font-weight: bold;">/</span>webapp$ duplicates.sh
<span style="color: #000000;">127</span> .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>aspectjweaver-1.5.3.jar .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>aspectjrt-1.5.3.jar
<span style="color: #000000;">117</span> .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>spring-2.0.8.jar .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>spring-web-2.0.8.jar
<span style="color: #000000;">83</span> .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>commons-beanutils-1.7.0.jar .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>commons-beanutils-core-1.7.0.jar
<span style="color: #000000;">38</span> .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>servlet-api-<span style="color: #000000;">2.3</span>.jar .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>servlet-api-<span style="color: #000000;">2.5</span>-6.1.11.jar
<span style="color: #000000;">10</span> .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>commons-beanutils-core-1.7.0.jar .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>commons-collections-<span style="color: #000000;">3.2</span>.jar
<span style="color: #000000;">10</span> .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>commons-beanutils-1.7.0.jar .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>commons-beanutils-core-1.7.0.jar .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>commons-collections-<span style="color: #000000;">3.2</span>.jar
<span style="color: #000000;">9</span> .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>spring-2.0.8.jar .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>aopalliance-<span style="color: #000000;">1.0</span>.jar
<span style="color: #000000;">6</span> .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>commons-logging-<span style="color: #000000;">1.1</span>.jar .<span style="color: #000000; font-weight: bold;">/</span>WEB-INF<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jcl104-over-slf4j-1.5.0.jar</pre></div></div>

<p>The code isn&#8217;t very fast, but makes solving a common classpath problem a lot less painful. (Note that I am using plain unzip instead of jar as didn&#8217;t have a JDK installed on this server/)</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.molindo.at/2008/10/spotting-duplicate-classes-in-jar-files.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Maven: Unable to find resources in test cases?</title>
		<link>http://techblog.molindo.at/2007/11/maven-unable-to-find-resources-in-test-cases.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=maven-unable-to-find-resources-in-test-cases</link>
		<comments>http://techblog.molindo.at/2007/11/maven-unable-to-find-resources-in-test-cases.html#comments</comments>
		<pubDate>Fri, 09 Nov 2007 10:34:00 +0000</pubDate>
		<dc:creator>Stefan Fußenegger</dc:creator>
				<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://tech.molindo.at/2007/11/maven-unable-to-find-resources-in-test-cases.html</guid>
		<description><![CDATA[Just right now, I was once again fighting the beast called Maven. This time, my JUnit tests failed with Maven although they used to work within in Eclipse. The test cases failed due to missing resources. I searched for these resources using the ClassLoader.getResource() mechanism which always worked just fine so far. After some swearing [...]]]></description>
			<content:encoded><![CDATA[<p>Just right now, I was <a href="http://talk-on-tech.blogspot.com/2007/10/maven-curse-or-blessing.html">once again</a> fighting the beast called <a href="http://maven.apache.org/">Maven</a>. This time, my <a href="http://www.junit.org/">JUnit tests</a> failed with Maven although they used to work within in <a href="http://www.eclipse.org/">Eclipse</a>. The test cases failed due to missing resources. I searched for these resources using the <a href="http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource%28java.lang.String%29"><code>ClassLoader.getResource()</code></a> mechanism which always worked just fine so far.</p>
<p>After some swearing and investigation I finally found the problem: In my code, I used <a href="http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getSystemResource%28java.lang.String%29"><code>ClassLoader.getSystemResource(...)</code></a> to find a resource, which internally calls <a href="http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getSystemClassLoader%28%29"><code>ClassLoader.getSystemClassloader()</code></a>. However, with <a href="http://maven.apache.org/plugins/maven-surefire-plugin/">Maven&#8217;s Surefire plugin</a>, the system classloader does neither contain target/classes nor target/test-classes in its classpath. Therefore, you have to make sure, that the classloader that loaded the test cases (and the tested classes) is used to get the resources.</p>
<p>Therefore, instead of</p>
<p><code>ClassLoader.getSystemResource(...)</code></p>
<p>always use</p>
<p><code>this.getClass().getClassLoader().getResource(...)</code></p>
<p>Problem solved!</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.molindo.at/2007/11/maven-unable-to-find-resources-in-test-cases.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven &#8211; Curse or Blessing?</title>
		<link>http://techblog.molindo.at/2007/10/maven-curse-or-blessing.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=maven-curse-or-blessing</link>
		<comments>http://techblog.molindo.at/2007/10/maven-curse-or-blessing.html#comments</comments>
		<pubDate>Tue, 30 Oct 2007 22:22:00 +0000</pubDate>
		<dc:creator>Stefan Fußenegger</dc:creator>
				<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://tech.molindo.at/2007/10/maven-curse-or-blessing.html</guid>
		<description><![CDATA[Today I spent several hours fighting a beast called Maven. I started using Maven some days ago for a new project. But each and every day I was asking myself the question: &#8220;Maven &#8211; curse or blessing?&#8221;. If you google around a litte bit, you can find lots of developers swearing in their blogs &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Today I spent several hours fighting a beast called <a href="http://maven.apache.org/">Maven</a>. I started using Maven some days ago for a new project. But each and every day I was asking myself the question: &#8220;Maven &#8211; curse or blessing?&#8221;. If you google around a litte bit, you can find lots of developers swearing in their blogs &#8211; and so was I today.</p>
<p>Everything was working nicely until I carelessly added several dependencies this morning. Suddenly, my <a href="http://wicket.apache.org/">Wicket</a>-based webapp stopped working with some strange exception. A class in <a href="http://www.mortbay.org/">Jetty</a> called a method that was not found in the <a href="http://java.sun.com/products/servlet/">servlet API (javax.servlet)</a>. Well, rather strange, I thought. After a little online-research I found that this method was introduced in version 2.5 of the servlet API. I doublechecked with the Jetty docs and yes, Jetty 6.1 implements exactly this version of the servlet API. Well &#8230; so what&#8217;s wrong?</p>
<p>But then I noticed that Maven added two different versions of the servlet API to my dependencies: 2.3 and 2.5. But isn&#8217;t Maven meant for resolving such conflicts? In deed it is and it actually wasn&#8217;t Maven&#8217;s fault. While Jetty comes with its own version of javax.servlet (called <a href="http://www.mvnrepository.com/artifact/org.mortbay.jetty/servlet-api-2.5">org.mortbay.jetty:servlet-api-2.5</a> in Maven), Maven added <a href="http://www.mvnrepository.com/artifact/javax.servlet/servlet-api">javax.servlet:servlet-api</a> (version 2.3) as a transient dependency.</p>
<p>So how to get rid of unwanted dependencies? In Maven it is possible to exclude transient dependencies. The problem is that you have to do that for every package that depends on this unwanted package. You have two choices to find out which package depends on it: you either look at the POM of every dependency and the POMs of their dependencies &#8230; or you look at the dependency tree that can be generated with <a href="http://maven.apache.org/plugins/maven-dependency-plugin/">Maven&#8217;s dependency plugin</a> (<code>mvn dependency:tree</code>). Well, the tree-task didn&#8217;t work for me, for whatever reason. I remembered that the dependency tree was also part of the project website that can be generated with <a href="http://maven.apache.org/plugins/maven-site-plugin/">Maven&#8217;s site plugin</a>. I did generate the project&#8217;s website (<code>mvn site</code>) and there was also a dependency tree &#8230; but javax.servlet:servlet-api wan&#8217;t in that tree &#8230; but in the list of transient dependencies. If I remember correctly that was were I started swearing. So it was time to manually inspect all the POMs. (For the sake of completeness: I think that the servlet API wasn&#8217;t in the dependency tree as it only contains three levels of dependencies.)</p>
<p>I started analysing the POMs one-by-one and found out several interesting things:
<ul>
<li>Some POMs added junit as dependency without specifying the test-scope (it would therefore be added to the generated WAR file)</li>
<li>Optional dependencies and alternatives are not defined consistently: sometimes all optional dependencies are normal dependencies, sometimes none of the alternatives is a dependency, &#8230; altogether it&#8217;s quite messy</li>
</ul>
<p>I finally found the dependency that added version 2.3 of the servlet-api to my dependencies: <a href="http://commons.apache.org/logging/">commons-logging</a>. Yes, exactly that commons-logging that is basically meant to write some lines into a file. Why does it depend on the servlet API? Because it has its own logger that is supported by commons-logging and the commons-logging POM has dependencies on all supported logging implementations:
<ul>
<li><a href="http://www.mvnrepository.com/artifact/log4j/log4j">log4j:log4j</a></li>
<li><a href="http://www.mvnrepository.com/artifact/logkit/logkit">logkit:logkit</a></li>
<li><a href="http://www.mvnrepository.com/artifact/avalon-framework/avalon-framework">avalon-framework:avalon-framework</a></li>
<li>javax.servlet:servlet-api</li>
</ul>
<p>So you have to explicitly exclude the dependencies you don&#8217;t need &#8230; or you will deploy your desktop application with the servlet API. And the best thing of all: you have to do that for each and every dependency that introduces commons-logging to your project dependencies.</p>
<p>I then decided not only to exclude all unnecessary logging-frameworks but commons-logging all together in favour of <a href="http://www.slf4j.org/">slf4j</a>. Unfortunately, it&#8217;s not possible to globally exclude a package all together &#8211; as Maven developers want to &#8220;protect&#8221; you from doing that &#8211; excluding commons-logging can get quite complicated. <a href="http://www.blogger.com/profile/15976519439979651010">Erik van Oosten</a> came up with a nice workaround for this topic. He <a href="http://day-to-day-stuff.blogspot.com/2007/10/announcement-version-99-does-not-exist.html">announced a faked Maven repository</a> that offers an empty jar file with version 99.0-does-not-exist for all artefacts you ask it for. So if you explicitly depend on this version, no lower versions will be added to your dependencies. And if you mark this dependency as provided, it also won&#8217;t be included in your WAR files. Yes, it&#8217;s a hack, but it&#8217;s a nice one <img src='http://techblog.molindo.at/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Besides a small problem with empty jar files that Erik is going to fix (see <a href="http://day-to-day-stuff.blogspot.com/2007/10/announcement-version-99-does-not-exist.html#c8800714530520307116">my comment in Erik&#8217;s blog</a>) the whole thing works like a charm &#8211; no commons-logging, no version conflicts with the servlet API, everything is fine.</p>
<p>I think I still can&#8217;t answer the question whether Maven is a curse or a blessing. The only thing I can say is that Maven has its problems, but also great power. I&#8217;d say it&#8217;s very important that you really go into the topic before you use it. Maven is big, *really* big. It&#8217;s not like <a href="http://ant.apache.org/">Ant</a> that you can start using after reading a short tutorial. If you don&#8217;t know how Maven works it will certainly kick your ass. But if you know how to handle that beast, it really kicks ass <img src='http://techblog.molindo.at/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>However, I am still not happy with the official Maven repositories. They are completely messy and Maven is not really helpful in coping with this mess. I would really love to see something similar to <a href="http://www.debian.org/">Debian</a> package management: with provides, depends, suggests, recommends, meta-packages, nice updates &#8230; and a repository that is under tight control. Maybe even the <a href="http://ant.apache.org/ivy/">new Ant subproject Ivy</a> is a step into the right direction (I would love to see it in action together with Maven). But for the moment the only thing you can do is to have a close look on each and every POM in your tree of dependencies. Yes, it is extensive work, but it&#8217;s the only way to reduce your dependencies to a minimum &#8230; And dear Maven developers: please don&#8217;t try to prevent us from doing evil things, as we might do them anyway (like using version 99.0-does-not exist). Just give as the freedom to do what we want to do.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.molindo.at/2007/10/maven-curse-or-blessing.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tapestry/Spring Integration</title>
		<link>http://techblog.molindo.at/2007/08/tapestryspring-integration.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tapestryspring-integration</link>
		<comments>http://techblog.molindo.at/2007/08/tapestryspring-integration.html#comments</comments>
		<pubDate>Wed, 08 Aug 2007 15:11:00 +0000</pubDate>
		<dc:creator>Michael Sparer</dc:creator>
				<category><![CDATA[Maven]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Tapestry]]></category>

		<guid isPermaLink="false">http://tech.molindo.at/2007/08/tapestryspring-integration.html</guid>
		<description><![CDATA[In the last weeks I started to have a look at different web frameworks and came across Tapestry5. Having watched the screencasts on the website, I began to like it straight away. Although still in development (the release is planned in fall 2007), it offers some nice features. The most impressive one is that you [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:100%"><span style="font-family:arial">In the last weeks I started to have a look at different web frameworks and came across <a href="http://tapestry.apache.org/tapestry5/">Tapestry5</a>. Having watched the <a href="http://tapestry.apache.org/tapestry5/screencast.html">screencasts</a> on the website, I began to like it straight away. Although still in development (the release is planned in fall 2007), it offers some nice features. The most impressive one is that you do not have to restart the servlet-container to apply changes in java files. But for me personally, the features I appreciate the most are that you don&#8217;t have to bother with jsp-specific stuff (such as  &#8211; Ugh!) and it lets you get rid of the servlet mapping stuff in the web.xml. That&#8217;s nice isn&#8217;t it? I also read some posts claiming that <a href="http://wicket.apache.org/features.html">Apache Wicket</a> already provides such features. I started reading the Wicket docs, but stopped when I saw that there&#8217;s a need to inherit from a Wicket base-class <span style="font-weight: bold">and</span> to define servlet-mappings in the web.xml &#8211; as stated above, I don&#8217;t like too many manual servlet-mappings and I also prefer dealing with <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object">POJOs</a>.</p>
<p></span><span style="font-family:arial">After playing around with Tapestry by implementing the screencasts and the tutorial, I tried to inject <a href="http://www.springframework.org/">Spring2 </a>managed-beans into a Tapestry5 app. I found a load of examples/tutorials online, but they either dealt with tapestry4 and/or spring1.2.x. There also is a <a href="http://tapestry.apache.org/tapestry5/tapestry-spring/index.html">tutorial</a> on the Tapestry site from its creator <a href="http://tapestryjava.blogspot.com/">Howard Lewis Ship</a>. Unfortunately, he missed pointing out that it is vital to add another dependency, the tapestry-spring library. </span><span style="font-family:arial">Worth mentioning is, that the tapestry-spring dependency differs from the tapestry-spring.jar available on the <a href="http://howardlewisship.com/tapestry-javaforge/tapestry-spring/">project page</a> which I used at first. It took me quite a while to find out what&#8217;s wrong until I found a hint in the tapestry-mailing-list. </span><span style="font-family:arial">A user there suggested to add the tapestry-spring dependency to your maven2 pom.xml. After including the library, a simple @Inject was enough to inject a spring-bean into the tapestry-class. The dependency should look as follows:</span>
<pre>&lt;dependency&gt; &lt;groupid&gt;org.apache.tapestry&lt;/groupid&gt; &lt;artifactid&gt;tapestry-spring&lt;/artifactid&gt; &lt;version&gt;${tapestry-release-version}&lt;/version&gt;&lt;/dependency&gt;</pre>
<p><span style="font-family:arial">The hacks I did with Tapestry5 made me to get in touch with <a href="http://maven.apache.org/">Maven2</a> for the first time. Together with the <a href="http://m2eclipse.codehaus.org/">eclipse-plugin</a>, it was very easy to add dependencies to the project and to build and pack the application. That&#8217;s of course only the tip of the iceberg, and I&#8217;ll definitely have to get a bit more into maven &#8211; as it really looks like it offers some nice features. And also I have to prove if <a href="http://jelmer.jteam.nl/?p=21">Jelmer Kupurus&#8217;s statement</a> is right or not <img src='http://techblog.molindo.at/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </span></p>
<p><span style="font-family:arial">Enough for now, I&#8217;d love to receive some comments with your experience with Tapestry5 and Spring integration!</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.molindo.at/2007/08/tapestryspring-integration.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

