- 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:
...
<artifactId>appName</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
...
To run generated project on jetty server at first you have to edit you pom.xml file
and add jetty plugin declaration:
...
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
</plugin>
</plugins>
</build>
...
Now using command
mvn jetty:run
you can start jetty server with generated WAR file.
Open your browser and under address
http://localhost:8080/appName/
you can see page of your running application.
Important!!!
For windows enviroment make sure that firewall does not interfere
Jetty server to execute on port 8080.
Brak komentarzy:
Prześlij komentarz