C5 Using Maven (Cont.)

Build JSF Application with eclipse WTP and Maven

To build the JSF application, we need to collect all required dependencies.

           <dependency>

                  <groupId>javax.faces</groupId>

                  <artifactId>jsf-impl</artifactId>

                  <version>1.2-b19</version>

           </dependency>

           <dependency>

                  <groupId>javax.faces</groupId>

                  <artifactId>jsf-api</artifactId>

                  <version>1.2-b19</version>

           </dependency>

           <dependency>

                  <groupId>jstl</groupId>

                  <artifactId>jstl</artifactId>

                  <version>1.1.2</version>

           </dependency>

 

We also need to get the plugin that we need for JSF facet.

           <plugin>

                  <groupId>org.apache.maven.plugins</groupId>

                  <artifactId>maven-eclipse-plugin</artifactId>

                  <configuration>

                        <workspace>C:\devel\applications\jsfapp</workspace>

                        <additionalProjectFacets>

                               <jst.jsf>1.2</jst.jsf>

                               <jst.ejb>3.0</jst.ejb>

                               <jst.web>2.5</jst.web>

                        </additionalProjectFacets>

                  </configuration>

           </plugin>

 

workspace inside the configuration is something that I didn’t mention earlier. It is the path to your eclipse workspace where maven to copy the downloaded dependencies to. (This is how you to do it with maven, and the earlier note were telling you how to do it with eclipse IDE) Alternatively, you could do this in the command line.

mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo

 

additionalProjectFacets is the parameter to tell eclipse:eclipse goal to build the JSF facet. After you run with this parameter, you could find the content in the file generated in the file org.eclipse.wst.common.project.facet.core.xml that exactly matches to your configuration. (Sometimes, you need to have a check whether the new generated file got the content you expected)

mvn -Dwtpversion=R7 eclipse:clean eclipse:add-maven-repo eclipse:eclipse

 

You also have to declare the WTP version that available for your eclipse, which should be 1.0, 1.5 or R7(2.0).

 

Because of the new JSF facet added to the project, you will no longer be able to build a new project with existing source as usually we do, but import “Existing projects to workspace”.

http://maven.apache.org/plugins/maven-eclipse-plugin/index.html

 

 

 

 

Advertisements
This entry was posted in Maven. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s