Friday, October 19, 2007

Ant vs Maven - Round 2


Alright so now i need to programmatically generate files to include in the WEB-INF directory along other static files.

Round two: Defining multiple places for aggregation
Maven lifecycle is pretty well defined (1). To generate my files, i'm using a Mojo (Maven Pojo) attached to the generate-resources phase. Easy enough, pretty cool.

The issue i have now is that i need to generate those files in target directory. I obviously don't want to put my generated files with the sources and the plugin which builds the war files only allows a unique location for such files... I'm doomed, i need to workaround.

For the workaround (thank you Wesley for the tip) i use:


<project>
...
<build>
...
<resources>
<resource>
<directory>${basedir}/target/generated/</directory>
<targetpath>${basedir}/target/${artifactId}-${version}</targetpath>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
...
</build>
</project>


I'm sure there is a bit better to do (how do i reference the target directory ?) but that's the general idea of the workaround.

In ant i would just use 2 filesets and i would be done.
The advantage that Maven is supposed to give me just vanished and i had to use an ant-style solution. So here i cannot really give a winner, except that Maven failed in its promises (can i have my money back ?), i'll still give 1 point to both.
Maven 2 - Ant 1

(1) missing "prepare-package" in the current GA version but included in the coming 2.1. I will need that one, i can trick)

Wednesday, October 17, 2007

Ant vs Maven - Round 1


When it comes to Ant vs Maven on a forum it usually ends up as an endless discussion, with arguments getting worse and worse, a bit like Windows vs Linux, LCD vs Plasma or Frite ou Potatoes (as they ask in Swiss Mac Donalds). Basically you have to try both to get your own opinion. Still I will try to forget what i heard and just give my experience, the experience of someone who used ant for years and giving a try to Maven.

Round one: Starting a new project
To start a new project, Maven is really nice with the archetype feature:
Typing: mvn archetype:create -DgroupId=org.jboss.portlet -DartifactId=helloworld -DarchetypeArtifactId=maven-archetype-webapp
Gets you started. It creates the (in)famous pom.xml and a directory structure. It's easy to understand where to put your files, the structure basically follow the structure of your war. The generated pom is able to create the war file in exploded and imploded form and few other things. Dependencies are easy to define as long as the binaries exist in a maven repository.
With ant, i would have to define my structure and create the script to build my war. I would also have to manage the dependencies myself of use something like ivy. In fact, i would probably reuse ant scripts that i already wrote or from others.

Maven 1 : Ant 0
I'll write more rounds soon.

Monday, October 15, 2007


It looks like, a lot of people have legacy application using Struts and want to integrate them in a Portal. It is not surprising since Struts (fathered by Craig McClanahan, who is also the father of JSF) born in 2000 was so popular and was solving most of the problems of web development at that time.

It also seems that lot of developers think they invested enough time learning Struts that they want to use it forever, so they start developing new applications using it.

For both cases, JBoss Portal supports Struts through the Apache Struts Bridge, yesterday i added on (the currently messy) portletswap.com a new application which is the current demo application of the Struts bridge pre-configured for JBoss Portal 2.6.2. (Note that it will not work out of the box on any earlier version)

The demo application is the famous jPetStore running as a portlet. The application is available here. Just grab the war file and stick it to your deploy directory of JBoss AS, and a new page will appear with the portlet on it.

Note that if you are using JBoss AS 4.2.x or JBoss EAP 4.2 you will need to start it by passing an extra parameter:
-Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=false
It can be done by editing JBOSS_HOME/bin/run.conf and adding it to JAVA_OPTS.

This parameter will not be required in JBoss Portal 2.6.3 due in December.

Hope this helps.

Music industry could follow the opensource model


The new Radiohead album has an interesting marketing concept. You pay what you want for it...
-Yes- in the shopping e-basket you put the number you want.

Since Radiohead is part of my favorite bands, (Ok Computer rocks) i decided to give it a try.
I've often heard people claiming that they download illegally music on the web but then buy the CD if they liked it. Here that's basically what i'm doing, right now i'm downloading it (at 600Ko/s, that's cool) but entered a price of 0.00. If i like it, i will go back and chip-in, iTunes gives you an idea of a fair amount for downloaded music i think (10Euros/album).

Now, i'm sure they are not crazy, most of the money made around this band is probably on concerts and marchandising anyway, the business is changing, they adapt.
It's just a marketing trick, i would not blog on them if it was just any new CD, marketing worked.

Now what does it mean for the future ? Shouldn't records be free after all, and indirectly make money through the concerts ? Should music industry follow the software industry ? Think professional opensource. Give away the meat (Software or music) but bill the access to the butcher (developer or rock star).

Saturday, October 13, 2007

Eledees on Wii


Eledees on the Wii is a funny game, i bought it used yesterday for CHF40.0-, and played with it for about 2 hours.
It's a repetitive but addicting game. You need to find those Eledees, who can give you watts. Those tiny things hide in different rooms but you basically have to move everything in a room to find them. You end up throwing beds and chairs accross the rooms.
But before you can lift those heavy stuff you need to get other kind of Eledees, you get them only by switching on different electrical devices like TV, lamps, radio... But to activate them you need watts, follow me ?

It is not the game of the year, but it's fun and should keep me entertained for a couple of hours. Talking about it, i'll jump on my Wii right now.

Tuesday, October 09, 2007

The Album Leaf


Another band i discovered at the 9:30 club a couple of years back (damn i miss such a place here in Switzerland...). The album leaf, produces very pure music, nothing fancy. My favorite song of all time from them is "The MP" available on the Deezer player on your right hand side of this blog. It is part of the "One Day I'll be on Time" album.
I used to *try* to play electronic drums for about a year, the drums are very present in this song. Just a simple melody at the drums and electronic keyboard that makes me happy when i listen to it in the morning.

Wednesday, October 03, 2007

Neuchatel, Wine festival



What happens in Neuchatel stays in Neuchatel so i won't disclose too much about people but the Neuchatel's wine festival this year was amazing. Among the 80,000 visitors per night we had about 30 (ex-)JBossians around to make the party even crazier.

Neuchatel is a 30,000 inhabitants city, so having three times its population in the city center (closed to cars) is something unique. The usual nightlife is really quiet, but for that special weekend everybody meet, dance and drink for a whole year.