<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>null</title>
	<atom:link href="http://blog.sadogursky.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sadogursky.com</link>
	<description>NullPointerException, probably...</description>
	<lastBuildDate>Tue, 22 May 2012 10:02:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.sadogursky.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>null</title>
		<link>http://blog.sadogursky.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.sadogursky.com/osd.xml" title="null" />
	<atom:link rel='hub' href='http://blog.sadogursky.com/?pushpress=hub'/>
		<item>
		<title>On Using the Right Tool for the Job</title>
		<link>http://blog.sadogursky.com/2012/05/21/on-using-the-right-tool-for-the-job/</link>
		<comments>http://blog.sadogursky.com/2012/05/21/on-using-the-right-tool-for-the-job/#comments</comments>
		<pubDate>Mon, 21 May 2012 14:57:08 +0000</pubDate>
		<dc:creator>jbaruch</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[metaClass]]></category>
		<category><![CDATA[reflection]]></category>

		<guid isPermaLink="false">http://blog.sadogursky.com/?p=219</guid>
		<description><![CDATA[Disclaimer: The code samples in the post below are for brain teasing only. Do not, I repeat, do not ever do such things for any other purpose! A friend of mine is a big fan of puzzlers. Any puzzlers, including programming ones. Here&#8217;s his latest and greatest: Write some code in the static initializer to make the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=219&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h6>Disclaimer: The code samples in the post below are for brain teasing only. Do not, I repeat, do not ever do such things for any other purpose!</h6>
<p><a href="http://jbaruch.files.wordpress.com/2012/05/2012-05-22_124729.png"><img class=" wp-image-232 alignnone" title="counterexample" src="http://jbaruch.files.wordpress.com/2012/05/2012-05-22_124729.png?w=308&h=87" alt="" width="308" height="87" /></a></p>
<p>A friend of mine is a big fan of puzzlers. Any puzzlers, including programming ones. Here&#8217;s his latest and greatest:</p>
<p><em>Write some code in the static initializer to make the assert pass:</em></p>
<p><pre class="brush: java;">
public class Test {
 static {
//Write some code here
 }

public static void main(String[] args) {
 Integer a = 20;
 Integer b = 20;
 assert (a + b == 60);
 }
}
</pre></p>
<p>Don&#8217;t forget to enable assertions if you want to solve this one (-ea as VM parameter).</p>
<p>If you solved it, or don&#8217;t feel like puzzlers, read on for the solution and the punchline.</p>
<p><span id="more-219"></span></p>
<p>First, the solution: You need to know refection and two facts about Integers to solve this one:</p>
<ol>
<li>Integers have cache for all values in range -128 to 127.</li>
<li>Integers use that cache during auto-boxing (as opposite to using Integer&#8217;s constructor, for example).</li>
</ol>
<p>Well, you also need to know the exact implementation of the Integer class to figure out where the cache is and what&#8217;s the name, but rt.jar sources are here for the rescue. Guess what? the cache is a private variable inside a private inner class. Joy-joy.</p>
<p>Here&#8217;s the plan:</p>
<ol>
<li>Get Integer&#8217;s class object.</li>
<li>Get the list of its inner classes.</li>
<li>Find the right one (what a relief, it only has one. Or not &#8211; it is subject to change in future versions since we are digging in highly encapsulated stuff . Duh.)</li>
<li>Get the cache field from it.</li>
<li>It&#8217;s private, set it to accessible in order to get the value of the field.</li>
<li>Change the value of &#8220;20&#8243; to be &#8220;30&#8243;</li>
</ol>
<p>Here&#8217;s the code of the static initializer:</p>
<p><pre class="brush: java;">
 static {
try {
 Class&lt;?&gt;[] declaredClasses = Integer.class.getDeclaredClasses();
 Field cacheField = declaredClasses[0].getDeclaredField(&quot;cache&quot;);
 cacheField.setAccessible(true);
 ((Integer[]) cacheField.get(null))[20 + 128] = 30;
 } catch (Exception e) { e.printStackTrace(); }
 }
</pre></p>
<p>Personally, I hate it. It&#8217;s ugly, it messes with very low-level encapuslated stuff that one even doesn&#8217;t suppose to know, and it is fragile (e.g. it won&#8217;t work if Integer is created with constructor).</p>
<p>And fairly, we just got lucky. If Integers did not have the cache then we would not  have any way to change what &#8220;+&#8221; does!</p>
<p>So, why this simple trick is so difficult to impossible to implement? Simple &#8211; Java is not intended for those tricks. Java is static, and it is good! It means that you can rely on it. 20+20 will (almost always) be 40. That is Good.</p>
<p>If you want to do dynamic stuff, like changing the behavior of  a &#8220;+&#8221; operator, you&#8217;d better use the right tool for the job. E.g. &#8211; Groovy.</p>
<p>Here&#8217;s the Groovy version of the puzzler:</p>
<p><pre class="brush: groovy;">
//Write some code here
Integer a = 20
Integer b = 20
assert 60 == a + b
</pre></p>
<p>Looks almost the same (without the main() mess, some ridiculous semicolons and the need to include -ea in VM parameters), but the difference in the way to achieve the desired is huge. Since Groovy is dynamic it is intended to do stuff like changing the behavior of the plus sign. Here&#8217;s the facts about Groovy that you need to know to solve this one:</p>
<ol>
<li>Groovy operates with wrappers, always.</li>
<li>Groovy implements operators though methods. &#8220;+&#8221; is implemented in plus() method.</li>
<li>Using Groovy&#8217;s MetaClasses you can easily replace method with any closure.</li>
</ol>
<p>Here&#8217;s the plan:</p>
<ol>
<li>Get Integer&#8217;s MetaClass.</li>
<li>Replace plus() method with implementation that returns 60.</li>
</ol>
<p>That&#8217;s all. Really. Here&#8217;s the code:</p>
<p><pre class="brush: groovy;">
Integer.metaClass.plus = {int i -&gt; 60 }
</pre></p>
<p>Nuff said. Now you only have 2 options. Stop doing those ugly tricks, or at least do it with the right tools for the job.</p>
<br />Filed under: <a href='http://blog.sadogursky.com/category/development/'>Development</a> Tagged: <a href='http://blog.sadogursky.com/tag/groovy/'>groovy</a>, <a href='http://blog.sadogursky.com/tag/java/'>java</a>, <a href='http://blog.sadogursky.com/tag/metaclass/'>metaClass</a>, <a href='http://blog.sadogursky.com/tag/reflection/'>reflection</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jbaruch.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jbaruch.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jbaruch.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jbaruch.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jbaruch.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jbaruch.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jbaruch.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jbaruch.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jbaruch.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jbaruch.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jbaruch.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jbaruch.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jbaruch.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jbaruch.wordpress.com/219/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=219&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sadogursky.com/2012/05/21/on-using-the-right-tool-for-the-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3d73332968c0bf62e1ece7299deb8b37?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JBaruch</media:title>
		</media:content>

		<media:content url="http://jbaruch.files.wordpress.com/2012/05/2012-05-22_124729.png" medium="image">
			<media:title type="html">counterexample</media:title>
		</media:content>
	</item>
		<item>
		<title>QCon 2012 &#8211; Perfect as Everything in London Should Be</title>
		<link>http://blog.sadogursky.com/2012/03/16/qcon-2012-perfect-as-everything-in-london-should-be/</link>
		<comments>http://blog.sadogursky.com/2012/03/16/qcon-2012-perfect-as-everything-in-london-should-be/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 07:17:40 +0000</pubDate>
		<dc:creator>jbaruch</dc:creator>
				<category><![CDATA[Artifactory]]></category>
		<category><![CDATA[Confereneces]]></category>
		<category><![CDATA[JFrog]]></category>
		<category><![CDATA[artifactory]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[jfrog]]></category>
		<category><![CDATA[QCon]]></category>

		<guid isPermaLink="false">http://blog.sadogursky.com/?p=207</guid>
		<description><![CDATA[This post was originally posted on &#8216;From the Frog&#8217;s Mouth&#8216;. You&#8217;re welcome to comment here or there. It was JFrog&#8216;s second QCon London, and it just gets better. Imagine: even the London weather was perfect, not to mention the sessions, booth traffic, show organization and food (what, you say, good English food? Well, great IndoPak food, at [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=207&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div style="background-attachment:scroll;background-color:#f7f7f1;background-image:none;display:block;height:51px;line-height:15px;min-height:51px;width:95%;border:1px solid #e3e3d1;margin:0 5px 0 0;padding:5px 2px 3px 10px;"><span style="color:#000000;">This post was originally posted on &#8216;<a title="From the Frog's Mouth" href="http://blogs.jfrog.org" target="_blank">From the Frog&#8217;s Mouth</a>&#8216;.<br />
</span><span style="color:#000000;">You&#8217;re welcome to comment here or <a title="QCon 2012 - Perfect as Everything in London Should Be" href="http://blogs.jfrog.org/2012/03/qcon-2012-perfect-as-everything-in.html" target="_blank">there</a>.</span><strong><span style="color:#000000;"><br />
</span></strong></div>
<p>It was <a href="http://www.jfrog.com/">JFrog</a>&#8216;s second QCon London, and it just gets better. Imagine: even the London weather was perfect, not to mention the sessions, booth traffic, show organization and food (what, you say, good English food? Well, great IndoPak food, at least). Due to high demand by sponsors, the exhibition took place on two floors (as opposed to one floor last year). Our JFrog booth was located in the same place as in 2011. We’re getting used to the place and are looking forward to returning next March!</p>
<div><a href="http://qconlondon.com/dl/qcon-london-2012/web/photo/Londonview600x294.jpg"><img src="http://qconlondon.com/dl/qcon-london-2012/web/photo/Londonview600x294.jpg" alt="" width="640" height="312" border="0" /></a></div>
<p>The speaker panel was extremely impressive, featuring gurus like Martin Fowler, Adrian Cockcroft (the man behind Netflix’ cloud), Dwight Merriman (co-creator of MongoDB), Damien Katz (creator of CouchDB) and Rich Hickey (creator of Clojure).</p>
<p>The conference started with two training days &#8211; six full-day tutorials each. From my perspective, the most interesting two tutorials were “<a href="http://qconlondon.com/london-2012/presentation/Cloud%20Architecture">Cloud Architecture</a>” by Adrian Cockcroft, where he shared the architecture, best practices and decisions behind Netflix’ cloud (which Artifactory is proud to be a part of) and “<a href="http://qconlondon.com/london-2012/presentation/Continuous%20Delivery%20-%20SOLD%20OUT">Continuous Delivery</a>” by ThoughtWorks’ Tom Sulston (that’s as close to the roots of the famous <a href="http://www.amazon.com/gp/product/0321601912">“Continuous Delivery” book</a> as you can get). For me, the most fascinating thing in the Continuous Delivery process as ThoughtWorks sees it, is that its virtues are exactly the same as we based our <a href="http://qconlondon.com/london-2012/presentation/Cloud%20Architecture">Artifactory</a> upon back in 2006: DevOps automation and rapid release cycle. We appreciated the validation of our concept.</p>
<p>The remaining three days of the week were all-day sessions. It’s impossible to review such a significant number of talks in one blog post, so I’ll concentrate only on the excellent keynote addresses (with one exception).</p>
<p><a href="http://qconlondon.com/london-2012/presentation/The%20Data%20Panorama">Martin’s conference-opening keynote speech</a> was about data. The main feature of modern data is that it is bigger than you think. Polyglot storage in general and various kinds of NoSQL look like the right solution.</p>
<p>My favorite keynotes are usually the evening ones. A beer in your hand makes any amusing talk even more enjoyable. One named “<a href="http://qconlondon.com/london-2012/presentation/Developers%20Have%20a%20Mental%20Disorder">Developers Have a Mental Disorder</a>” I couldn’t miss! Greg Young gave a great show, funny and entertaining, about serious dilemmas in software development that we, the developers, prefer to ignore. The brightest example, of course is the downside of DRY (did you ever think about one?). By removing duplication, we increase coupling, which can be much worse.</p>
<p><a href="http://qconlondon.com/london-2012/presentation/Simple%20Made%20Easy">Thursday morning’s keynote address </a>was delivered by Rich Hickey. He spoke about the differences between “Simple” and “Easy”. Sounds pretty similar, but in fact they are very far from being the same. Antonyms to the rescue: simple vs. complex, while easy vs. hard. Now it’s clear &#8211; we need to strive to prevent and remove complexity (go simple) without being afraid of the hard. Choosing easiness may end up creating complexity. Things which are easy, but complex, include OOP, mutable state, imperative loops and frameworks (especially ORM). Things which are simple, but not necessarily easy (at least not until you get them), are LISP-ish languages, like Clojure.</p>
<p><a href="https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/419636_10150618059748962_751098961_9180344_430460510_n.jpg"><img class="alignright" style="border-color:initial;border-style:initial;border-width:0;" src="https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/419636_10150618059748962_751098961_9180344_430460510_n.jpg" alt="" width="320" height="240" border="0" /></a><a href="http://qconlondon.com/london-2012/presentation/Build%20Trust%20in%20Your%20Build%20to%20Deployment%20Flow!">My session</a> also took place on Thursday, in relatively small room, about 70 people. I was more than happy to see that it was almost packed. I spoke about building trust in your build process by selecting the right tools for the job (of course, we consider Artifactory as one). I also spoke about the problems of DevOps in the word of Continuous Delivery in the cloud and the rapid release cycle of SaaS applications. I stressed the huge timeshare of binaries in ALM process and the importance of using a tool that really understands binaries to deal with them. That’s exactly the reason why we developed Artifactory.</p>
<p>Half of my session was dedicated to live demos, which went smoothly, incredible as it may sound. According to the feedback received, my talk was well accepted, and hopefully will be useful to some of the attendants for building easier and more reliable release processes. The Q&amp;A session continued at our booth, where we repeatedly did live demonstrations and received excellent feedback each time. If you want to get a feeling of my talk, <a href="http://www.slideshare.net/jbaruch/build-trust-in-your-buildtodeployment-flow">here’s the slide-deck</a>.</p>
<p>Friday was the last day of the conference. It started hard with a highly technical keynote address by John Allspaw with a scary name: “<a href="http://qconlondon.com/london-2012/presentation/Resilient%20Response%20In%20Complex%20Systems">Resilient Response In Complex Systems</a>”. For someone like me, who doesn’t deal on a daily basis with Disaster Recovery, the session was astonishing. Looking behind the curtain of that kitchen reveals a totally different way of thinking and planning. It may be how individuals and teams have to perform during a disaster (e.g. personal heroism is bad even if successful; it sends the wrong message to the team), or simulating disasters on live production systems (I never could even dare to think about that). The most obvious, but still eye-opening advice that John gave is to learn from successes, not only from failures. It can give us a lot of information and happens much more frequently, no? The only organization with which I am familiar that embraces that technique is the Israeli Air Force.</p>
<p>To sum up, the conference was great by every measure: technical sessions, attendance, networking, Artifactory exposure, and after-show quality time. Thank you, InfoQ, for this wonderful event in London. QCon was a great starting shot for JFrog’s “<a href="https://www.facebook.com/artifrog/posts/264469456952764">Busy March</a>”. You still can catch Fredric and Yoav giving talks on various events in US and Europe.</p>
<br />Filed under: <a href='http://blog.sadogursky.com/category/artifactory-2/'>Artifactory</a>, <a href='http://blog.sadogursky.com/category/confereneces/'>Confereneces</a>, <a href='http://blog.sadogursky.com/category/jfrog/'>JFrog</a> Tagged: <a href='http://blog.sadogursky.com/tag/artifactory/'>artifactory</a>, <a href='http://blog.sadogursky.com/tag/conferences/'>Conferences</a>, <a href='http://blog.sadogursky.com/tag/jfrog-2/'>jfrog</a>, <a href='http://blog.sadogursky.com/tag/qcon/'>QCon</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jbaruch.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jbaruch.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jbaruch.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jbaruch.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jbaruch.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jbaruch.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jbaruch.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jbaruch.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jbaruch.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jbaruch.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jbaruch.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jbaruch.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jbaruch.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jbaruch.wordpress.com/207/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=207&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sadogursky.com/2012/03/16/qcon-2012-perfect-as-everything-in-london-should-be/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3d73332968c0bf62e1ece7299deb8b37?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JBaruch</media:title>
		</media:content>

		<media:content url="http://qconlondon.com/dl/qcon-london-2012/web/photo/Londonview600x294.jpg" medium="image" />

		<media:content url="https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/419636_10150618059748962_751098961_9180344_430460510_n.jpg" medium="image" />
	</item>
		<item>
		<title>Dependency Management with .NET &#8211; Doing it Right</title>
		<link>http://blog.sadogursky.com/2012/02/06/dependency-management-with-net-doing-it-right/</link>
		<comments>http://blog.sadogursky.com/2012/02/06/dependency-management-with-net-doing-it-right/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 11:39:35 +0000</pubDate>
		<dc:creator>jbaruch</dc:creator>
				<category><![CDATA[Artifactory]]></category>
		<category><![CDATA[JFrog]]></category>
		<category><![CDATA[artifactory]]></category>
		<category><![CDATA[jfrog]]></category>
		<category><![CDATA[nuget]]></category>
		<category><![CDATA[teamcity]]></category>

		<guid isPermaLink="false">http://jbaruch.wordpress.com/?p=168</guid>
		<description><![CDATA[This post was originally posted on &#8216;From the Frog&#8217;s Mouth&#8216;. You&#8217;re welcome to comment here or there. The problem of dependency management is neither new nor original, it exists in all development platforms, and .NET is no different. Let’s go through different solutions and see how they perform. I’ll list them here in no particular [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=168&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div style="background-attachment:scroll;background-color:#f7f7f1;background-image:none;display:block;height:51px;line-height:15px;min-height:51px;width:95%;border:1px solid #e3e3d1;margin:0 5px 0 0;padding:5px 2px 3px 10px;"><span style="color:#000000;">This post was originally posted on &#8216;<a title="From the Frog's Mouth" href="http://blogs.jfrog.com" target="_blank">From the Frog&#8217;s Mouth</a>&#8216;.<br />
</span><span style="color:#000000;">You&#8217;re welcome to comment here or <a title="Dependency Management with .NET - Doing it Right" href="blogs.jfrog.org/2012/02/dependency-management-with-net-doing-it.html" target="_blank">there</a>.</span><strong><span style="color:#000000;"><br />
</span></strong></div>
<p>The problem of dependency management is neither new nor original, it exists in all development platforms, and .NET is no different.</p>
<p>Let’s go through different solutions and see how they perform. I’ll list them here in no particular order.</p>
<h3><span id="more-168"></span>Keeping dependencies in your source control</h3>
<p>That’s a very popular solution, and for a reason. The benefits are obvious. Here are some of them:</p>
<ul>
<li>No setup. You already have your source control in place (hm, I hope you do!). Add \bin directory, and you are fine.</li>
<li>No learning curve. Developers are used to work with source control.</li>
<li>Shared. The whole team gets changes and updates from the server as they occur.</li>
<li>Enterprisy (in a good way). The software is proven, backed up, DRP is done.</li>
</ul>
<p>Sounds good, doesn’t it? So, what’s wrong with it? Only one thing &#8211; source control systems are designed to control, well, sources. As such they aren’t so great in controlling binaries. These are the shortcomings we all encountered during the years of Version Control System usage for dependencies:</p>
<ul>
<li>It isn’t a proxy. VCS can’t download the dependency you need from a central repository when you need one. You need to manually download it and add it to VCS. The history starts from there &#8211; you just lost the  link to the original file. So, you work hard, and on top of it lost information; this repeat itself for each new dependency.</li>
<li>Versioning mismatch. Source files are versioned by their content. VCSs know how to diff them and understand what changed. Binaries, on the other side, usually versioned by their name. From VCS point of view they are different entries, each one without any version history.</li>
<li>Some very popular VCSs (like Subversion) can’t obliterate files. That means &#8211; once a file was added, it stay in the repository forever. That’s not a big issue for small source files, but can become quite a pain when it comes to obsolete large binaries.</li>
<li>Source control knows how to search sources. And, of course, the most important type of search is by content. Searching for binaries is different: what matters there is the location, structure of the file name and, in case of archived artifact, the contents of archive.</li>
<li>The permissions scheme of VCSs is tailored for versioning sources (again!). For example, there is no override permission. That’s because overriding sources is something we do all the time (that’s what diff is for in VCS) &#8211; it’s the same security level as, let&#8217;s say, adding a new source file. With binaries the situation is very different. While adding new binaries is fine, overriding released binary is something that shouldn’t be done, one should have a special permission for it.</li>
<li>Distributed VCSs, awesome by themselves, are particularly unsuited for handling big binary files. When cloning a remote repository to your machine <a href="https://twitter.com/#%21/hlship/status/111143638163132417">you are bringing all the history of all the files in it</a>. Now just think about all the huge binaries sitting there&#8230;</li>
</ul>
<p>As you see, the conclusion is simple &#8211; we can do better. Let’s try something specialized for binaries.</p>
<h3>GAC and WebGAC</h3>
<p>Global Assembly Cache is, on contradictory to VCS ,tailored for storing binaries. It understands versions, prevents conflicts, and generally does a good job being your local dependencies storage. The main problem with GAC is being local, which means &#8211; each and every developer should take the binaries from somewhere and install them in their local GAC. You see the troubles coming in that setup, don’t you? <a href="http://www.lshift.net/blog/2010/02/27/webgac-minding-your-net-dependencies">WebGAC</a> to the rescue here. It&#8217;s essentially GAC shared by WebDAV and enables clients to fetch dependencies from the server, simplifying dependencies management for a team. Let’s do our pros/cons math. The benefits:</p>
<ul>
<li>GAC is good, standard and proven solution for binaries management. It deals well with versions.</li>
<li>WebGAC is a central binaries repository for a team. Every team member synchronizes with it.</li>
<li>WebDAV is popular well-known HTTP extension with locking, security management, etc. Working with the Apache WebDAV module is generally straightforward.</li>
</ul>
<p>Let’s see what won’t work so great with that solution:</p>
<ul>
<li>It isn’t a proxy. WebGAC can’t download the dependency you need from a central repository when you need one. You need to manually download it, add it to WebGAC and only then it becomes available to the team. Not only must you work for every version of every dependency needed, the link to the original file is lost.</li>
<li>No notion of packages. GAC contains single dlls. You install them one by one. But think about NUnit, as an example. It contains about dozen of dlls along with various xml and configuration files. How can you install it to GAC?</li>
<li>Security is cumbersome. You’ll need to configure Apache Server’s security, and even then it won’t be flexible enough to determine between deployer (a user that can publish private dependencies) and promoter (a user that can move dependencies from a private repository to a public one).</li>
<li>Search is basic. WebDAV by itself only knows about files. It doesn’t care about the structure of the filename, or about the presence of Strong Names.</li>
</ul>
<p>Looks like we still didn’t find what we are looking for, and then&#8230;</p>
<h3>Here comes NuGet</h3>
<p>This is something else. <a href="http://nuget.codeplex.com/">NuGet</a> designed to be “a developer focused package management system for the .NET platform intent on simplifying the process of incorporating third-party libraries into a .NET application during development”. That’s exactly what we need. Let’s look how great it is:</p>
<ul>
<li>Manages packages, not dlls.</li>
<li>Provides <a href="http://nuget.org/packages">NuGet Gallery</a> &#8211; almost 4.5K (at the time of writing) packages are at your disposal for all your development needs.</li>
<li>Supports binary versioning.</li>
<li>Integrates with Visual Studio.</li>
<li>Integrates with your build.</li>
<li>Integrates with your build server (only <a href="http://blogs.jetbrains.com/dotnet/2011/08/native-nuget-support-in-teamcity/">TeamCity</a> at the moment of writing).</li>
</ul>
<p>This tool&#8217;s like a dream come true. So, what can I mention as downsides? Most of them are downsides of the NuGet Gallery, not NuGet itself. The Gallery is a young and relatively small project (just for the sake of comparison, Maven Central is 6 years old and contains more than 290K artifacts) and, as such, it has its downsides:</p>
<ul>
<li>The content of submissions to the Gallery is (almost) unverified. Everyone can register, get the API key and start uploading whatever they like. Scary, isn&#8217;t it? (yes, very scary).</li>
<li>Being public, NuGet Gallery can’t be used for inter-team packages exchange. <a href="http://docs.nuget.org/docs/creating-packages/hosting-your-own-nuget-feeds#Creating_Remote_Feeds">Private Remote Feeds</a> are the recommended solution. Next we&#8217;ll see if it is good enough.</li>
</ul>
<h3>Working with NuGet Remote Feeds</h3>
<p><a href="http://docs.nuget.org/docs/creating-packages/hosting-your-own-nuget-feeds#Creating_Remote_Feeds">Remote Feeds</a>, introduced in NuGet 1.4 are crucial need for any development team. It serves a dual purpose: it allows sharing 3rd party packages that aren’t available on Gallery (or even replaces the Gallery for those who can’t trust it) and it serves as a target for internal deployments &#8211; both for team collaboration and for other usages, as making packages available to QA, or even serving them to the customers from the outside world (by using <a href="http://chocolatey.org/">Chocolatey</a>, for example). If that’s so right, what’s wrong? Here’s what:</p>
<ul>
<li>You saw it coming: It isn’t a proxy. You know the score by now.</li>
<li>It can’t aggregate. The NuGet Remote Feed exposing one monolithic repository: the one you have on your machine. It can’t aggregate NuGet packages from remote repositories, or expose number of local repositories (separated for security reasons, for example).</li>
<li>You can’t attach your own metadata. Let’s say you want to annotate some package with compatibility information (e.g. works with certain browsers). No, can’t do.</li>
<li>The repository is very simplistic. It doesn’t provide any web interface; it browsable and searchable only from a client &#8211; be it Visual Studio or the command line interface (pretty basic by itself).</li>
<li>Even the VS search interface is very basic (all you have is arbitrary sorting and free text search). It should be enough for starters but lack of searching inside the packages or by properties (from the previous bullet) will bite you eventually.</li>
<li>The security scheme is even less than simplistic. All that&#8217;s required to authenticate a deployment/delete of all the users at once is an API key. What about separation of duties? Some users should only be able to read, others only to annotate with metadata (QA team that tests compatibility in my previous example), and only small subgroup &#8211; to deploy.  The all-or-nothing scheme is definitely insufficient.</li>
<li>Storage format is suboptimal:
<ul>
<li>The packages are stored on the filesystem in a naive simple format. That fine for small repository,but as you grow, you&#8217;d expect storage which more optimized for binaries.</li>
<li>The metadata is not indexed. Again, fine for small repo, troubles are foreseen when it comes to scaling.</li>
</ul>
</li>
</ul>
<p>So, is there a good alternative to NuGet Remote Feed to be your in-house Gallery for NuGet packages? We, the proud makers of <a href="http://www.jfrog.com/">Artifactory</a>,  believe there is.</p>
<h3>Meet Artifactory</h3>
<p><a id="internal-source-marker_0.8537193675811334" href="http://www.jfrog.com/">Artifactory</a> is an enterprise-grade Binary Repository that centralizes all aspects of managing software binaries. That means that we tackle all the problems mentioned above. We are developing Artifactory since 2006. Being used by millions of users for storing, sharing and managing binaries, we have gathered great feedback from our users.</p>
<p>That&#8217;s what we&#8217;ve learned:</p>
<ul>
<li>Binary packages are different from sources (by being big and binary) and deserve smart storage.</li>
<li>Binary packages are usually archives (be it jars, zips, rpms or nupkgs). They should be browsable and searchable without the need to download them locally to developer&#8217;s machine.</li>
<li>Big public repositories exist on the net, they need to be proxied smartly (variations, auditing, managing)</li>
<li>Users come in different flavors. Their permissions should match possible responsibilities (and in the case of binary packages they are different from other cases).</li>
<li>A binary repository holds critical information, it should be rock-solid, backed up, and DRP ready.</li>
<li>Your software ends up being a package. We know how to help you&#8230;
<ul>
<li>build it in a reproducible manner, integrating with your build tools and your build server.</li>
<li>stage it to ensure the best quality.</li>
<li>distribute it to your customers.</li>
</ul>
</li>
</ul>
<p>You get the gist behind Artifactory by watching this 2.5 minutes video: <span style="text-align:center; display: block;"><a href="http://blog.sadogursky.com/2012/02/06/dependency-management-with-net-doing-it-right/"><img src="http://img.youtube.com/vi/aa4YBDUDWy0/2.jpg" alt="" /></a></span><br />
If you’re not in the mood for movies (or ran out of popcorn), here’s quick recap:<a href="http://jbaruch.files.wordpress.com/2012/02/nuget-poxy.png"><img class="size-full wp-image-196 aligncenter" title="Artifactory" src="http://jbaruch.files.wordpress.com/2012/02/nuget-poxy.png?w=700&h=181" alt="" width="700" height="181" /></a><br />
As you see, instead of working with a number of NuGet Feeds (NuGet Gallery, Orchard Gallery,  Remote Feeds from co-workers and from different teams) developers work with exactly one repository. It simplifies setup and daily work and centralizes management and maintenance.<br />
The work is bi-directional, the users resolve their 3rd party dependencies from Artifactory and deploy their created packaged into it.</p>
<p>Now let’s add a build server to the picture (literally):<a href="http://jbaruch.files.wordpress.com/2012/02/nuget-build.png"><img class="size-full wp-image-197 aligncenter" title="CI" src="http://jbaruch.files.wordpress.com/2012/02/nuget-build.png?w=700&h=322" alt="" width="700" height="322" /></a><br />
Yup, with numbers this time. So, here we go:</p>
<ol>
<li>Developers find and  fetch new 3rd party packages from Artifactory in Visual Studio. The packages are downloaded from Artifactory to the developer&#8217;s machine. If the packages aren’t present in Artifactory it will look for them in remote galleries/feeds. On developer machines <code>packages.config</code> is updated with the list of used packages.</li>
<li>Developers commit their code and <code>packages.config</code> (but not the binaries) to VCS.</li>
<li>The Build server (as I already mentioned, <a href="http://blogs.jetbrains.com/dotnet/2011/08/native-nuget-support-in-teamcity/">TeamCity</a> now supports NuGet) takes the changes from the VCS.</li>
<li>It builds the solution and packs the produced artifacts as NuGet packages.</li>
<li>During the build it fetches the needed packages from Artifactory. If the packages aren’t present in Artifactory it will look for them in remote galleries/feeds.</li>
<li>Once the packages are built they are deployed to Artifactory.</li>
</ol>
<p>Built packages in Artifactory can be used by other teams (as their 3rd party dependencies), by QA for running tests and even by the end users (<a href="http://chocolatey.org/">Chocolatey</a> FTW), all this with fine-grained permissions and robust promotion procedures (moving a package between repositories with different visibility rules).<br />
You know what? It deserves dedicated how-to blog post. I’ll link it here once published.</p>
<p>Assuming you&#8217;ve read up to this point, you&#8217;ve gathered that starting from Artifactory version 2.5.0 we are proud to serve the .NET world with full NuGet support. We can proxy any remote NuGet feed (starting with NuGet Gallery, of course), we can host the packages that aren’t found on any remote NuGet feed, we can host the packages you produce and we can aggregate any number of repositories of any kind under single a URL. We provide you with an awesome UI for configuring your repositories, browsing and searching for your packages. We also feature smart storage that enables attaching searchable metadata on top of your binaries. We can do it all on the cloud with our <a href="https://secure.artifactoryonline.com/art-online.php">SAAS version</a>.</p>
<p>Hopefully , you&#8217;re convinced by now and probably looking for the download link on our site (<a href="https://secure.artifactoryonline.com/addons.php">here’s it</a>, BTW, click on “Evalution”). If not, give it a try by playing with <a href="http://repo.jfrog.org/artifactory/webapp/browserepo.html?pathId=nuget-gallery-cache:">our live demo</a>. Look at the nuget-gallery cache: that’s how we proxy the NuGet Gallery. You’ll find some of the packages saved locally; once you&#8217;ve selected a package, you’ll see all kinds of information about it: its name and size, who deployed it to Artifactory, where it came from (from NuGet Gallery, naturally for this is the NuGet Gallery cache) and the operations you can perform on this package (as anonymous the selection is naturally limited). Clicking on the triangle in the tree will open the package and let you dive into its content, including downloading specific files from the archive (click for full-size image):<a href="http://jbaruch.files.wordpress.com/2012/02/browse-nupkg.png"><img class=" wp-image-183 aligncenter" title="Browse Artifactory" src="http://jbaruch.files.wordpress.com/2012/02/browse-nupkg.png?w=548&h=378" alt="Browse Artifactory" width="548" height="378" /></a></p>
<p>We, at JFrog, believe that Artifactory is the missing piece of the puzzle for a robust, agile .NET dependency management, which can make the development process easier compared to other alternatives.<br />
We&#8217;ll be happy to receive any insights, thoughts and comments on the ideas presented in this blog and/or your experience using Artifactory together with NuGet.</p>
<br />Filed under: <a href='http://blog.sadogursky.com/category/artifactory-2/'>Artifactory</a>, <a href='http://blog.sadogursky.com/category/jfrog/'>JFrog</a> Tagged: <a href='http://blog.sadogursky.com/tag/artifactory/'>artifactory</a>, <a href='http://blog.sadogursky.com/tag/jfrog-2/'>jfrog</a>, <a href='http://blog.sadogursky.com/tag/nuget/'>nuget</a>, <a href='http://blog.sadogursky.com/tag/teamcity/'>teamcity</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jbaruch.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jbaruch.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jbaruch.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jbaruch.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jbaruch.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jbaruch.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jbaruch.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jbaruch.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jbaruch.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jbaruch.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jbaruch.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jbaruch.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jbaruch.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jbaruch.wordpress.com/168/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=168&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sadogursky.com/2012/02/06/dependency-management-with-net-doing-it-right/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3d73332968c0bf62e1ece7299deb8b37?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JBaruch</media:title>
		</media:content>

		<media:content url="http://jbaruch.files.wordpress.com/2012/02/nuget-poxy.png" medium="image">
			<media:title type="html">Artifactory</media:title>
		</media:content>

		<media:content url="http://jbaruch.files.wordpress.com/2012/02/nuget-build.png" medium="image">
			<media:title type="html">CI</media:title>
		</media:content>

		<media:content url="http://jbaruch.files.wordpress.com/2012/02/browse-nupkg.png" medium="image">
			<media:title type="html">Browse Artifactory</media:title>
		</media:content>
	</item>
		<item>
		<title>Unified (as much as possible) Logging Using SLF4J</title>
		<link>http://blog.sadogursky.com/2011/06/22/unified-logging-using-slf4j/</link>
		<comments>http://blog.sadogursky.com/2011/06/22/unified-logging-using-slf4j/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 06:40:25 +0000</pubDate>
		<dc:creator>jbaruch</dc:creator>
				<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[jcl]]></category>
		<category><![CDATA[jul]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[log4j]]></category>
		<category><![CDATA[logback]]></category>
		<category><![CDATA[slf4j]]></category>

		<guid isPermaLink="false">http://jbaruch.wordpress.com/?p=34</guid>
		<description><![CDATA[Integrating, integrating, integrating. That&#8217;s what we do in Java enterprise development. Persisting objects with Hibernate wrapped by JPA using C3Po (or JTA?) (or MongoDB over Morphia?), processed with JBMP, created by JAXB (jackson-json?) from JAX-RS scheduled by Quartz &#8230; (a few dozen frameworks later) &#8230; all this glued with Spring (or Guice?) deployed on Jetty [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=34&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Integrating, integrating, integrating. That&#8217;s what we do in Java enterprise development. Persisting objects with Hibernate wrapped by JPA using C3Po (or JTA?) (or MongoDB over Morphia?), processed with JBMP, created by JAXB (jackson-json?) from JAX-RS scheduled by Quartz &#8230; (a few dozen frameworks later) &#8230; all this glued with Spring (or Guice?) deployed on Jetty (or Tomcat, JBoss, Resin?) into cluster by Terracotta (or Hadoop, GigaSpaces, JBoss cache, Infinispam?). Ah, and all this built using <span style="text-decoration:line-through;">Maven</span> Gradle with Artifactory on Jenkins. I sure forgot ½ of the frameworks we constantly use.</p>
<p>Generally we don&#8217;t mind much about the internals of the frameworks we use (as long as they are good) &#8211; the whole encapsulation stuff is the last <a href="http://tech.puredanger.com/2010/02/25/questioning-oo/" target="_blank">undoubted</a> good thing. But except for the API (part of which is the configuration) frameworks have another user-facing end – the logging. When we build a <strong>system</strong> we want it to behave as one system – single configuration from one end, and single log from another (break it to different files, if you wish, but it should still be a unified logging system).</p>
<p>The reality is that there is no standard de-facto for logging. The standard de-jure &#8211; <a href="http://java.sun.com/javase/6/docs/technotes/guides/logging/" target="_blank">JUL</a>, is not very popular because of its lack of functionality (compared to alternatives) and its suboptimal performance. And then there is <a href="http://logging.apache.org/log4j/" target="_blank">Log4J</a>, which almost became standard, but did not. And there is <a href="http://logback.qos.ch/" target="_blank">logback</a>, which is a Log4J <a href="http://logback.qos.ch/reasonsToSwitch.html">trashover</a>, and there are facades (<a href="http://commons.apache.org/logging/" target="_blank">JCL</a> and <a href="http://www.slf4j.org/" target="_blank">SLF4J</a>), which try to unite all this zoo, and some others, which you have probably never heard of, like <a href="http://www.syslog4j.org/" target="_blank">syslog4j</a>*, <a href="http://www.theobjectguy.com/javalog/" target="_blank">logging framework by the Object Guy</a>, <a href="http://java-source.net/open-source/logging" target="_blank">jLo, MonoLog, Lumberjack, Houston, JTraceDump, qflog, LN2, TracingClassLoader, SMTPHandler, Log4Ant, Simple Log, Log Bridge, Craftsman Spy, Pencil, JDLabAgent, Trace Log, JDBC Logger, LimpidLog and Microlog</a>.</p>
<p>Let it be, you’d say – why not have many logging tools, which are good and diverse! Well, the problem, as I’ve already mentioned, is that they leak out of the frameworks. Their diverse configuration leaks from one end, while their diverse output from another. Spring uses Log4J over JCL. So does Hibernate. Jetty uses Logback over SLF4J. Some (like Terracotta modules) use plain Log4J, Jersey uses JUL.  This means we end up with 5 separate configurations (Log4J, SLF4J, Logback, JCL and JUL) and 3 different types of log files (Log4j, Logback and JUL). What a system!</p>
<p>To make the long story short &#8211; How can we achieve the desired consolidation? Clearly, we need a facade. There are two most commonly used &#8211; SLF4J and JCL. JCL is known for its <a href="http://articles.qos.ch/classloader.html" target="_blank">classloader hell</a>, SLF4J is newer, better performing, smarter, simplier to use and generally provides better quality for the same buck (well, no buck &#8211; both are open source, of course), so we&#8217;ll stick to it. SLF4J is an adapter &#8211; thin layer of API to and from different logging implementations. Yap, both ways. It means with SLF4J we can use JUL API on top and log using Log4J in the bottom!</p>
<p>First we need to pick an actual logger. Log4j was considered the best choice up until recently (2006) when Ceki Gülcü decided he needed a fresh start and rewrote from scratch a new Java logging framework, just<a href="http://xhab.blogspot.com/2007/03/new-logging-experience.html" target="_blank"> better than log4j</a>, called Logback. We can give it a try as our underlying logging implementation (we can switch in a moment, as we are using  good facade, remember?).</p>
<p>So, here&#8217;s what we have to do:</p>
<ol>
<ol>
<li>Establish our own good logging:
<ol>
<ol>
<li>Add Logback to our classpath</li>
<li>Add SLF4J API to our classpath</li>
</ol>
</ol>
<p>Done here. Now our own brand new code will use top-notch logging.</li>
<li>Now for the tricky part. Let&#8217;s make the example stack I listed above taking configuration from one source (our config files) and writing to one target (files, listed in our configuration)</li>
<ol>
<li>All the tools using SLF4J will just work. That includes dozen of Apache projects, inc. Camel and Mina, some SpringSource projects and <a href="http://www.slf4j.org/" target="_blank">many others</a>.</li>
<li>Now let&#8217;s start rolling with all the rest. This is how you do it (click to enlarge):<br />
<a href="http://www.slf4j.org/images/bridging.png"><img class="alignnone" title="Bridging architecture" src="http://www.slf4j.org/images/bridging.png" alt="Bridging architecture" width="297" height="162" /></a></li>
<ol>
<li>Jakarta Commons Logging:</li>
<ol>
<li>Remove commons-logging.jar from your classpath. Usually, it is transitive dependency from the framework, so you need to instruct your build tool on how to do it. What a lucky coincidence, I just wrote <span style="text-decoration:line-through;">short</span> and instructive <a title="Banning Transitive Dependencies With Maven2/3, Gradle and Ivy" href="http://jbaruch.wordpress.com/2011/06/22/banning-transitive-dependencies-with-maven23-gradle-and-ivy/">blog post</a> about how to do it!</li>
<li>Add jcl-over-slf4j.jar instead. It contains alternative commons-logging API implementation, so the code will run just fine.</li>
</ol>
<li>Log4J:</li>
<ol>
<li>Same goes here! Remove log4j.jar from your classpath (Again, it would usually be a transitive dependency from the framework, look <a title="Banning Transitive Dependencies With Maven2/3, Gradle and Ivy" href="http://jbaruch.wordpress.com/2011/06/22/banning-transitive-dependencies-with-maven23-gradle-and-ivy/">here</a>).</li>
<li>Add log4j-over-slf4j.jar instead. It contains alternative log4j API implementation, so the code will run just fine.</li>
</ol>
<li>JUL:</li>
<ol>
<li>Well, you can&#8217;t remove JUL from classpath (it&#8217;s a part of the JRE, dude). For the same reason SLF4J can&#8217;t reimplement JUL&#8217;s API.</li>
<li>Add jul-to-slf4j.jar. It will translate java.util.logging.LogRecord objects into their SLF4J equivalent.</li>
<li>Install <a href="http://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html">SLF4JBridgeHandler</a> and <a href="http://logback.qos.ch/manual/configuration.html#LevelChangePropagator">LevelChangePropagator</a>.</li>
<li>Expect 20% decrease in performance (so use it wisely).</li>
</ol>
</ol>
</ol>
</ol>
</ol>
<p><strong>All done</strong>. Now both our code and all the 3rd paries configured from single source and write to single target. Hooray!</p>
<p><small>* syslog4j claims it is cross-platform. Well,  I&#8217;ll just quote: &#8220;<strong>Is Syslog4j cross-platform?</strong> Yes! Syslog4j UDP/IP and TCP/IP clients should work in any typical Java JRE environment.&#8221;</small></p>
<br />Filed under: <a href='http://blog.sadogursky.com/category/frameworks/'>Frameworks</a> Tagged: <a href='http://blog.sadogursky.com/tag/jcl/'>jcl</a>, <a href='http://blog.sadogursky.com/tag/jul/'>jul</a>, <a href='http://blog.sadogursky.com/tag/log/'>log</a>, <a href='http://blog.sadogursky.com/tag/log4j/'>log4j</a>, <a href='http://blog.sadogursky.com/tag/logback/'>logback</a>, <a href='http://blog.sadogursky.com/tag/slf4j/'>slf4j</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jbaruch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jbaruch.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jbaruch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jbaruch.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jbaruch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jbaruch.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jbaruch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jbaruch.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jbaruch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jbaruch.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jbaruch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jbaruch.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jbaruch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jbaruch.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=34&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sadogursky.com/2011/06/22/unified-logging-using-slf4j/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3d73332968c0bf62e1ece7299deb8b37?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JBaruch</media:title>
		</media:content>

		<media:content url="http://www.slf4j.org/images/bridging.png" medium="image">
			<media:title type="html">Bridging architecture</media:title>
		</media:content>
	</item>
		<item>
		<title>Banning Transitive Dependencies With Maven2/3, Gradle and Ivy</title>
		<link>http://blog.sadogursky.com/2011/06/22/banning-transitive-dependencies-with-maven23-gradle-and-ivy/</link>
		<comments>http://blog.sadogursky.com/2011/06/22/banning-transitive-dependencies-with-maven23-gradle-and-ivy/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 06:39:24 +0000</pubDate>
		<dc:creator>jbaruch</dc:creator>
				<category><![CDATA[Build]]></category>
		<category><![CDATA[gradle]]></category>
		<category><![CDATA[ivy]]></category>
		<category><![CDATA[maven2]]></category>
		<category><![CDATA[maven3]]></category>

		<guid isPermaLink="false">http://jbaruch.wordpress.com/?p=125</guid>
		<description><![CDATA[Oh, you are using build tool with dependency management? Good! Be it Maven2/3, Gradle or Ivy, your life as devops or developer is much easier. Until you hit it. The evil transitive dependency. How can it be evil you ask? When the classes in it clash with the classes you really need.  Here&#8217;s some use-cases: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=125&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Oh, you are using build tool with dependency management? Good! Be it Maven2/3, Gradle or Ivy, your life as devops or developer is much easier. Until you hit it. The evil transitive dependency. How can it be evil you ask? When the classes in it clash with the classes you really need.  Here&#8217;s some use-cases:</p>
<ol>
<li>Same dependency, different jar names, two examples here:</li>
<ol>
<li>The Jakarta Commons renaming effort: <a href="http://repo1.maven.org/maven2/commons-io/commons-io/1.3.2/">commons-io:commons-io:1.3.2</a> and <a href="http://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2/">org.apache.commons:common-io:1.3.2</a></li>
<li>The Spring Framework artifacts naming convention alternatives: <a href="http://repo1.maven.org/maven2/org/springframework/">spring-beans, spring-context, etc</a> in repo1 versus <a href="http://ebr.springsource.com/repository/app/bundle/detail?name=org.springframework.beans">org.springframework.beans, org.springframework.context, etc</a>in
<div id="site-name">SpringSource EBR.</div>
</li>
</ol>
<li>Different packaging of the sample classes, many examples here:</li>
<ol>
<li>OSGi repackagings:<a href="http://repo1.maven.org/maven2/asm/asm/3.2/"> asm:asm:3.2</a> and <a href="http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.objectweb.asm&amp;version=3.2.0">org.objectweb.asm:com.springsource.org.objectweb.asm:3.2.0</a></li>
<li>Modularization of Spring 2.5.6: <a href="http://repo1.maven.org/maven2/org/springframework/spring/2.5.6/">as single jar</a> and as <a href="http://repo1.maven.org/maven2/org/springframework/">spring-whatever multiple modules</a></li>
<li>Xerces and Xalan are included in JDK since 1.5. They are still present as transitive dependencies in all the tools which support JDK 1.4.</li>
<li>Alternative packagings with and without dependencies: <a href="http://repo1.maven.org/maven2/cglib/cglib/">cglib:cgli</a>b and <a href="http://repo1.maven.org/maven2/cglib/cglib-nodep/">cglib:cglib-nodep</a></li>
<li>Project merges like <a href="http://repo1.maven.org/maven2/com/google/collections/google-collections/">Google collections</a>, which are now included in <a href="http://repo1.maven.org/maven2/com/google/guava/guava/">Google Guava</a></li>
</ol>
<li>Deliberately reimplemented interfaces, for example for <a title="Unified (as much as possible) logging using SLF4J" href="http://jbaruch.wordpress.com/2011/06/22/unified-logging-using-slf4j/">bridging legacy APIs to new implementation, such as in SLF4J</a>.</li>
<li>Your patches for 3rd-party tools.</li>
</ol>
<p>All those may end up with 2 or more classes with the same name in the classpath. Why it is bad? Java class identifier consists of fully-qualified class name and the classloader that loaded it, so if two classes with the same name reside in same classpath JVM considers them to be the same class, and only one of them will be loaded. Which one? The first classloader encounters. Which one will it be? You have no idea.<br />
When the duplicated classes are exactly the same, you will never notice. But if the classes are different, you&#8217;ll start getting runtime exceptions, such as NoSuchMethodError, NoClassDefFoundError and friends. That&#8217;s because other classes expect for find one API, but encounter another one &#8211; wrong class was loaded first. Not fun.</p>
<p>Now, when you know how evil they are, let&#8217;s take those bastards down!</p>
<h4>Maven 2/3</h4>
<p>There is no simple way (Maven&#8217;s tagline) to exclude some dependency from all the scopes. I&#8217;ll show two cases &#8211; manual exclusion and working with IntelliJ IDEA:</p>
<ol>
<ol>
<li>Stage 1: exclude all the banned dependencies one by one:</li>
<ol>
<li>Manually edit Maven&#8217;s poms</li>
<ol>
<li>For each evil dependency:</li>
<li>Find which top-level dependency brings the evil transitive hitcher with it. This is done by using Maven Dependency Plugin:
<pre>mvn dependency:tree -Dincludes=commons-logging:commons-logging</pre>
</li>
<li>You&#8217;ll get something like this:
<pre>[INFO] com.mycompany.myproduct:rest-client:1.0
[INFO] \- org.springframework:spring-webmvc:jar:3.0.5.RELEASE:compile
[INFO]    \- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
[INFO]       \- commons-logging:commons-logging:jar:1.1.1:compile</pre>
</li>
<li>Go to the pom.xml with your dependency management (you use dependency management, don&#8217;t you? If you don&#8217;t, don&#8217;t tell anyone, <a href="http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management">go and start using it</a>) find spring-webmvc dependency and add an exclusion to it:
<pre><span style="color:#800000;font-weight:normal;font-style:normal;">1 </span>    <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">dependency</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">2 </span>    	<span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">groupId</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">org.</span><span style="color:#000000;font-weight:bold;font-style:normal;">springframework</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">groupId</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">3 </span>    	<span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">artifactId</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">spring-</span><span style="color:#000000;font-weight:bold;font-style:normal;">webmvc</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">artifactId</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">4 </span>    	<span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">version</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">3.0.5.RELEASE</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">version</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">5 </span>        <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">exclusions</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">6 </span>            <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">exclusion</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">7 </span>                <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">artifactId</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">commons-logging</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">artifactId</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">8 </span>                <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">groupId</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">commons-logging</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">groupId</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">9 </span>            <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">exclusion</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">10 </span>        <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">exclusions</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">11 </span>    <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">dependency</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span></pre>
</li>
</ol>
<li>Working with IntelliJ IDEA:<br />
<a href="http://jbaruch.files.wordpress.com/2011/06/2011-06-21_131016.png"><img class="alignnone size-thumbnail wp-image-129" title="IntelliJ IDEA Maven Dependencies" src="http://jbaruch.files.wordpress.com/2011/06/2011-06-21_131016.png?w=145&h=150" alt="IntelliJ IDEA Maven Dependencies" width="145" height="150" /></a></li>
<ol>
<ol>
<li>Open Maven Dependencies Graph.</li>
<li>Filter it by the dependency you are looking for.</li>
<li>Select it and press Shift-Delete.</li>
</ol>
</ol>
</ol>
<li>Good job! Your nailed them down in the current version of your build. But what happens when someone adds a new 3rd party dependency and brings some bad stuff with it as transitives? You need to protect your build from this scenario. So, stage 2: Fail the build if one of the banned dependencies ever added to the build with <a href="http://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html">Maven Enforcer Plugin</a>. Add the plugin to your root project pom:
<pre style="color:#800000;font-weight:normal;font-style:normal;"><span style="color:#800000;font-weight:normal;font-style:normal;">1 </span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">project</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">2 </span>  <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">build</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">3 </span>    <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">plugins</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">4 </span>      <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">plugin</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">5 </span>        <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">groupId</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">org.apache.maven.plugins</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">groupId</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">6 </span>        <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">artifactId</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">maven-enforcer-plugin</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">artifactId</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">7 </span>        <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">version</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">1.0</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">version</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">8 </span>        <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">executions</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">9 </span>          <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">execution</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">10 </span>            <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">id</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">enforce-banned-dependencies</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">id</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">11 </span>            <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">goals</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">12 </span>              <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">goal</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">enforce</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">goal</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">13 </span>            <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">goals</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">14 </span>            <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">configuration</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">15 </span>              <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">rules</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">16 </span>                <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">bannedDependencies</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">17 </span>                  <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">excludes</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">18 </span>                    <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">exclude</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">commons-logging</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">exclude</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">19 </span>                    <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">exclude</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">cglib:cglib</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">exclude</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">20 </span>                  <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">excludes</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">21 </span>                <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">bannedDependencies</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">23 </span>              <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">rules</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">24 </span>              <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">fail</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span><span style="color:#000000;font-weight:bold;font-style:normal;">true</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">fail</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">25 </span>            <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">configuration</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">26 </span>          <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">execution</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">27 </span>        <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">executions</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">28 </span>      <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">plugin</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">29 </span>    <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">plugins</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">30</span> <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">build</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">31 </span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">project</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span></pre>
</li>
<li>As I mentioned, using the Enforcer plugin won&#8217;t exclude the unwanted dependencies, it only will fail the build. Once that happened (and trust me, it will), you need to go and exclude them manually, as described in Stage 1 above.</li>
</ol>
</ol>
<p>And we are done with Maven. Not fun? Switch your build tool!</p>
<h4>Ivy</h4>
<p>Well, comparing to Maven it&#8217;s emabrassing how easy is to add global exclusion in Ivy. All you need to do is add exclude tag, and it will do the job for all the transitive dependencies, both in current and future use:</p>
<pre><span style="color:#800000;font-weight:normal;font-style:normal;">1 </span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">dependencies</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">2 </span>    <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">dependency </span><span style="color:#0000ff;background-color:#efefef;font-weight:bold;font-style:normal;">org=</span><span style="color:#008000;background-color:#efefef;font-weight:bold;font-style:normal;">"org.</span><span style="color:#008000;background-color:#efefef;font-weight:bold;font-style:normal;">springframework</span><span style="color:#008000;background-color:#efefef;font-weight:bold;font-style:normal;">" </span><span style="color:#0000ff;background-color:#efefef;font-weight:bold;font-style:normal;">name=</span><span style="color:#008000;background-color:#efefef;font-weight:bold;font-style:normal;">"spring-</span><span style="color:#008000;background-color:#efefef;font-weight:bold;font-style:normal;">webmvc</span><span style="color:#008000;background-color:#efefef;font-weight:bold;font-style:normal;">"</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">3 </span><span style="color:#0000ff;background-color:#efefef;font-weight:bold;font-style:normal;">rev=</span><span style="color:#008000;background-color:#efefef;font-weight:bold;font-style:normal;">"3.0.5.RELEASE" </span><span style="color:#0000ff;background-color:#efefef;font-weight:bold;font-style:normal;">conf=</span><span style="color:#008000;background-color:#efefef;font-weight:bold;font-style:normal;">"compile-&gt;default"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">/&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">4 </span>    <span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">exclude </span><span style="color:#0000ff;background-color:#efefef;font-weight:bold;font-style:normal;">org=</span><span style="color:#008000;background-color:#efefef;font-weight:bold;font-style:normal;">"commons-logging"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">/&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">5 </span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-weight:bold;font-style:normal;">dependencies</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span></pre>
<p>Done.</p>
<h4>Gradle</h4>
<p>Since Gradle uses Ivy under the hood, here comes the same ease, but even groovier:</p>
<pre><span style="color:#800000;font-weight:normal;font-style:normal;">1 </span>    <span style="color:#000000;font-weight:normal;font-style:normal;">configurations</span> {
<span style="color:#800000;font-weight:normal;font-style:normal;">2 </span>        <span style="color:#000000;font-weight:normal;font-style:normal;">all</span>*.exclude module: <span style="color:#008000;font-weight:bold;font-style:normal;">'commons-logging'</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">3 </span>        <span style="color:#000000;font-weight:normal;font-style:normal;">all</span>*.exclude group: <span style="color:#008000;font-weight:bold;font-style:normal;">'cglib'</span>, module: <span style="color:#008000;font-weight:bold;font-style:normal;">'cglib-nodep'</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">4 </span>    }</pre>
<p><strong>That&#8217;s all!</strong> Now your code is bullet-proof from classloading conflicts and you can do nasty class-replacing stuff, for <a title="Unified (as much as possible) logging using SLF4J" href="http://jbaruch.wordpress.com/2011/06/22/unified-logging-using-slf4j/">logging</a> or pleasure.</p>
<br />Filed under: <a href='http://blog.sadogursky.com/category/build/'>Build</a> Tagged: <a href='http://blog.sadogursky.com/tag/gradle/'>gradle</a>, <a href='http://blog.sadogursky.com/tag/ivy/'>ivy</a>, <a href='http://blog.sadogursky.com/tag/maven2/'>maven2</a>, <a href='http://blog.sadogursky.com/tag/maven3/'>maven3</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jbaruch.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jbaruch.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jbaruch.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jbaruch.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jbaruch.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jbaruch.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jbaruch.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jbaruch.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jbaruch.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jbaruch.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jbaruch.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jbaruch.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jbaruch.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jbaruch.wordpress.com/125/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=125&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sadogursky.com/2011/06/22/banning-transitive-dependencies-with-maven23-gradle-and-ivy/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3d73332968c0bf62e1ece7299deb8b37?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JBaruch</media:title>
		</media:content>

		<media:content url="http://jbaruch.files.wordpress.com/2011/06/2011-06-21_131016.png?w=145" medium="image">
			<media:title type="html">IntelliJ IDEA Maven Dependencies</media:title>
		</media:content>
	</item>
		<item>
		<title>PAX 2010</title>
		<link>http://blog.sadogursky.com/2010/12/06/pax-2010/</link>
		<comments>http://blog.sadogursky.com/2010/12/06/pax-2010/#comments</comments>
		<pubDate>Mon, 06 Dec 2010 12:50:05 +0000</pubDate>
		<dc:creator>jbaruch</dc:creator>
				<category><![CDATA[Build]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[gradle]]></category>
		<category><![CDATA[nfjs]]></category>
		<category><![CDATA[pax2010]]></category>
		<category><![CDATA[project automation experience 2010]]></category>

		<guid isPermaLink="false">http://blog.sadogursky.com/?p=106</guid>
		<description><![CDATA[Just back from Project Automation Experience 2010. Guess what? It was awesome! Here&#8217;s my summary: General: The conference was combined with Rich Web Experience 2010, which probably, was the right thing to do for the first ever project automation seminar. It was announced 2 months ago, bringing 52 registrants (out of ~400 total for both events). Pretty [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=106&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Just back from <a href="http://projectautomationexperience.com">Project Automation Experience 2010</a>.</p>
<p>Guess what? It was awesome!</p>
<p>Here&#8217;s my summary:</p>
<h3>General:</h3>
<p>The conference was combined with Rich Web Experience 2010, which probably, was the right thing to do for the first ever project automation seminar. It was announced 2 months ago, bringing 52 registrants (out of ~400 total for both events). Pretty impressive for such a short notice on such a narrow subject. The organization was fantastic, everything felt well-planned and well-orchestrated. It was my second <a href="http://www.nofluffjuststuff.com/home/main">NFJS</a> conference, and like with the first one, they delivered!</p>
<h3>Sessions:</h3>
<p>The first speaker in the conference was the one and only Douglas Crockford in his notorious <a href="http://video.yahoo.com/watch/529579/2724346">Quality talk</a>. Top quality (pun intended) &#8211; funny, entertaining, and touching the right points. Bottom line &#8211; read <a href="http://www.amazon.com/Mythical-Man-Month-Engineering-Anniversary-ebook/dp/B000OZ0N6M">The Mythical Man-Month</a> and <a href="http://www.literateprogramming.com/">Literate Programming</a>.</p>
<p>Yet another <a href="https://prezi.com/secure/90f1d01e0fe98653691efa6a56221c2e4a72ee01/">keynote</a> was devoted to actually Project Automation. <a href="http://gradle.org">Hans Dockter</a> laid down his vision on the topic, the idea being &#8211; we are entering very interesting times, better understanding of the needs combining with the right tools will enable us whole new level of project automation, way beyond what we are used to today.</p>
<p>Lots of fun and enriching talks, like <a href="http://www.augusttechgroup.com/tim/blog/">Tim Berglund</a>&#8216;s <a href="http://www.slideshare.net/tlberglund/complexity-theory-and-software-development">Complexity Theory and Software Development</a> or an experts panel, moderated by <a href="http://www.tedneward.com/">Ted Neward</a> (who honestly tried to recall who I was and where did we met), and tons of useful and deep sessions and workshops, just to name a few: <a href="http://blogs.jfrog.org/">Fred</a>&#8216;s modularity and smart BRMs talks, Kohsuke&#8217;s updated <a href="http://vimeo.com/13581660">Doing More with Hudson</a>, Git, Sonar and Liquibase sessions from <a href="http://denverdev.blogspot.com/">Matthew McCullough</a>, <a href="http://www.sonarsource.org/author/oliviergaudin/">Olivier Gaudin</a> and <a href="http://www.augusttechgroup.com/tim/blog/">Tim Berglund</a>. The integration with Rich Web Experience gave the participans the opportunity to mix and match the sessions, and there was a lot of stuff to attend &#8211; HTML5, CSS3, Flash, iOS and Android development, Grails, Wicket and what&#8217;s not! 10 parallel sessions in any given time, now go choose one!</p>
<h3>The sessions I gave:</h3>
<p>First of all, it was my first speaking experience outside of Israel. I think I did well. At least the feedbacks say so <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  The high speaker:attendee ratio produced small classes with live interaction, I loved it. As I suspected, 90 minutes are too long, looks like 60 minutes is my favorite format, but I managed to keep the audience awake <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here are my sessions:</p>
<ul>
<li><a href="http://prezi.com/hyyrityxmv5f/maven-2-gradle/">Maven 2 Gradle</a> how to move away from Maven2 to Gradle (using <a title="Maven2 to Gradle Convertor" href="http://blog.sadogursky.com/2010/02/23/maven2-to-gradle-convertor/">gradle2maven</a>, <a title="Maven2 to Gradle Convertor - Take II" href="http://blog.sadogursky.com/2010/10/11/maven2-to-gradle-convertor-take-2/">maven-metadata plugin</a> or even manually). Demo included converting the whole Artifactory project to Gradle.</li>
<li><a href="http://prezi.com/kxhwh7liugoa/java-build-automation-tools-jungle/">Java Build Tools Jungle</a> &#8211; overview the tons of Java build tools. Winners are (in that order): Gralde, Buildr, SBT.</li>
</ul>
<p>By the way, <a href="http://prezi.com">Prezi</a> rocks, as usual.</p>
<p>My next goal &#8211; speaking in a bigger seminar around spring 2011, probably on different topic, more relevant to my new job.</p>
<h3>Florida:</h3>
<p>December 1st &#8211; 30ºC, sun and ocean. <a href="http://www.flickr.com/photos/nshontz/5220491077/">That&#8217;s</a> a typical room view. No additional comments needed, I guess.</p>
<p>Everglades and alligators rock too. It looks like <a href="http://www.smartdestinations.com/images/blog_images/2008/01/miami-everglades.jpg">this</a>.</p>
<div id="_mcePaste" class="mcePaste" style="position:absolute;left:-10000px;top:100px;width:1px;height:1px;">
<h2 class="shortBio" style="font-family:Georgia, 'Times New Roman', Times, serif;color:#000000;font-weight:normal;font-size:1em;line-height:1.2em;background-image:initial;background-attachment:initial;background-color:#cfcfcf;border-top-width:1px;border-top-style:dotted;border-top-color:#000000;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:#000000;background-position:initial initial;background-repeat:initial initial;margin:0 0 5px;padding:5px 0 5px 10px !important;"><a style="color:#efce52;text-decoration:none;font-weight:bold;margin:0;padding:0;" href="http://projectautomationexperience.com/conference/fort_lauderdale/2010/11/speakers/olivier_gaudin">Olivier Gaudin</a></h2>
</div>
<br />Filed under: <a href='http://blog.sadogursky.com/category/build/'>Build</a>, <a href='http://blog.sadogursky.com/category/presentation/'>presentation</a> Tagged: <a href='http://blog.sadogursky.com/tag/build-2/'>build</a>, <a href='http://blog.sadogursky.com/tag/gradle/'>gradle</a>, <a href='http://blog.sadogursky.com/tag/nfjs/'>nfjs</a>, <a href='http://blog.sadogursky.com/tag/pax2010/'>pax2010</a>, <a href='http://blog.sadogursky.com/tag/project-automation-experience-2010/'>project automation experience 2010</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jbaruch.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jbaruch.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jbaruch.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jbaruch.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jbaruch.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jbaruch.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jbaruch.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jbaruch.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jbaruch.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jbaruch.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jbaruch.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jbaruch.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jbaruch.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jbaruch.wordpress.com/106/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=106&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sadogursky.com/2010/12/06/pax-2010/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3d73332968c0bf62e1ece7299deb8b37?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JBaruch</media:title>
		</media:content>
	</item>
		<item>
		<title>Maven2 to Gradle Convertor &#8211; Take II</title>
		<link>http://blog.sadogursky.com/2010/10/11/maven2-to-gradle-convertor-take-2/</link>
		<comments>http://blog.sadogursky.com/2010/10/11/maven2-to-gradle-convertor-take-2/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 08:27:39 +0000</pubDate>
		<dc:creator>jbaruch</dc:creator>
				<category><![CDATA[Build]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[gradle]]></category>
		<category><![CDATA[maven2]]></category>
		<category><![CDATA[project automation experience 2010]]></category>

		<guid isPermaLink="false">http://blog.sadogursky.com/?p=96</guid>
		<description><![CDATA[Well, it&#8217;s time to another solution for something that I see as the biggest absent feature of Gradle - decent migration tool from Maven2. Gradle provides some cool Maven2 integration features &#8211; you can use Maven repositories, Gradle (well, Ivy inside Gradle) understand your dependencies&#8217; poms in terms of transitive dependencies, you can even generate [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=96&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well, it&#8217;s time to another solution for something that I see as the biggest absent feature of <a href="http://gradle.org/" target="_blank">Gradle </a>- decent migration tool from Maven2.  Gradle <a href="http://gradle.org/maven_plugin.html" target="_blank">provides </a>some cool Maven2 integration features &#8211; you can use Maven repositories, Gradle (well, Ivy inside Gradle) understand your dependencies&#8217; poms in terms of transitive dependencies, you can even generate pom for your artifact and deploy it to Maven repo, but what about the build itself? For now it should it be trashed over and rewritten completely. That is a show-stopper for a lot of projects. They worked so hard to make their Maven work (you know what I mean&#8230; Maven == working hard), and now I have to say them to just throw it away and rewrite? No way!  Some time ago I took @psynikal&#8217;s script for generating Gradle like dependencies from Maven like ones and improved it a bit to generate usable Gradle build file out of pom. The full story is <a href="http://blog.sadogursky.com/2010/02/23/maven2-to-gradle-convertor/" target="_blank">here</a>. That solution, while definitely is better than void is far from being perfect for number of reasons:</p>
<ol>
<li>It is fragile.</li>
<li>It uses maven-help-plugin. Did I say fragile?</li>
<li>Changes in pom.xml aren&#8217;t reflected in your build &#8211; you need to regenerate the gradle build files (writing them over, destroying all changes you made &#8211; the script isn&#8217;t perfect in that sense).</li>
<li>Probably some annoying bugs.</li>
</ol>
<p>Now it&#8217;s time for something more serious &#8211; the m2metadata plugin. In an essence, it takes metadata from Maven&#8217;s Project Object Model and builds Gradle project out of it.</p>
<p>More specifically it does the following:</p>
<ol>
<li>Ask Maven to parse poms and settings xmls as it does during regular Maven build.</li>
<li>Set group, version and status (snapshot/release) for Gradle project.</li>
<li>Apply Gradle plugins according to packaging (jar -&gt; java, war -&gt; war). Currently those two are the only supported, but more are coming.</li>
<li>Get some metadata from well-known Maven plugins and configure Gradle plugins with it. This step currently includes setting Java compiler level and configuring sources and resources directories.</li>
<li>Add repositories.</li>
<li>Add dependencies (both external and inter-project).</li>
</ol>
<p>That&#8217;s about it.</p>
<p>Now for the dark side. Currently, the m2metada-plugin clashes with maven-plugin (classloading issues). It can be worked around, but:</p>
<ol>
<li>Maven-plugin is bundled, so it must be explicitly removed by deleting jars from Gradle&#8217;s lib directory.</li>
<li>The true power of m2metadata plugin is using it together with maven-plugin. M2metadata-plugin retrieves metadata part of maven build, while maven-plugin runs Maven&#8217;s runtime to execute goals like generating poms and deploying to maven repositories.</li>
</ol>
<p>Yet another, more methodological than technical downside of m2metadata-plugin is that it preserves the usage of pom.xml. It works, so you don&#8217;t touch it, and it stays forever instead of being replaced with fully-blown build.gradle. For that concern, I see clear benefits in using the <a href="http://blog.sadogursky.com/2010/02/23/maven2-to-gradle-convertor/" target="_blank">script solution</a>, which trashes the pom.xml, leaving you with pure-gradle solution, and in conjunction with the<a href="http://gradle.org/idea_plugin.html" target="_blank"> idea-plugin</a> gives you all you need to start going.</p>
<p>All in all, once the classloading issues will be sorted out, It looks to me that the mission of creating migration tool can be considered as accomplished.</p>
<p>You can find my work <a href="http://github.com/jbaruch/Gradle-M2Metadata-Plugin" target="_blank">here</a> (Usage guide in Wiki, TODOs in issues). I am going to present it (together with the <a href="http://blog.sadogursky.com/2010/02/23/maven2-to-gradle-convertor/" target="_blank">script</a>, which,as mentioned, has it own benefits) at <a href="http://projectautomationexperience.com" target="_blank">The Project Automation Experience 2010</a> in the <a href="http://projectautomationexperience.com/conference/fort_lauderdale/2010/11/session?id=20291" target="_blank">Java Build Automation Tools Jungle</a> session. The presentation will be posted here once it will be ready.</p>
<br />Filed under: <a href='http://blog.sadogursky.com/category/build/'>Build</a> Tagged: <a href='http://blog.sadogursky.com/tag/build-2/'>build</a>, <a href='http://blog.sadogursky.com/tag/gradle/'>gradle</a>, <a href='http://blog.sadogursky.com/tag/maven2/'>maven2</a>, <a href='http://blog.sadogursky.com/tag/project-automation-experience-2010/'>project automation experience 2010</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jbaruch.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jbaruch.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jbaruch.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jbaruch.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jbaruch.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jbaruch.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jbaruch.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jbaruch.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jbaruch.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jbaruch.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jbaruch.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jbaruch.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jbaruch.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jbaruch.wordpress.com/96/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=96&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sadogursky.com/2010/10/11/maven2-to-gradle-convertor-take-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3d73332968c0bf62e1ece7299deb8b37?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JBaruch</media:title>
		</media:content>
	</item>
		<item>
		<title>Integrating MongoDB with Spring</title>
		<link>http://blog.sadogursky.com/2010/05/30/integrating-mongodb-with-spring/</link>
		<comments>http://blog.sadogursky.com/2010/05/30/integrating-mongodb-with-spring/#comments</comments>
		<pubDate>Sun, 30 May 2010 14:25:58 +0000</pubDate>
		<dc:creator>jbaruch</dc:creator>
				<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Friendly Java Blogs]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://jbaruch.wordpress.com/?p=70</guid>
		<description><![CDATA[Looking for plain, short and simple MongoDB and Spring integration - here  you go!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=70&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Apparently, most of the visitors to my <a href="http://jbaruch.wordpress.com/2010/04/27/integrating-mongodb-with-spring-batch/" target="_blank">&#8220;Integrating MongoDB with Spring Batch&#8221;</a> post can&#8217;t find what they look for, because they look for instructions how to integrate <a href="http://www.mongodb.org/" target="_blank">MongoDB</a> with plain <a href="http://www.springsource.org/" target="_blank">Spring Core</a>.<br />
Well, the source includes that integration, but it&#8217;s on <a href="http://github.com/jbaruch/springbatch-over-mongodb" target="_blank">github</a>, and anyway that wasn&#8217;t the focus of that post.<br />
So, here&#8217;s the integration &#8211; short, plain and simple:</p>
<ul>
<li><strong>Properties file with server and database details (resides in classpath in this example):</strong></li>
</ul>
<pre style="color:#000000;font-weight:normal;font-style:normal;border:thin solid;font-family:monospace;font-size:small;padding:5px;"><span style="color:#800000;font-weight:normal;font-style:normal;">1    </span><span style="color:#000080;font-style:normal;">db.host</span>=<span style="color:#008000;font-style:normal;">localhost</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">2    </span><span style="color:#000080;font-style:normal;">db.port</span>=<span style="color:#008000;font-style:normal;">27017</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">3    </span><span style="color:#000080;font-style:normal;">app.db.name</span>=<span style="color:#008000;font-style:normal;">app</span>
</pre>
<ul>
<li><strong>If you don&#8217;t use <a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-java" target="_blank">Java-based container configuration</a> (you should start using it!):</strong></li>
</ul>
<ol>
<li>application-config.xml (or whatever you call it):
<pre style="color:#000000;font-weight:normal;font-style:normal;border:thin solid;font-family:monospace;font-size:small;padding:5px;"><span style="color:#800000;font-weight:normal;font-style:normal;">1</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;</span><span style="color:#000080;background-color:#efefef;font-style:normal;">beans</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;"> </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">xmlns=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"http://www.</span><span style="color:#008000;background-color:#efefef;font-style:normal;">springframework</span><span style="color:#008000;background-color:#efefef;font-style:normal;">.org/schema/beans"</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">2</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">       </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">xmlns:xsi=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"http://www.w3.org/2001/XMLSchema-instance"</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">3</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">       </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">xmlns:context=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"http://www.</span><span style="color:#008000;background-color:#efefef;font-style:normal;">springframework</span><span style="color:#008000;background-color:#efefef;font-style:normal;">.org/schema/context"</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">4</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">       </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">xsi:schemaLocation=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"http://www.</span><span style="color:#008000;background-color:#efefef;font-style:normal;">springframework</span><span style="color:#008000;background-color:#efefef;font-style:normal;">.org/schema/beans</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">5</span><span style="color:#008000;background-color:#efefef;font-style:normal;">           http://www.</span><span style="color:#008000;background-color:#efefef;font-style:normal;">springframework</span><span style="color:#008000;background-color:#efefef;font-style:normal;">.org/schema/beans/spring-beans-3.0.xsd</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">6</span><span style="color:#008000;background-color:#efefef;font-style:normal;">           http://www.</span><span style="color:#008000;background-color:#efefef;font-style:normal;">springframework</span><span style="color:#008000;background-color:#efefef;font-style:normal;">.org/schema/context</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">7</span><span style="color:#008000;background-color:#efefef;font-style:normal;">           http://www.</span><span style="color:#008000;background-color:#efefef;font-style:normal;">springframework</span><span style="color:#008000;background-color:#efefef;font-style:normal;">.org/schema/context/spring-context-3.0.xsd</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">8</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">    &lt;</span><span style="color:#000080;background-color:#efefef;font-style:normal;">context:property-placeholder</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;"> </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">
</span><span style="color:#800000;">9</span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">                location=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"classpath:db.properties"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">/&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">10</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">    &lt;</span><span style="color:#000080;background-color:#efefef;font-style:normal;">bean</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;"> </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">id=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"</span><span style="color:#008000;background-color:#efefef;font-style:normal;">mongo</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;"> </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">class=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"com.</span><span style="color:#008000;background-color:#efefef;font-style:normal;">mongodb</span><span style="color:#008000;background-color:#efefef;font-style:normal;">.</span><span style="color:#008000;background-color:#efefef;font-style:normal;">Mongo</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">11</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">       &lt;</span><span style="color:#000080;background-color:#efefef;font-style:normal;">constructor-arg</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;"> </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">value=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"${db.host}"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">/&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">12</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">       &lt;</span><span style="color:#000080;background-color:#efefef;font-style:normal;">constructor-arg</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;"> </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">value=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"${db.port}"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">/&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">13</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">   &lt;/</span><span style="color:#000080;background-color:#efefef;font-style:normal;">bean</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">14</span><span style="color:#000080;background-color:#efefef;font-style:normal;">   &lt;bean</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;"> </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">id=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"db"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;"> </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">
</span><span style="color:#800000;">15</span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">      class=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"com.</span><span style="color:#008000;background-color:#efefef;font-style:normal;">mongodb</span><span style="color:#008000;background-color:#efefef;font-style:normal;">.spring.config.DbFactoryBean"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">16</span><span style="color:#000080;background-color:#efefef;font-style:normal;">       &lt;property</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;"> </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">name=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"</span><span style="color:#008000;background-color:#efefef;font-style:normal;">mongo</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;"> </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">ref=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"</span><span style="color:#008000;background-color:#efefef;font-style:normal;">mongo</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">/&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">17</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">       &lt;</span><span style="color:#000080;background-color:#efefef;font-style:normal;">property</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;"> </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">name=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"name"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;"> </span><span style="color:#0000ff;background-color:#efefef;font-style:normal;">value=</span><span style="color:#008000;background-color:#efefef;font-style:normal;">"${app.db.name}"</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">/&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">18</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">   &lt;/</span><span style="color:#000080;background-color:#efefef;font-style:normal;">bean</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&gt;</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">19</span><span style="color:#000000;background-color:#efefef;font-weight:normal;font-style:normal;">&lt;/</span><span style="color:#000080;background-color:#efefef;font-style:normal;">beans&gt;</span></pre>
</li>
<li>The com.mongodb.spring.config.DbFactoryBean class:
<pre style="color:#000000;font-weight:normal;font-style:normal;border:thin solid;font-family:monospace;font-size:small;padding:5px;"><span style="color:#800000;font-weight:normal;font-style:normal;">1 </span><span style="color:#000080;font-weight:bold;font-style:normal;">public</span> <span style="color:#000080;font-weight:bold;font-style:normal;">class</span> <span style="color:#000000;font-weight:normal;font-style:normal;">DbFactoryBean</span> <span style="color:#000080;font-weight:bold;font-style:normal;">implements</span> FactoryBean&lt;DB&gt; {
<span style="color:#800000;font-weight:normal;font-style:normal;">2    </span>
<span style="color:#800000;font-weight:normal;font-style:normal;">3    </span>    <span style="color:#000080;font-weight:bold;font-style:normal;">private</span> Mongo <span style="color:#660e7a;font-weight:bold;font-style:normal;">mongo</span>;
<span style="color:#800000;font-weight:normal;font-style:normal;">4    </span>    <span style="color:#000080;font-weight:bold;font-style:normal;">private</span> String <span style="color:#660e7a;font-weight:bold;font-style:normal;">name</span>;
<span style="color:#800000;font-weight:normal;font-style:normal;">5    </span>
<span style="color:#800000;font-weight:normal;font-style:normal;">6    </span>    <span style="color:#808000;font-weight:normal;font-style:normal;">@Override</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">7    </span>    <span style="color:#000080;font-weight:bold;font-style:normal;">public</span> DB getObject() <span style="color:#000080;font-weight:bold;font-style:normal;">throws</span> Exception {
<span style="color:#800000;font-weight:normal;font-style:normal;">8    </span>        <span style="color:#000080;font-weight:bold;font-style:normal;">return</span> <span style="color:#660e7a;font-weight:bold;font-style:normal;">mongo</span>.getDB(<span style="color:#660e7a;font-weight:bold;font-style:normal;">name</span>);
<span style="color:#800000;font-weight:normal;font-style:normal;">9    </span>    }
<span style="color:#800000;font-weight:normal;font-style:normal;">10   </span>
<span style="color:#800000;font-weight:normal;font-style:normal;">11   </span>    <span style="color:#808000;font-weight:normal;font-style:normal;">@Override</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">12   </span>    <span style="color:#000080;font-weight:bold;font-style:normal;">public</span> Class&lt;?&gt; getObjectType() {
<span style="color:#800000;font-weight:normal;font-style:normal;">13   </span>        <span style="color:#000080;font-weight:bold;font-style:normal;">return</span> DB.<span style="color:#000080;font-weight:bold;font-style:normal;">class</span>;
<span style="color:#800000;font-weight:normal;font-style:normal;">14   </span>    }
<span style="color:#800000;font-weight:normal;font-style:normal;">15   </span>
<span style="color:#800000;font-weight:normal;font-style:normal;">16   </span>    <span style="color:#808000;font-weight:normal;font-style:normal;">@Override</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">17   </span>    <span style="color:#000080;font-weight:bold;font-style:normal;">public</span> <span style="color:#000080;font-weight:bold;font-style:normal;">boolean</span> isSingleton() {
<span style="color:#800000;font-weight:normal;font-style:normal;">18   </span>        <span style="color:#000080;font-weight:bold;font-style:normal;">return</span> <span style="color:#000080;font-weight:bold;font-style:normal;">true</span>;
<span style="color:#800000;font-weight:normal;font-style:normal;">19   </span>    }
<span style="color:#800000;font-weight:normal;font-style:normal;">20   </span>
<span style="color:#800000;font-weight:normal;font-style:normal;">21   </span>    <span style="color:#000080;font-weight:bold;font-style:normal;">public</span> <span style="color:#000080;font-weight:bold;font-style:normal;">void</span> set<span style="color:#000000;font-weight:normal;font-style:normal;">Mongo</span>(Mongo mongo) {
<span style="color:#800000;font-weight:normal;font-style:normal;">22   </span>        <span style="color:#000080;font-weight:bold;font-style:normal;">this</span>.<span style="color:#660e7a;font-weight:bold;font-style:normal;">mongo</span> = mongo;
<span style="color:#800000;font-weight:normal;font-style:normal;">23   </span>    }
<span style="color:#800000;font-weight:normal;font-style:normal;">24   </span>
<span style="color:#800000;font-weight:normal;font-style:normal;">25   </span>    <span style="color:#000080;font-weight:bold;font-style:normal;">public</span> <span style="color:#000080;font-weight:bold;font-style:normal;">void</span> setName(String name) {
<span style="color:#800000;font-weight:normal;font-style:normal;">26   </span>        <span style="color:#000080;font-weight:bold;font-style:normal;">this</span>.<span style="color:#660e7a;font-weight:bold;font-style:normal;">name</span> = name;
<span style="color:#800000;font-weight:normal;font-style:normal;">27   </span>    }
<span style="color:#800000;font-weight:normal;font-style:normal;">28 </span>}
</pre>
</li>
</ol>
<ul>
<li><strong>If you do use <a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-java" target="_blank">Java-based container configuration</a> &#8211; here&#8217;s your @Configuration class:</strong></li>
</ul>
<pre style="color:#000000;font-weight:normal;font-style:normal;border:thin solid;font-family:monospace;font-size:small;padding:5px;"><span style="color:#800000;font-weight:normal;font-style:normal;">1    </span><span style="color:#808000;font-weight:normal;font-style:normal;">@Configuration</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">2    </span><span style="color:#000080;font-weight:bold;font-style:normal;">public</span> <span style="color:#000080;font-weight:bold;font-style:normal;">class</span> ApplicationConfiguration {
<span style="color:#800000;font-weight:normal;font-style:normal;">3    </span>
<span style="color:#800000;font-weight:normal;font-style:normal;">4    </span>    <span style="color:#808000;font-weight:normal;font-style:normal;">@Value</span>(<span style="color:#008000;font-weight:bold;font-style:normal;">"${app.db.name}"</span>)
<span style="color:#800000;font-weight:normal;font-style:normal;">5    </span>    <span style="color:#000080;font-weight:bold;font-style:normal;">private</span> String <span style="color:#660e7a;font-weight:bold;font-style:normal;">appDbName</span>;
<span style="color:#800000;font-weight:normal;font-style:normal;">6    </span>
<span style="color:#800000;font-weight:normal;font-style:normal;">7    </span>    <span style="color:#808000;font-weight:normal;font-style:normal;">@Value</span>(<span style="color:#008000;font-weight:bold;font-style:normal;">"${db.host}"</span>)
<span style="color:#800000;font-weight:normal;font-style:normal;">8    </span>    <span style="color:#000080;font-weight:bold;font-style:normal;">private</span> String <span style="color:#660e7a;font-weight:bold;font-style:normal;">dbHost</span>;
<span style="color:#800000;font-weight:normal;font-style:normal;">9    </span>
<span style="color:#800000;font-weight:normal;font-style:normal;">10   </span>    <span style="color:#808000;font-weight:normal;font-style:normal;">@Value</span>(<span style="color:#008000;font-weight:bold;font-style:normal;">"${db.port}"</span>)
<span style="color:#800000;font-weight:normal;font-style:normal;">11   </span>    <span style="color:#000080;font-weight:bold;font-style:normal;">private</span> <span style="color:#000080;font-weight:bold;font-style:normal;">int</span> <span style="color:#660e7a;font-weight:bold;font-style:normal;">dbPort</span>;
<span style="color:#800000;font-weight:normal;font-style:normal;">12   </span>
<span style="color:#800000;font-weight:normal;font-style:normal;">13   </span>
<span style="color:#800000;font-weight:normal;font-style:normal;">14   </span>    <span style="color:#808000;font-weight:normal;font-style:normal;">@Bean</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">15   </span>    <span style="color:#000080;font-weight:bold;font-style:normal;">public</span> DB db() <span style="color:#000080;font-weight:bold;font-style:normal;">throws</span> UnknownHostException {
<span style="color:#800000;font-weight:normal;font-style:normal;">16   </span>        <span style="color:#000080;font-weight:bold;font-style:normal;">return</span> mongo().getDB(<span style="color:#660e7a;font-weight:bold;font-style:normal;">appDbName</span>);
<span style="color:#800000;font-weight:normal;font-style:normal;">17   </span>    }
<span style="color:#800000;font-weight:normal;font-style:normal;">18   </span>
<span style="color:#800000;font-weight:normal;font-style:normal;">19   </span>    <span style="color:#808000;font-weight:normal;font-style:normal;">@Bean</span>
<span style="color:#800000;font-weight:normal;font-style:normal;">20   </span>    <span style="color:#000080;font-weight:bold;font-style:normal;">public</span> Mongo mongo() <span style="color:#000080;font-weight:bold;font-style:normal;">throws</span> UnknownHostException {
<span style="color:#800000;font-weight:normal;font-style:normal;">21   </span>        <span style="color:#000080;font-weight:bold;font-style:normal;">return</span> <span style="color:#000080;font-weight:bold;font-style:normal;">new</span> Mongo(<span style="color:#660e7a;font-weight:bold;font-style:normal;">dbHost</span>, <span style="color:#660e7a;font-weight:bold;font-style:normal;">dbPort</span>);
<span style="color:#800000;font-weight:normal;font-style:normal;">22   </span>    }
<span style="color:#800000;font-weight:normal;font-style:normal;">23   </span>}
</pre>
<p>That&#8217;s, actually, it &#8211; enjoy. If you feel some part of the puzzle is missing, please leave a comment.</p>
<br />Filed under: <a href='http://blog.sadogursky.com/category/frameworks/'>Frameworks</a>, <a href='http://blog.sadogursky.com/category/friendly-java-blogs/'>Friendly Java Blogs</a> Tagged: <a href='http://blog.sadogursky.com/tag/java/'>java</a>, <a href='http://blog.sadogursky.com/tag/mongodb/'>mongodb</a>, <a href='http://blog.sadogursky.com/tag/spring/'>spring</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jbaruch.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jbaruch.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jbaruch.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jbaruch.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jbaruch.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jbaruch.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jbaruch.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jbaruch.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jbaruch.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jbaruch.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jbaruch.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jbaruch.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jbaruch.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jbaruch.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=70&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sadogursky.com/2010/05/30/integrating-mongodb-with-spring/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3d73332968c0bf62e1ece7299deb8b37?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JBaruch</media:title>
		</media:content>
	</item>
		<item>
		<title>Towards My Gradle Talk In Beyond Java AlphaCSP Seminar</title>
		<link>http://blog.sadogursky.com/2010/05/20/towards-gradle-talk/</link>
		<comments>http://blog.sadogursky.com/2010/05/20/towards-gradle-talk/#comments</comments>
		<pubDate>Thu, 20 May 2010 20:23:10 +0000</pubDate>
		<dc:creator>jbaruch</dc:creator>
				<category><![CDATA[Build]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[alphacsp]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[buildr]]></category>
		<category><![CDATA[gant]]></category>
		<category><![CDATA[gmaven]]></category>
		<category><![CDATA[gradle]]></category>
		<category><![CDATA[javaedge]]></category>
		<category><![CDATA[maven2]]></category>
		<category><![CDATA[prezi]]></category>

		<guid isPermaLink="false">http://jbaruch.wordpress.com/2010/05/20/your-next-successful-build/</guid>
		<description><![CDATA[sing Maven2 to build tools was like AWT to UI frameworks: revolutionary, but not without downsides.Concepts such as standardization of project layout and centralized dependency management are preserved in almost every new and future build tool.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=65&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Using Maven2 to build tools was like AWT to UI frameworks: revolutionary, but not without downsides.Concepts such as standardization of project layout and centralized dependency management are preserved in almost every new and future build tool.<span style="display:block;width:425px;margin:0 auto;"> <embed src='http://widgets.vodpod.com/w/video_embed/ExternalVideo.942934' type='application/x-shockwave-flash' AllowScriptAccess='sameDomain' pluginspage='http://www.macromedia.com/go/getflashplayer' wmode='transparent' flashvars='prezi_id=ngwwf1wcfn7n&lock_to_path=1&color=ffffff&autoplay=no' width='425' height='350' /> </span></p>
<br />Filed under: <a href='http://blog.sadogursky.com/category/build/'>Build</a>, <a href='http://blog.sadogursky.com/category/presentation/'>presentation</a> Tagged: <a href='http://blog.sadogursky.com/tag/alphacsp/'>alphacsp</a>, <a href='http://blog.sadogursky.com/tag/ant/'>ant</a>, <a href='http://blog.sadogursky.com/tag/build-2/'>build</a>, <a href='http://blog.sadogursky.com/tag/buildr/'>buildr</a>, <a href='http://blog.sadogursky.com/tag/gant/'>gant</a>, <a href='http://blog.sadogursky.com/tag/gmaven/'>gmaven</a>, <a href='http://blog.sadogursky.com/tag/gradle/'>gradle</a>, <a href='http://blog.sadogursky.com/tag/javaedge/'>javaedge</a>, <a href='http://blog.sadogursky.com/tag/maven2/'>maven2</a>, <a href='http://blog.sadogursky.com/tag/prezi/'>prezi</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jbaruch.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jbaruch.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jbaruch.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jbaruch.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jbaruch.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jbaruch.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jbaruch.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jbaruch.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jbaruch.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jbaruch.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jbaruch.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jbaruch.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jbaruch.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jbaruch.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=65&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sadogursky.com/2010/05/20/towards-gradle-talk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3d73332968c0bf62e1ece7299deb8b37?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JBaruch</media:title>
		</media:content>
	</item>
		<item>
		<title>Integrating MongoDB with Spring Batch</title>
		<link>http://blog.sadogursky.com/2010/04/27/integrating-mongodb-with-spring-batch/</link>
		<comments>http://blog.sadogursky.com/2010/04/27/integrating-mongodb-with-spring-batch/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 13:10:55 +0000</pubDate>
		<dc:creator>jbaruch</dc:creator>
				<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Friendly Java Blogs]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[spring-batch]]></category>

		<guid isPermaLink="false">http://jbaruch.wordpress.com/?p=39</guid>
		<description><![CDATA[Update (May 30th 2010): If you look for plain core Spring integration with MongoDB &#8211; here&#8217;s a post for you. Spring Batch is a superb batch framework from, well, Spring. It covers all the concepts of batch architecture and, generally, spares you from reinventing the wheel. It&#8217;s cool, really. If you have batch-oriented application, you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=39&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div style="background-attachment:scroll;background-color:#f7f7f1;background-image:none;display:block;height:51px;line-height:15px;min-height:51px;width:95%;border:1px solid #e3e3d1;margin:0 5px 0 0;padding:5px 2px 3px 10px;"><strong><span style="color:#000000;">Update (May 30th 2010):</span><span style="color:#000000;"> </span></strong><br />
If you look for <a href="http://www.springsource.org/" target="_blank">plain core Spring</a> integration with <a href="http://www.mongodb.org/" target="_blank">MongoDB</a> &#8211; <a href="http://jbaruch.wordpress.com/2010/05/30/integrating-mongodb-with-spring/" target="_self">here&#8217;s a post for you</a>.</div>
<p style="text-align:left;"><a href="http://static.springsource.org/spring-batch/" target="_blank">Spring Batch</a> is a superb batch framework from, well, <a href="http://www.springsource.org/" target="_blank">Spring</a>. It covers all the concepts of batch architecture and, generally, spares you from reinventing the wheel. It&#8217;s cool, really. If you have batch-oriented application, you <strong>must</strong> go and take a look at Spring Batch. And if you don&#8217;t know what batch-oriented application is, just think about reading-validating-saving-to-db a zillion text files every night, unattended. Now you know what batch-oriented application is, go and look at Spring Batch.</p>
<p style="text-align:left;">Welcome back. As you&#8217;ve seen, Spring Batch constantly saves its state in order to be able to recover/restart exactly when it stopped. <a href="http://static.springsource.org/spring-batch/apidocs/org/springframework/batch/core/repository/JobRepository.html" target="_blank">JobRepository </a>is the bean in charge of saving the state, and its sole implementation uses data access objects layer, which currently has two implementations &#8211; in-memory maps and JDBC. It looks like this:</p>
<p style="text-align:left;"><a href="http://jbaruch.files.wordpress.com/2010/04/jobrepository.png"><img class="alignnone size-full wp-image-40" title="JobRepository" src="http://jbaruch.files.wordpress.com/2010/04/jobrepository.png?w=700" alt="JobRepository class diagram"   /></a></p>
<p style="text-align:left;">Of course, the maps are for <span style="text-decoration:line-through;">losers</span> testing,  JDBC implementation is the one to use in your production environment, since you have RDBMS at your application anyway, right? Or not&#8230;</p>
<p style="text-align:left;">Today, when <a href="http://en.wikipedia.org/wiki/NoSQL" target="_blank">NoSQL</a> is gaining momentum (justified, if you ask me) the assumption that  &#8220;you always have RDBMS in enterprise application&#8221; is not true anymore. So, how can you work with Spring Batch now? Using in-memory DAOs? Not good enough. Installing, setting up, maintaining, baby-sitting RDBMS only for Spring Batch meta-data? Hum, you&#8217;d rather not. There is a great solution &#8211; just keep the meta-data in the NoSQL database you use for the application itself. Thanks to Spring, the Spring Batch architecture is modularized and loosely-coupled, and all you have to do in order to make it work is to re-implement the four DAOs.</p>
<p style="text-align:left;">So, here&#8217;s the plan:</p>
<ul>
<li>Implement *Dao with NoSqlDb*Dao</li>
<li>Add them to Spring application context</li>
<li>Create new SimpleJobRepository, injecting your new NoSqlDb DAOs into it</li>
<li>Use it instead of the one you would create from JobRepositoryFactoryBean</li>
<li>&#8230;</li>
<li>Profit</li>
</ul>
<p style="text-align:left;">That was exactly what I did for our customer, implementing the DAOs using <a href="http://www.mongodb.org/" target="_blank">MongoDB</a>. Guess what, you <strong>must</strong> go and take a look at MongoDB.  It&#8217;s lightning-fast, schema-less document-oriented database, that kicks ass. When you suddenly have a strange feeling that RDBMS might <a href="http://perspectives.mvdirona.com/CommentView,guid,afe46691-a293-4f9a-8900-5688a597726a.aspx" target="_blank">not be the best solution</a> for whatever you do, chances are you&#8217;d love MongoDB, as I do now. There are use-cases, in which you just can&#8217;t implement whatever you need to do with relational storage. Well, I lied. You can. It will take a year, it will look ugly and perform even worse. That&#8217;s my case, and I am just happy the year is 2010 and we know by now that one size doesn&#8217;t fit all.</p>
<p style="text-align:left;">I have to admit -implementing Spring Batch DAOs with MongoDB was fun. Even Spring Batch meta-data model, which was designed with relational storage in mind, persists nicely in MongoDB. Should I even mention that the code is cleaner comparing to JDBC? Even on top of JDBC template?</p>
<p style="text-align:left;">
<p style="text-align:left;">Now go and grab the Spring Batch over MongoDB implementation and the reference configuration: <a href="http://github.com/jbaruch/springbatch-over-mongodb" target="_blank">http://github.com/jbaruch/springbatch-over-mongodb</a>. I have used the samples and the tests from original Spring Batch distribution, trying to make as few changes as necessary. You&#8217;ll need <a href="http://www.mongodb.org/display/DOCS/Downloads" target="_blank">MongoDB build</a> for your platform and <a href="http://gradle.org/" target="_blank">Gradle</a> <a href="http://dist.codehaus.org/gradle/gradle-0.9-preview-1-all.zip" target="_blank">0.9p1</a> to build and run. (Why Gradle? Because it is truly <a href="http://en.wordpress.com/tag/gradle/" target="_blank">a better way to build</a>).</p>
<p style="text-align:left;">If you use MongoDB &#8211; enjoy the implementation as is. If you use some other document-oriented DB, the conversion should be straightforward. In any case, I&#8217;ll be glad to hear your feedback.</p>
<br />Filed under: <a href='http://blog.sadogursky.com/category/frameworks/'>Frameworks</a>, <a href='http://blog.sadogursky.com/category/friendly-java-blogs/'>Friendly Java Blogs</a> Tagged: <a href='http://blog.sadogursky.com/tag/mongodb/'>mongodb</a>, <a href='http://blog.sadogursky.com/tag/spring/'>spring</a>, <a href='http://blog.sadogursky.com/tag/spring-batch/'>spring-batch</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jbaruch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jbaruch.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jbaruch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jbaruch.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jbaruch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jbaruch.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jbaruch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jbaruch.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jbaruch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jbaruch.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jbaruch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jbaruch.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jbaruch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jbaruch.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sadogursky.com&#038;blog=481424&#038;post=39&#038;subd=jbaruch&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sadogursky.com/2010/04/27/integrating-mongodb-with-spring-batch/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3d73332968c0bf62e1ece7299deb8b37?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JBaruch</media:title>
		</media:content>

		<media:content url="http://jbaruch.files.wordpress.com/2010/04/jobrepository.png" medium="image">
			<media:title type="html">JobRepository</media:title>
		</media:content>
	</item>
	</channel>
</rss>
