You would like to use PrimeFaces for that neat new project you were assigned. You want to ensure that everyone on the team can get the dependencies installed without a hitch, so you naturally choose to use Maven for this. I’ll describe a minimal implementation using Eclipse Juno that will get you started down the path to rich UI using Java.
I’ll assume you already have Eclipse installed. I tested this using Eclipse Juno Service Release 2.
Create a new Maven Project in Eclipse.
You should now see the project in your Project Explorer view. First we’ll want to edit pom.xml to get a few things set up. I am using Java 7 for this project, but you can replace 1.7 with 1.8 in the source and target tags if you feel so inclined.
Since we are already in pom.xml editing things, let’s add the JSF dependencies.
We’ve got some error markers now, so we’ll need to fix those.
You can fix the Maven Problems by updating your Maven Project.
Alternatively, you could just use the Eclipse Quick Fix feature.
Now let’s convert this to a faceted project so we can run it on Tomcat. Right click the project in the Project Explorer view and choose Properties -> Project Facets.
Click OK. Your project will be reconfigured and will now look like this:
We need to add the Maven Dependencies to the Deployment Assembly. Open the project Properties. You may need to update your maven project and refresh your project for the Maven Dependencies option to become available.
We’ll use the example code from the PrimeFaces website.
With that done we can now run this project on the server.