Post-Javaone II – podcasting

Back from JavaOne I realised that have some pretty funny media. I’ll start a series of podcasts, starting with Rich (no names for protect 😉 ), about him around 20 years ago when he went to Spain for university and tried to ask his roommates for drawers to put his stuff. Listen to Rich in Spain. The quality of the sound is not too good as we were in a bar (as all nights).

Post-JavaOne

It was a very nice week in San Francisco. It was not due to the sessions because I didn’t went to any 😉 but it was really interesting meeting people, some already well known from mailings and new ones.

From the second group it was really good to see how more and more people use Maven, and those that still don’t use it know a lot about it. The reasons not to use it also moved from other years from “my build is fine with ant” or “I don’t like the standards that Maven imposes” to “it’s something we want to do but still didn’t have the time”. The good news is that now Mergere is offering Maestro, a user friendly bundle with Maven, Continuum, a sample application, with user documentation, the “Better Builds with Maven” book, a nice installer and using a faster repository, which many people would appreciate, as the fact that everything is completely free and open source (which is not always the same).

From the first group aka “the usual suspects”, I’d like to point out that after some drinks geeks start being more talkative ;). The ones that deserve special mention for their abilities with the glass are Rob Harrop (Spring), Gregor Hohpe (Google), Dan Diephouse (XFire) aka seXFire, Hani (The Bile Blog), and the ever present David Blevins (Geronimo), Dain Sundstrom (Geronimo) , James Strachan (LogicBlaze), Hiram Chirino (LogicBlaze),… I’m sure I forget people but I have an excuse… I was trying to keep up with them!

Also wednesday I went to see the Champions Leage final, playing Barcelona-Arsenal. It was a lot of fun watching it with the guys as I was the only spaniard around against a bunch of britons, but of course at the end we won 2-1. A really good game.

Maven JUG at JavaOne, plus free beer

If you happen to be in San Francisco and are interested in Maven you should check this out, there will be a Maven JUG hosted by Mergere at the W hotel, Tuesday at 7:30. You should register to make sure there’s enough space for everybody.

The official announcement follows:

 

Please join Mergere for a Java Users Group (JUG) hosted by our parent company, Simula Labs, with IBM and IONA Technologies.

This is your opportunity to hear presentations from and meet with the teams behind some of the most innovative and popular Apache open source projects today.

See how the Mergere Maestro distribution, based on Apache Maven and Continuum, provides an agile platform to build, test and manage SOA run-times, like IONA Technnologies~ Celtix. Also learn how LogicBlaze FUSE for WAS CE is an ideal middleware platform for enterprise Service-oriented Architecture (SOA).

PLUS, for early JavaOne attendees ~ see Maven founder and Chief Architect of Mergere, Jason van Zyl, speak a the closing keynote of Netbeans Day on Monday, May 15. For more information on this event, please go to: http://www.netbeans.org/community/articles/javaone/2006/nb-day.html

What: Java Users Group

When: Tuesday, May 16, 2006 from 7:30 p.m. to 9:00 p.m.

Where: The W Hotel, San Francisco
181 3rd Street
San Francisco, California 94103
(415) 777-5300
Great Room 1&2

Who: Speakers from Mergere, Simula, LogicBlaze, IBM and Iona Technologies

FREE beverages and appetizers will be served

Limited space is available ~ click the URL below to REGISTER NOW for Mergere’s JUG!

http://www.mergere.com/common/reg.jsp?form_source=m-jug_javaone2006&form_landing=m-jug_email

Heading to San Francisco

Tomorrow I’ll fly to San Francisco and I’ll be around for the next week, going to JavaOne and parties (mostly the latest) and meeting people from the mailing lists and different OS projects in person.

If you wanna meet me memorize my picture at the upper right corner of this weblog ;). If it’s not enough don’t be shy and drop me an email or ask for me at the Mergere booth.

Sun jars available in Maven repo

Kohsuke has uploaded Activation 1.1 and JavaMail 1.4 to the Maven 1 repository in java.net.

I uploaded them to the Maven 2 repo at iBiblio, improving the poms: activation and javamail, if you want to use them you can add one of the following dependencies to your pom. You only need one because javamail depends on activation and brings it in.

<dependency>
  <groupid>javax.activation</groupid>
  <artifactid>activation</artifactid>
  <version>1.1</version>
</dependency>
<dependency>
  <groupid>javax.mail</groupid>
  <artifactid>mail</artifactid>
  <version>1.4</version>
</dependency>

Make sure your project uses these versions so your users don’t need to download the jars from Sun.

Optional dependencies in Maven

Colin Sampaleanu (Spring Framework, Interface21) brought again the topic about how to handle optional dependencies in Maven, what’s the best way, how to apply it,… You can read the thread How are people getting around the lack of custom scopes?. If you are too lazy and don’t want to reason you can skip to the end where you can find the solution for that problem under Maven 2.

The example he provides is Spring Webflow, currently packaged completely in an only jar, with some core dependencies always needed, some only needed when used with Spring MVC, some only with JSF, and some only with Struts.

While the idea of packaging a bunch of classes in one jar can be handy when you copy it manually I see more cons than pros:

  • Almost everybody uses a tool that will deal with several jars with no problems
  • Build time checking. If you include more classes than expected nothing prevents their use. This is a huge source of problems. My experience tells me that policies that can’t be enforced don’t succeed.
  • Component Oriented design, if you find yourself including many dependencies in your pom is like importing a lot of stuff in a java class, not a great idea.
  • With a transitive dependency tool like Maven you won’t need to add more than a few dependencies, eg depending on spring-hibernate3 automatically adds for you spring-core, spring-beans, spring-aop,…
  • In fact the Spring guys gave a step in this direction in 2.0, splitting spring-hibernate (depending on hibernate 2 and 3) into spring-hibernate2 and spring-hibernate3, or spring-orm in different jars for each ORM implementation (JDO, Toplink,…)

Here you can see as example some of the problems that I found thanks to
Maven in the Spring Framework build, that can be found in the chapter Converting existing Ant builds in the book Better Buils With Maven, that I filed in the Spring Framework issue tracker.

It’s also worth to say that Acegi Security System for Spring has been building happily with Maven 1 for far more than a year and now is switching to Maven 2. Spring Rich Client is also building now with Maven 2.

If you still are not convinced about splitting your jars in small components based on your use cases (bad for you), here is the work around in Maven:

  • Create a pom for your whole jar (spring-webflow), with all but core dependencies tagged as optional. You can build the jar with this pom.
  • Create a pom for each of the configurations, setting packaging as pom, eg spring-webflow-spring-webmvc, spring-webflow-struts, spring-webflow-jsf
  • To that poms add a dependency in spring-webflow and the required deps for that configuration
    • spring-webflow-spring-webmvc -> spring-webflow, spring-webmvc
    • spring-webflow-struts -> spring-webflow, struts
    • spring-webflow-jsf -> spring-webflow, jsf
  • In your application now you can depend on any of the projects in point #2 setting type to pom inside the dependency tag.

Hope you choose the right way and don’t go into the dark side 😉