HOWTO: Setup a shell Java Struts 2 web app using Maven 2 & Eclipse 3.4

November 26th, 2008

The latest project I’m working on is a Java web app using Struts 2. I wanted to use the eclipse IDE since it’s industry standard and the Maven 2 build system for compatibility with other company projects.

I did plenty of reading (Maven: The Definitive Guide is a good place to start), but nowhere did I find an easy step-by-step quickstart for this combination of tools.

So I’ve pieced my reading and research together and here it is:

Prerequisites

Java
maven 2
eclipse 3.4.1

Create a new skeleton project:

1
2
3
4
5
6
cd ~/workspace/</br>
mvn archetype:generate -DgroupId={name of your group e.g. com.austenconstable} \
-DartifactId={name of your app} \
-DarchetypeGroupId=org.apache.struts \
-DarchetypeArtifactId=struts2-archetype-starter \
-DarchetypeVersion=2.0.11.2

If you’re not sure on the latest struts 2 archetype release version check here.

Generate the eclipse project files:

mvn eclipse:eclipse

Configure eclipse:

mvn eclipse:configure-workspace -Declipse.workspace=/path/to/your/workspace/

Import the project into eclipse:

Fire up eclipse and use File>Import…

And now all you need to do is build your app!

West Coast USA – Day 9 – Last Day

October 19th, 2008

Breakfast in the hotel again of bagels and coffee. Mad French-Canadian woman is still there chatting away in ‘French’ to strangers.

We checkout and drive along Haight Street to the park and try to drive through the park. It’s mostly closed because of the women’s marathon today and so we head down to the water front but that’s closed off too! We drive back up the park and cross over it on the main road and down the other side. This time we still can’t get right up to the front but we can drive south next to the sea which is the direction we want to head.

After finding a parking space we cross the path of the runners and walk along the promenade. The beach looks like there’s been an oil spill or something as it’s very dark and doesn’t look very nice. Not how I remember it. Decide to walk on the promenade instead of the beach itself.

After the walk we drive down to West Portal, as I used to go there when I was studying over here, for some lunch. We find a nice pizza place and order a mini and a small plus salads to start. The small pizza is huge and we see a whole family order just one between them! We soldier on and finish as much as we can.

After lunch we drive to the airport and drop the car off with plenty of time. Once we check it we take a beer while writing post cards. Ordering the beer turns into a complete saga as the bar maid is deaf! I feel very sorry for her as it’s obviously difficult for her, but at the same time just want a beer! In the end I resort to writing down the order on a post-it pad.


View Larger Map

It’s been a superb if not intensive holiday and we’ve enjoyed it immensely. Hopefully we’ll come back again at some point and spend some more time at the Evergreen Lodge.

The total scores are:
Days : 9
Distance : 1671.8 Miles
Gas bill : $365.50 (£244.70)

West Coast USA – Day 8 – Golden Gate

October 18th, 2008

Breakfast in the hotel of bagels and coffee. Strange French-Canadian woman lurking about and talking to people in French. (Except Di tells me, that her French is terrible, so no idea what’s going on there…)

Over breakfast we decide to walk into downtown as it;s only 10 blocks away. We end up walking and talking for 10 blocks in the wrong direction! Thankfully it’s a nice day so we turn around and had 20 blocks in the other direction.

Waiting for the tram

When we finally get downtown we join the long queue for the cable car from Market Street. I purchase tickets and a MUNI map from the ticket booth and after 30 minutes or so waiting we ride the PH line to Fisherman’s wharf.

We walk along the front and stop to buy the mandatory fridge magnet and head towards the seafood restaurants for lunch. Decide on Alioto’s as it looks nice and is apparently quite famous. We have both have clam chowder to start with, Di has the New York style (tomato based) and I have the New England style (cream based). We agree that the New York style chowder is the best. Afterwards Di has a Creole scallop dish with rice while I have crab ciotto which was crab legs, muscles, clams and shrimps in a delicious tomato sauce.

On the bike ride

After lunch we take a walk to see the seals and check out boat tours. We end up hiring two mountain bikes and ride them along the sea front and over the golden gate bridge! Once we get to the other side we decide not to take the ferry back and to ride instead. Di is a lot faster on her bike and makes it look effortless, I can’t keep up!

On the bike ride

We get back to Fisherman’s Wharf around 5pm and stop into a lot bar for pints of Bud Light and a fried calamari snack. On the way to the bus stop we drop into a Walgreens to buy stamps and Twinkies (For Spencer) and take the 47 bus back to the hotel.

Once back at the hotel we make a reservation at Alfred’s (a famous steak house), shower and change and head out to catch another bus.

We arrive slightly early at Alfred’s to be seated in a plush red booth. We share a bottle of local red with our steaks. Di has steak and shrimp I have the Fillet Mignon with garlic mash, which is delicious.

Afterwards it’s another bus ride back to the hotel and to bed.


View Larger Map