Thursday, November 27, 2008

Maven, Woodstock and Netbeans 6.5

I spent quite a bit of time trying to "mavenize" our woodstock based project. I am sure someone will point out how to do this easier, but I was unable to find a reference. This magic works for me and I haven't been able to find something simpler.

At the high level, what I did was create a standard webapp project with the option to create a dedicated library. I used the .jars in that directory to populate my own repository on my own web server (using mvn deploy:deploy-file). I created a maven webapp project, and edited the pom.xml to reference my repo. I then copied WEB-INF files from a working woodstock project into my new maven project WEB-INF. Then created a couple of VWJSF pages in the new project, with a couple of restarts and "make clean"s. It was most surprising that the first VWJSF page fails, bu subsequent ones work.

Thanks to Robert Hook for giving me the idea to use the .jars placed in the "Dedicated library". I tried the rest of the recipe without this step but it does not work. Most of the entries are probably irrelevant because the IDE puts its own entries in the pom.xml, copying SNAPSHOT versions of some of these files to your local repo. But which ones, I do not know. If I had more time and patience, I would pull out the ones that appear to be replicated and see if it works.



<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>Try999</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>Try999 Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.woodstock</groupId>
<artifactId>jsfcl</artifactId>
<version>6.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.woodstock</groupId>
<artifactId>appbase</artifactId>
<version>6.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.woodstock</groupId>
<artifactId>dataprovider</artifactId>
<version>6.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.woodstock</groupId>
<artifactId>sqlx</artifactId>
<version>6.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.woodstock</groupId>
<artifactId>webui</artifactId>
<version>6.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.woodstock</groupId>
<artifactId>commons-fileupload-1.0</artifactId>
<version>6.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.woodstock</groupId>
<artifactId>defaulttheme</artifactId>
<version>6.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.woodstock</groupId>
<artifactId>errorhandler</artifactId>
<version>6.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.2_04-p01</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>1.2_04-p01</version>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>jsfcl</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>appbase</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>dataprovider</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>sqlx</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>webui-jsf</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>commons-fileupload-1.0</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>json-2</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>jsf-extensions-common-0.1</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>jsf-extensions-dynamic-faces-0.1</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>webui-jsf-suntheme</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>errorhandler</artifactId>
<version>SNAPSHOT</version>
</dependency>

</dependencies>

<repositories>
<repository>
<id>woodstock</id>
<name>woodstock</name>
<url>http://YOURREPO.COM/woodstock/</url>
</repository>
<repository>
<id>javanet</id>
<name>javanet</name>
<url>http://download.java.net/maven/2/</url>
</repository>
<repository>
<id>jsf12</id>
<name>Repository for library Library[jsf12]</name>
<url>http://download.java.net/maven/1</url>
<layout>legacy</layout>
</repository>
<repository>
<id>unknown-jars-temp-repo</id>
<name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
<url>file:${project.basedir}/lib</url>
</repository>
</repositories>

<build>
<finalName>Try999</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.2</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
</properties>
</project>