Wednesday December 10, 2008 12:00PM W92-106A Back Bay

Our December meeting was Maven 2 workshop during which we Maven-ized a simple Web application. Follow these steps to try it out for yourself. If you see any issues with these steps you can mention it on the JUG mailing list.

  1. Download the Maven2Sample-pre-maven.zip file. Unzip it and look at the contents.
  2. Run 'mvn archetype:generate' and choose 'internal -> maven-archetype-webapp (A simple Java web application)' to generate a Maven project. By default this would be number 18 from the menu. Enter the groupId 'edu.mit.jug' and the artifactId 'Maven2Sample' and then accept the defaults.
  3. Go into the Maven2Sample/src/main directory and run 'mkdir -p java/edu/mit/jug/' to create your source directories.
  4. Copy index.jsp from the pre-maven project into your new project's src/main/webapp/ directory.
  5. Copy web.xml from the pre-maven project into your new projects src/main/webapp/WEB-INF/ directory.
  6. Copy Maven2Sample.java from the pre-maven project into your new projects src/main/java/edu/mit/jug/ directory.
  7. Download the pom.xml file above and put it into the top level directory of your new project (overwrite the existing pom.xml).
  8. Run 'mvn package' -- and see that it fails because it can't find the itext JAR file. Download the itext-1.1.jar file and then run 'mvn install:install-file -DgroupId=com.lowagie -DartifactId=itext -Dversion=1.1 -Dpackaging=jar -Dfile=/path/to/jar' (with the correct path). You should then see "BUILD SUCCESSFUL."
  9. Find the Maven2Sample.war file in the target directory and deploy it to Tomcat. It should run! Good luck.  

See the pre-meeting notes below for details about prerequisites, etc.

Pre-Meeting Notes
For our December meeting, we will be having a Maven 2 workshop. The plan is take a very simple Web application project and build it using Maven 2. Participants are encouraged to bring a laptop, download the files, and follow along. The goal is to give people the basic information they need to start using Maven 2 in a hands-on way.

While anyone can come to the workshop, if you want to enjoy the hands-on experience, you'll need a laptop with Java, Maven 2, and Tomcat installed. For those who don't have laptops or can't get these components set up we'll try to pair you with someone else.

  • This is the Java Users Group, so hopefully you have Java already, if not you can get it on the JavaWeb site. The demo is using 1.5 but it is fairly easy to change the demo if you want to use 1.4 or 1.6.
  • Maven 2 download and installation instructions can be found on the Download Mavenpage.
  • You can get Tomcat from the TomcatWeb site. 5.5.x or 6.x should be fine.

We will not spend any substantial meeting time helping people get these components installed, the point is to actually use Maven 2. Please make sure you have these components in place before the meeting. In addition, here are some files specifically for the workshop:

If you can you may also wish to download these files before the meeting.

  • No labels