Posts Tagged ‘Maven’

JSF 2, Spring 3, Spring MVC 3, Hibernate 4, Tomcat 7 – a lightweight approach

April 22nd, 2012

“What is your favourite design pattern?” Question asked in a job interview.

WTF question is that?

“Hmmm… my favourite design pattern is Salami pattern – approaching to the finish line slice by slice.”

– From Antidisestablishmentarianism I.T.

In my previous blog - Spring 3 shacks up JSF 2, the maverick way, demonstrating how JSF 2 a component, event driven framework as the presentation layer, and Spring 3, Spring MVC 3 work in middleware. Well, technology keeps evolving. Hopefully even pigs could programe one day. This time, Hibernate 4 is added as the persistence layer. Now, we have end-to-end, a “traditional” three tiers web application. Moreover, an unit test to test business logic layer, the most important, runs outside of container.

Firstly, files and directories structure:

The backend database is Oracle’s example of  Human Resources (HR) application for a fictitious company (check the reference at the end of the blog).

» Read more: JSF 2, Spring 3, Spring MVC 3, Hibernate 4, Tomcat 7 – a lightweight approach

HelloWorld JSF 2, Maven 2, Tomcat 7 Quickly

April 13th, 2012

If you have a development job, sitting in front of computer at least 12 hours a day, 7 days a week, most of developers will get sicker year after year. Especially when the weather outside office cubic is great, the only wish you want immediately is a nuclear bomb dropped in the data center and whole system and network melt down.

But the Russian nuclear bomb is stuck in the middle of launching due to lack of maintenance for ages. System and network still work perfectly. Now the only thing you can do is get your work done as quick as a rabbit runs away from hunter.

Now, let me introduce the main cast for this blog – Maven, Tomcat … They let you get most of your work done, on the command line, and run.

Hopefully you’ve got Maven, Tomcat 7 installed. Plus, Maven and Tomcat plugins installed in Eclipse. We still can’t replace Eclipse fully with vi, just to get some kind work done.

Before Maven, there is Apache Ant a software tool for automating software build processes, but Ant is too rudimentary, need to integrate a lot add-ons and 3rd party libraries, e.g. Apache Ivy for dependencies, to carry on some task. This makes Maven down to a different, profound, philosophical path, an all-in-one automatic build, dependency solving, compiling, package, testing and deployment framework.

I’m in the middle of no-where to build a simple HelloWorld JSF web application from scratch. Watch here, how fast you can drive.

To create a web application project with Maven (I run this in a Console on Mac OS X):

tmiao@chmbp02-2 ~/Projects/Sandbox/src
13:12:33 163 $ mvn archetype:generate -DgroupId=org.paradise.sandbox -DartifactId=HelloWorld -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

» Read more: HelloWorld JSF 2, Maven 2, Tomcat 7 Quickly