Building JSF-2 Apps with Apache Maven 2

21 Oct
2009

he team from Sun/the JSF Expert Group released a page showing what you need to add to your pom.xml to include jsf-2 in your maven project.

Taken from https://javaserverfaces.dev.java.net/maven2, the required parts are:

If you use Glassfish v3 or higher:

1
2
3
4
5
6
<dependency>
		<groupId>javax.faces</groupId>
		<artifactId>jsf-api</artifactId>
		<version>2.0</version>
		<scope>provided</scope>
</dependency>

If you use Tomcat or Jetty (or any other non JEE6 compliant Servlet Container):

1
2
3
4
5
6
7
8
9
10
<dependency>
		<groupId>com.sun.faces</groupId>
		<artifactId>jsf-api</artifactId>
		<version>2.0.0</version>
</dependency>
<dependency>
		<groupId>com.sun.faces</groupId>
		<artifactId>jsf-impl</artifactId>
		<version>2.0.0</version>
</dependency>

 

However, If you put the JBoss repository either in your pom.xml or your ~/.m2/settings.xml

1
2
3
4
5
		<repository>
				<id>jboss</id>
				<name>Jboss Maven Repository</name>
				<url>http://repository.jboss.com/maven2/</url>
		</repository>

you can then use the following dependencies (which I think are more appropriate):

1
2
3
4
5
6
7
8
9
10
11
		<dependency>
				<groupId>javax.faces</groupId>
				<artifactId>jsf-api</artifactId>
				<version>2.0.0-FCS</version>
		</dependency>
 
		<dependency>
				<groupId>javax.faces</groupId>
				<artifactId>jsf-impl</artifactId>
				<version>2.0.0-FCS</version>
		</dependency>

Also Sun provides some simple JSF-2 archetypes

1 Response to Building JSF-2 Apps with Apache Maven 2

Avatar

Lincoln

November 5th, 2009 at 15:59

Hey Dominik! Nice post. Just so you know, 2.0.1 is out now, and fixed some pretty major container-related bugs in 2.0.0.

Comment Form

top