Wednesday, November 14, 2007

JSF : MyFaces and Sun RI profiles for Maven 2

I've used MyFaces as implementation of JSF 1.1 specification. Why ? The main reason is great community and great support for Maven 2 - maven-archetype-myfaces for example, + Tomahawk.

And now, I'm interested in what is the difference between the two ? Any comments appreciated.

Maven 2 is my friend here, since I can use profiles - one for JSF RI, another one for MyFaces. I guess it could be useful for someone else, so here is the code :

<profiles>
<profile>
<id>jsfri</id>
<activation>
<property>
<name>jsf</name>
<value>ri</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.1_02</version>
<exclusions>
<exclusion>
<groupId>java.servlet.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>1.1_02</version>
<exclusions>
<exclusion>
<groupId>java.servlet.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>java.net</id>
<name>java.net Maven 1 Repository</name>
<url>
https://maven-repository.dev.java.net/nonav/repository
</
url>
<layout>legacy</layout>
</repository>
</repositories>
</profile>
<profile>
<id>myfaces</id>
<activation>
<property>
<name>jsf</name>
<value>myfaces</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>1.1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>1.1.6-SNAPSHOT</version>
</dependency>
<!--
<dependency>
<groupId>org.apache.myfaces.tomahawk</groupId>
<artifactId>tomahawk</artifactId>
<version>1.1.6-SNAPSHOT</version>
</dependency>
-->
</dependencies>
<repositories>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots/>
<id>apache-maven-snapshots</id>
<url>
http://people.apache.org/repo/m2-snapshot-repository
</url>
</repository>
</repositories>
</profile>
</profiles>
To switch between profiles use "mvn -Djsf=ri" or "mvn -Djsf=myfaces".

2 comments:

Term Papers said...

I have been visiting various blogs for my term papers writing research. I have found your blog to be quite useful. Keep updating your blog with valuable information... Regards

Term Papers said...

I have been visiting various blogs for my term papers writing research. I have found your blog to be quite useful. Keep updating your blog with valuable information... Regards