I am doing some Struts work after a long time. Interestingly it is for a Test Driven Development training. A client wants me to do a hands on session, using Struts 1.x, and EJB's. They also want to do the hands on sessions with a small but production project. It seems their developers are tired of Calculator and Shape projects :-) Well I can't really blame them.
I have been planning to create some micro applications around diycomputerscience.com . I hope to create each application using a different technology, so I can have several reference points for teaching.
For this session I am going to make a web application which will store and display my slides. I am sure you are thinking ... but why not just use SlideShare ? Well besides the fact that I think this makes a great application that is small, but also production quality. Ideal for using to teach. But there are other reasons as well. It is very hard to embed code snippets on Slideshare. Slideshare also does not support comments per slide.
Since I started working with Maven sometime back, I thought, why not use Maven for dependency and build management for this project.
While creating an Eclipse web project for Struts 1.x using Maven led me to some issues, and I feel it might help others if I documented them.
The first thing I needed to do was to find a Maven archetype for creating a Struts project. Interestingly the Struts 1.x archetype has been removed from the Maven 2 repository. So, I downloaded the archetype from this repository. Then I did a 'mvn install' to install the archetype in my local Maven repository.
svn co http://svn.apache.org/repos/asf/struts/maven/trunk/struts-archetype-blankcd struts-archetype-blankmvn install
Then I created my Struts project, and used maven's eclipse plugin to generate Eclipse proejct files.
mvn archetype:generate -DarchetypeGroupId=org.apache.struts -DarchetypeArtifactId=struts-archetype-blank -DarchetypeVersion=1.3.5-SNAPSHOT -DgroupId=com.diycomputerscience -DpackageName=com.diycomputerscience.stslides -DartifactId=struts-slides
However, when I tried running the project, I realied that this project was not an Eclipse dynamic web project. That's not good because I wanted to run it from within Eclipse. A bit of searching led me to this post which explained that I needed to run
mvn eclipse:eclipse -Dwtpversion=2.0
Now all seems to be fine. I have a Struts 1.x dynamic web project which is managed by Maven and can be run within Eclipse.