środa, 8 maja 2013

Simple maven web application deployed on jetty server

  • jdk
  • maven

Use maven to generate simple web application:
mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -Dversion=1.0-SNAPSHOT
Genereted project open in your IDE. Now you can view structure of generated web application. 
Using maven you can compile, run test or build you application:
mvn compile
mvn test
mvn install
After a successful build, maven generate target folder. You will find there WAR 
with name of you application(appName.war). If you will look closer to pom.xml file you will 
find out that the packaging type was set there:
To run generated project on jetty server at first you have to edit you pom.xml file 
and add jetty plugin declaration:
Now using command
   mvn jetty:run
you can start jetty server with generated WAR file.
Open your browser and  under address 
you can see page of your running application. 
For windows enviroment make sure that firewall does not interfere 
Jetty server to execute on port 8080.

Brak komentarzy:

Prześlij komentarz