PrimeFaces 5.0 using Eclipse Juno with Maven

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.

The relevant links I used for this project are:
PrimeFaces –
PrimeFaces
Example code for PrimeFaces xhtml page –
Getting Started

JSF jars –
JSF-API jar
JSF-IMPL jar

I’ll assume you already have Eclipse installed. I tested this using Eclipse Juno Service Release 2.

Getting Started

Create a new Maven Project in Eclipse.

Screen Shot 2014-08-23 at 10.33.57 AMScreen Shot 2014-08-23 at 10.34.16 AMScreen Shot 2014-08-23 at 10.35.06 AM

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.

Screen Shot 2014-08-23 at 10.37.53 AM

Since we are already in pom.xml editing things, let’s add the JSF dependencies.

Screen Shot 2014-08-23 at 10.39.17 AM

We’ve got some error markers now, so we’ll need to fix those.

Screen Shot 2014-08-23 at 10.40.35 AM

You can fix the Maven Problems by updating your Maven Project.

Screen Shot 2014-08-23 at 10.41.24 AM

Alternatively, you could just use the Eclipse Quick Fix feature.

Screen Shot 2014-08-23 at 10.40.53 AM

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.

Screen Shot 2014-08-23 at 10.42.32 AM Screen Shot 2014-08-23 at 10.43.04 AM

Click OK. Your project will be reconfigured and will now look like this:

Screen Shot 2014-08-23 at 10.43.17 AM

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.

Screen Shot 2014-08-23 at 10.47.01 AMScreen Shot 2014-08-23 at 11.38.53 AMScreen Shot 2014-08-23 at 10.49.48 AMCreate a new File in your WebContent directory. We’ll name this file index.xhtml.

Screen Shot 2014-08-23 at 10.53.08 AMScreen Shot 2014-08-23 at 10.53.33 AM

We’ll use the example code from the PrimeFaces website.

Screen Shot 2014-08-23 at 10.53.48 AM

With that done we can now run this project on the server.

Screen Shot 2014-08-23 at 10.54.14 AMScreen Shot 2014-08-23 at 10.46.26 AMWe are presented with the PrimeFaces spinner UI Component.

Screen Shot 2014-08-23 at 10.54.36 AMGreat Success! You have now set up a new project using PrimeFaces, Maven, and Eclipse. Happy coding!

 

Project Management

 

 

I have decided that I need to get to work on all of the projects that are floating around in my brain and on paper scattered all over the inside of my desk. In order to facilitate the timely and orderly partial-completion of these projects, I thought it would be terribly fun to hire some help. I found the hired help on the interwebz for the low cost of a few hours of my time, which is a price I’m always happy to pay.

First up, I have brought Redmine onto the team. She brings a lot to the table. Here are a few of the features available:

  • Integration with Gitorious.
  • Integration with Mylyn on Eclipse.
  • Multiple, separate projects.
  • A per-project Wiki.
  • A per-project Forum.
  • Repository browsing, including diffs.
  • Teams, roles, and custom User permissions.
  • Report generation.
  • Time tracking.
  • Workflows.
  • Milestones.
  • Invoicing.
  • … and on and on.

I also like that Redmine is a project written using Ruby on Rails, which is what I am planning to do my projects in. So bonus points there.

Second up, Gitorious has come on board to manage version control. He brings along some great features that, in my opinion, are much easier to use than the Gitolite and Gitweb setup that I had been using previously. Here are a few of the skills that Gitorious brings to these projects:

  • Version Control.
  • SSH pubkey management.
  • User management.
  • Team creation and management.
  • Multiple separate projects.
  • Activities for projects and updates.
  • The ability to ‘watch’ and ‘favorite’ projects.

Gitorious is also written using Ruby on Rails, so more bonus points there. 

It is quite convenient to have both Gitorious and Redmine running on the same Phusion Passenger install on my Ubuntu Server. Unfortunately, the target version of Ruby that I plan to use for my project is 1.9.3, and the version of Ruby utilized by the current applications is Ruby EE, 1.8.7. I am not aware of a way to run two versions of Ruby with the same Passenger install, so I’ll most likely spin up another VM to host the Rails application when it comes time to deploy it.

Finally, I will be putting Aptana 3 and Mylyn to work on keeping my bugs and features in my view while working on these projects. I am using the Mylyn-Redmine-Connector found at http://redmin-mylyncon.sourceforge.net/ and have not had any issues with it so far. I am using the EGit Eclipse plugin (since Aptana is based on Eclipse 3.7) and it works like a charm.

I will update this blog as the projects move along and publish a few tutorials for some of the install issues that I have run into, and undoubtedly will run into, along the way.