Today I wanted to start a prototype portlet and thought that instead of wasting time creating my environment with ant I could use that same time learning maven2 and creating the environment with it.
I used maven for EasyConf and some projects in Germinus so I wasn't expecting it to be hard. Overall I was very pleased with the great improvements of Maven2 over Maven1. In particular I think that idea of defining a lifecycle is just brilliant.
But unfortunately I've also found some annoying problems. First of all the documentation has improved a lot since I first used maven, but it still feels very short. Being used to ant I often found myself with questions to which I couldn't find an answer. After reading some articles I finally found a book about maven written by Vincent Massol et al and sponsored by Mergere. If you want to learn about Maven I strongly recommend starting with it:
Better builds with maven (Free, requires registration)
The main problem that I found was when I tried to configure Maven to deploy my portlet application WAR to Liferay Portal's autodeploy directory. At first I thought that the 'deploy' lifecycle sounded like the right thing, but after a while that the purpose of that phase is just to deploy the artifact to remote repositories for consumption by other maven environments.
Then I found about the cargo plugin. This is a great plugin for managing deployments to application server and I will be investigating further about it. But after quite some time trying with different configuration options I had to give up.
All I wanted to do is to find a way to automate copying a file. Something that could be done in one line in ant or Linux's command line. But I had spent around 2 hours looking for a solution with no luck.
The final solution that I found was to use the antrun plugin:
<build>
<finalName>exhibit</finalName>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<configuration>
<tasks>
<copy file="target/exhibit.war"
todir="c:/projects/liferay/autodeploy"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
I'm pretty sure that there must be better solutions, so if anyone reading this knows about them, I'd appreciate if he/she can write a comment about it.
As a conclusion, I feel that maven2 is much better than ant and maven1 for building an environment for developing portlets. But the learning curve for learning how to set up a new environment is still harder than I would like.