This document describes how to create a basic web app using Maven.
Create The Project
Type the following maven command at the command prompt. Replace
-DartifactId with information specific to your group and your project, respectively.
Now edit the pom.xml file and add the Jetty plugin. Jetty is a HTTP server and javax.servlet container, and the Jetty Maven Plugin allows you to run your project in Jetty using maven.
Add the following XML to the
<build> section of pom.xml:
Once you have done that, you can now run your newly created project in Jetty. From the root directory of the project, type:
Now check out your app by going to: http://localhost:8080.
Set Up Project In Eclipse
Now that the project has been created, tell maven that this is an Eclipse project.
Note: If you want to use Intellij IDEA, you can do the following:
Now, import your project into Eclipse:
From Eclipse go to File > Import > Existing Projects into Workspace (under the General category). Select the root directory of your project. Click Finish, and you now have your project set up in Eclipse.
More detailed information about how to fully set up Eclipse for this project can be found on the appfuse.org site: http://appfuse.org/display/APF/Eclipse
Build The Project
Now that you have the project set up and ready to go, you will want to build the .war file. To do this you must "install" the app:
Once this is complete, you will see a new directory called
target an inside of it will be
Make the Project a Spring Project
Now that the basics have been covered, let's actually make this project a Spring project by adding the Spring framework dependencies to the pom.xml file.
Before you build a maven project it is always best to clean the project first. To do this just type: