Eclipse + Maven + jetty webapp Development

Source: Internet
Author: User

As a Java developer,

(Take configuring a spring + hibernate + struts2 webapp as an example)

Are you bored with searching for jar packages and related dependencies on websites,

Are you angry about the incompatibility or conflict between the jar packages,

Are you confused about the location where your jar package is stored on your computer,

Is it a headache for you to share and reuse jar packages between multiple projects,

Are you sure you want to write a bunch of ant scripts to build war packages for your project,

There are also many problems such as regression testing, continuous integration, and deployment...

ProgramStaff time should be spent on writing programs, rather than spending too much on these links.

Maven is the terminator of these problems, and it can do more.

Maven will make you prefer Java.

"Since Maven, my eyes are no longer sour, my hands don't hurt, and my waist and feet are powerful ..."

 

######################################## ###########################

Http://maven.apache.org/

Http://www.eclipse.org/jetty/

Http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin

Http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin

Tool: Eclipse + Maven + Jetty

Plug-ins: m2eclipse, Maven-jetty-plugin

MVN jetty: Run-djetty. Port = 2222

Pom. xml

<? XML version = "1.0" encoding = "UTF-8"?> <Project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion> 4.0.0 </modelversion> <groupid> COM. CG </groupid> <artifactid> test-Maven-jetty </artifactid> <packaging> war </packaging> <version> 0.0.1-Snapshot </version> <Name> test- maven-jetty Maven webapp </Name> <URL> http://maven.apache.org </URL> <Properties> <project. Build. sourceencoding> UTF-8 </Project. Build. sourceencoding> <! -- Optional: Todo 1 pick the version of jetty you want. --> <Jetty. version> 8.1.8.v20121106 </Jetty. version> </Properties> <! -- Todo 2 configure repo2.maven.org as a repository. --> <! -- Optional <repositories> <repository> <ID> repo2_maven_org </ID> <URL> http://repo2.maven.org/maven2 </URL> </Repository> </repositories> --> <build> <plugins> <plugin> <groupid> Org. mortbay. jetty </groupid> <artifactid> jetty-Maven-plugin </artifactid> <! -- Old version <artifactid> Maven-jetty-plugin </artifactid> --> <! -- Optional --> <version >$ {Jetty. Version} </version> <configuration> <! -- Scans the project file changes every n seconds, including java files. If the value is 0, restart jetty --> <scanintervalseconds> 10 </scanintervalseconds> <stopport> 9999 </stopport> <webapp> <contextpath>/W </contextpath> </webapp> </configuration> </plugin> </plugins> </build> <! -- <Build> <outputdirectory >$ {project. basedir}/src/main/webapp/WEB-INF/classes </outputdirectory> <finalname> test-Maven-Tomcat </finalname> </build> --> <dependencies> <! -- <Dependency> <groupid> Org. eclipse. jetty </groupid> <artifactid> jetty-server </artifactid> <version >$ {Jetty. version }</version> </dependency> --> <dependency> <groupid> JUnit </groupid> <artifactid> JUnit </artifactid> <version> 4.11 </version> <scope> test </scope> </dependency> </dependencies> </Project>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.