eclipse maven java web project

Eclipse maven java project:

Eclipse provides m2eclipse plugin to integrate Maven and Eclipse together.

Steps to create maven java web project in eclipse:

  1. In eclipse, click on File menu → New → Maven Project. Select maven-archetype-webapp template to create java project and Click on Next button.
  2. Now provide the group Id, artifact Id and Package. Click on Finish button. Complete directory structure and all files like web.xml file, pom.xml file, test case file etc will be created automatically.

Directory structure of the maven java web project:

Auto created index.jsp:

<html>
<body>
<h2>Hello World!</h2>
</body>
</html>

Auto created web.xml:

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >
 
<web-app>
  <display-name>Archetype Created Web Application</display-name>
</web-app>

Auto created pom.xml:

<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>tutorialspointexamples</groupId>
  <artifactId>MavenWebProject</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>MavenWebProject Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>MavenWebProject</finalName>
  </build>
</project>


Please follow and like us:
Content Protection by DMCA.com