Dark theme | Light theme

September 10, 2008

Use external Maven to work with Cocoon 2.2 in NetBeans

Update: since NetBeans 6.5 we don't have to use the external Maven. We can use the internal Maven from NetBeans! So if you use NetBeans 6.1 you must apply what is described in this post, otherwise you are already to go.

Working with Cocoon 2.2 is a blessing compared to the previous versions. Cocoon 2.2 is now based on the Spring framework and uses Maven for the build process. Especially the dependency mechanism of Maven makes creating a new Cocoon application a lot easier. And if there is one IDE out there with superb Maven support than it is NetBeans.

NetBeans already has the Cocoon Maven archetypes available. To create a new Cocoon block for example is as easy as clicking on several menu options. The only thing we need to consider is that the Cocoon Maven plugin doesn't (yet) support the Maven 2.1-SNAPSHOT version, which is used by the NetBeans. Luckily we can define an external Maven in NetBeans to be used.

Make sure we have installed Maven 2.0.9 on our computer. Then in NetBeans we go to Tools | Options | Miscellaneous | Maven 2. Here we can define the path to our Maven 2.0.9 in the field External Maven Home.

After we have defined the path to Maven we can select a project and go to Project properties. In the Actions section we can select the checkbox Use external Maven for build execution.