How to create a Web Application Project with Maven

maven-web-project-directory

In this tutorial, we will show you how to create a Java web project (Spring MVC) with Maven.

Technologies used :

  1. Maven 3.1.1
  2. Eclipse 4.2
  3. JDK 7
  4. Spring 4.1.1.RELEASED
  5. Tomcat 7
  6. Logback 1.0.13

1. Create Web Project from Maven Template

You can create a quick start Java web application project by using the Maven maven-archetype-webapp template. In a terminal (*uix or Mac) or command prompt (Windows), navigate to the folder you want to create the project.

Type this command :


$ mvn archetype:generate -DgroupId={project-packaging} 
	-DartifactId={project-name} 
	-DarchetypeArtifactId=maven-archetype-webapp 
	-DinteractiveMode=false

//for example 
$ mvn archetype:generate -DgroupId=com.mkyong 
	-DartifactId=CounterWebApp 
	-DarchetypeArtifactId=maven-archetype-webapp 
	-DinteractiveMode=false

For example :


$ pwd
/Users/mkyong/Documents/workspace

$ mvn archetype:generate -DgroupId=com.mkyong -DartifactId=CounterWebApp -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] Generating project in Batch mode
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-webapp:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.mkyong
[INFO] Parameter: packageName, Value: com.mkyong
[INFO] Parameter: package, Value: com.mkyong
[INFO] Parameter: artifactId, Value: CounterWebApp
[INFO] Parameter: basedir, Value: /Users/mkyong/Documents/workspace
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: /Users/mkyong/Documents/workspace/CounterWebApp
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.147s
[INFO] Finished at: Thu Dec 20 20:35:19 MYT 2012
[INFO] Final Memory: 12M/128M
[INFO] ------------------------------------------------------------------------

A new web project named “CounterWebApp“, and some of the standard web directory structure is created automatically.

2. Project Directory Layout

Review the generated project layout :


.
|____CounterWebApp
| |____pom.xml
| |____src
| | |____main
| | | |____resources
| | | |____webapp
| | | | |____index.jsp
| | | | |____WEB-INF
| | | | | |____web.xml

Maven generated some folders, a deployment descriptor web.xml, pom.xml and index.jsp.

Note
Please check this official Maven standard directory layout guide to understand more.
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>com.mkyong</groupId>
  <artifactId>CounterWebApp</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>CounterWebApp 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>CounterWebApp</finalName>
  </build>
</project>
web.xml – Servlet 2.3 is too old, consider upgrade to 2.5

<!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>
index.jsp – A simple hello world html file

<html>
<body>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2836379775501347"
     data-ad-slot="8821506761"
     data-ad-format="auto"
     data-ad-region="mkyongregion"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><h2>Hello World!</h2>
</body>
</html>

3. Eclipse IDE Support

To import this project into Eclipse, you need to generate some Eclipse project configuration files :

3.1 In terminal, navigate to “CounterWebApp” folder, type this command :


mvn eclipse:eclipse -Dwtpversion=2.0
Note
This option -Dwtpversion=2.0 tells Maven to convert the project into an Eclipse web project (WAR), not the default Java project (JAR). For convenience, later we will show you how to configure this WTP option in pom.xml.

3.2 Imports it into Eclipse IDE – File -> Import… -> General -> Existing Projects into workspace.

project structure

Figure : In Eclipse, if you see a globe icon on top of the project, means this is a web project.

4. Update POM

In Maven, the web project settings are configure via this single pom.xml file.

  1. Add project dependencies – Spring, logback and junit
  2. Add plugins to configure this project

Read comments for self-explanatory.

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>com.mkyong</groupId>
	<artifactId>CounterWebApp</artifactId>
	<packaging>war</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>CounterWebApp Maven Webapp</name>
	<url>http://maven.apache.org</url>
	<properties>
		<jdk.version>1.7</jdk.version>
		<spring.version>4.1.1.RELEASE</spring.version>
		<jstl.version>1.2</jstl.version>
		<junit.version>4.11</junit.version>
		<logback.version>1.0.13</logback.version>
		<jcl-over-slf4j.version>1.7.5</jcl-over-slf4j.version>
	</properties>

	<dependencies>

		<!-- Unit Test -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>${junit.version}</version>
		</dependency>

		<!-- Spring Core -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>${jcl-over-slf4j.version}</version>
		</dependency>

		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<version>${logback.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<!-- jstl -->
		<dependency>
			<groupId>jstl</groupId>
			<artifactId>jstl</artifactId>
			<version>${jstl.version}</version>
		</dependency>

	</dependencies>

	<build>
		<finalName>CounterWebApp</finalName>

		<plugins>
		    <!-- Eclipse project -->
		  <plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-eclipse-plugin</artifactId>
			<version>2.9</version>
			<configuration>
			        <!-- Always download and attach dependencies source code -->
				<downloadSources>true</downloadSources>
				<downloadJavadocs>false</downloadJavadocs>
				<!-- Avoid type mvn eclipse:eclipse -Dwtpversion=2.0 -->
				<wtpversion>2.0</wtpversion>
			</configuration>
		  </plugin>
			
		  <!-- Set JDK Compiler Level -->
		  <plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>2.3.2</version>
			<configuration>
				<source>${jdk.version}</source>
				<target>${jdk.version}</target>
			</configuration>
		  </plugin>

		  <!-- For Maven Tomcat Plugin -->
		  <plugin>
			<groupId>org.apache.tomcat.maven</groupId>
			<artifactId>tomcat7-maven-plugin</artifactId>
			<version>2.2</version>
			<configuration>
				<path>/CounterWebApp</path>
			</configuration>
		  </plugin>

		</plugins>

	</build>
</project>
Note
For convenience, declares maven-eclipse-plugin and configure wtpversion to avoid typing the parameter -Dwtpversion=2.0. Now, each time you use mvn eclipse:eclipse, Maven will convert this project into Eclipse web project.


#Before 
mvn eclipse:eclipse --> Eclipse Java project (JAR)
mvn eclipse:eclipse -Dwtpversion=2.0 --> Eclipse Java web project (WAR)

#Now
mvn eclipse:eclipse --> Eclipse Java web project (WAR)

5. Update Source Code

In this step, we will create a few files and folders for Spring MVC and logback logging framework, the final project structure will look like this :


.
|____pom.xml
|____src
| |____main
| | |____java
| | | |____com
| | | | |____mkyong
| | | | | |____controller
| | | | | | |____BaseController.java
| | |____resources
| | | |____logback.xml
| | |____webapp
| | | |____WEB-INF
| | | | |____mvc-dispatcher-servlet.xml
| | | | |____pages
| | | | | |____index.jsp
| | | | |____web.xml
maven-web-project-directory
Note
Create the folder manually if it doesn’t exist.

5.1 Create a Spring MVC controller class.

/src/main/java/com/mkyong/controller/BaseController.java

package com.mkyong.controller;

import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class BaseController {

	private static int counter = 0;
	private static final String VIEW_INDEX = "index";
	private final static org.slf4j.Logger logger = LoggerFactory.getLogger(BaseController.class);

	@RequestMapping(value = "/", method = RequestMethod.GET)
	public String welcome(ModelMap model) {

		model.addAttribute("message", "Welcome");
		model.addAttribute("counter", ++counter);
		logger.debug("[welcome] counter : {}", counter);

		// Spring uses InternalResourceViewResolver and return back index.jsp
		return VIEW_INDEX;

	}

	@RequestMapping(value = "/{name}", method = RequestMethod.GET)
	public String welcomeName(@PathVariable String name, ModelMap model) {

		model.addAttribute("message", "Welcome " + name);
		model.addAttribute("counter", ++counter);
		logger.debug("[welcomeName] counter : {}", counter);
		return VIEW_INDEX;

	}

}

5.2 Create a Spring configuration file.

/src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context.xsd">

	<context:component-scan base-package="com.mkyong.controller" />

	<bean
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix">
			<value>/WEB-INF/pages/</value>
		</property>
		<property name="suffix">
			<value>.jsp</value>
		</property>
	</bean>

</beans>

5.3 Update existing web.xml to support Servlet 2.5 (the default Servlet 2.3 is too old), and also integrates Spring framework via Spring’s listener ContextLoaderListener.

/src/main/webapp/WEB-INF/web.xml

<web-app xmlns="http://java.sun.com/xml/ns/javaee" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
	      http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	version="2.5">

	<display-name>Counter Web Application</display-name>

	<servlet>
		<servlet-name>mvc-dispatcher</servlet-name>
		<servlet-class>
                        org.springframework.web.servlet.DispatcherServlet
                </servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>mvc-dispatcher</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>

	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
	</context-param>

	<listener>
		<listener-class>
                   org.springframework.web.context.ContextLoaderListener
                </listener-class>
	</listener>
</web-app>

5.4 Moves index.jsp to folder WEB-INF/pages, in order to protect direct access. And updates the content :

/src/main/webapp/WEB-INF/pages/index.jsp

<html>
<body>
<h1>Maven + Spring MVC Web Project Example</h1>
 
<h2>Message : ${message}</h2>
<h2>Counter : ${counter}</h2>	
</body>
</html>

5.5 Create a logback.xml file and puts in resources folder.

/src/main/resources/logback.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    
	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
	    <layout class="ch.qos.logback.classic.PatternLayout">

		<Pattern>
			%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
		</Pattern>

	    </layout>
	</appender>

	<logger name="com.mkyong.controller" level="debug"
		additivity="false">
		<appender-ref ref="STDOUT" />
	</logger>

	<root level="error">
		<appender-ref ref="STDOUT" />
	</root>

</configuration>

6. Eclipse + Tomcat

Here are few ways to deploy and test the web project.

6.1 To compile, test and package the project into a WAR file, type this :


mvn package

A new WAR file will be generated at project/target/CounterWebApp.war, just copy and deploy to your Tomcat.

6.2 If you want to debug this project via Eclipse server plugin (Tomcat or other containers), type this again :


mvn eclipse:eclipse

If everything is fine, the project dependencies will be attached to the project web deployment assembly.

eclipse-web-deployment-assembly

Figure : Right clicks on the project -> Properties -> Deployment Assembly

6.3 Since the Maven Tomcat plugin is declared :

pom.xml

	<!-- For Maven Tomcat Plugin -->
	<plugin>
		<groupId>org.apache.tomcat.maven</groupId>
		<artifactId>tomcat7-maven-plugin</artifactId>
		<version>2.2</version>
		<configuration>
			<path>/CounterWebApp</path>
		</configuration>
	</plugin>

Type this command :


mvn tomcat:run

It will start Tomcat and deploy your project default to port 8080.

7. Demo

Deploy the WAR file on Tomcat :

7.1 http://localhost:8080/CounterWebApp/

maven-web-project-demo1

7.2 http://localhost:8080/CounterWebApp/mkyong

maven-web-project-demo2

7.3 http://localhost:8080/CounterWebApp/android

maven-web-project-demo3

Download Source Code

Download it – Maven-WebProject-CounterWebApp.zip (9 KB)

References

  1. Maven – Introduction to the Standard Directory Layout
  2. Apache Tomcat Maven Plugin
  3. How To Create A Java Project With Maven
  4. Spring 3 REST Hello World Example
  5. A Simple Web Application

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
Rafael Paredes
Guest
Rafael Paredes

Hi,

I had a run compilation error due the “mvn tomcat:run” started Tomcat 6 but the classes are in Java 7.
A quick fix: use tomcat7:run
It could happen because I have installed tomcat6 and 7.

Kai
Guest
Kai

FYI this the error if you need to use “mvn tomcat7:run” instead of “mvn tomcat:run”:

org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 1 in the generated java file
The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)

Thank you Rafael!

Peter
Guest
Peter

Wonderful! my first runnable spring mvc

Ali
Guest
Ali

really awesome, please do add some extra things for the next time

Luke Buthman
Guest
Luke Buthman

Worked perfectly in 2017. Thank you sir!

purushotham
Guest
purushotham

Firstly I would like to thank you for sharing the knowledge. I have a doubt here after updating the pom.xml with the required dependencies and plugin i ran the command “mvn eclipse:eclipse” ideally it should create all the folders and the required xmls(logback,mvc dispacther etc) in the folders path. But it is not happening for me. Kindly provide your help here.

RAMESH RUDRA
Guest
RAMESH RUDRA

Hi,
I am seeing this error once i imported this project in to my eclipse in mvc-dispatcherservlet(even after doing updatemavenproject.

The errors below were detected when validating the file “spring-beans.xsd” via the file “mvc-dispatcher-servlet.xml”. In most cases these errors can be detected by validating “spring-beans.xsd” directly. However it is possible that errors will only occur when spring-beans.xsd is validated in the context of mvc-dispatcher-servlet.xml.

TBansal
Guest
TBansal

Thank You so much…this is the best beginner tutorial I have come across till now to create a simple web application. Thanks again to help me get started.

Alex
Guest
Alex

Please, don’t confuse “Web application projects” with “Web apps” that can be created with services as http://www.socialcreator.com ;-)

jayster
Guest
jayster

Hi,

I get Could not create JSR-77 WebModule: MySpringMVCTutorial.war: javax.management.InstanceAlreadyExistsException: jboss.management.local:j2eeType=WebModule,J2EEServer=Local,J2EEApplication=null,name=MySpringMVCTutorial.war already registered. and a 404 page whenever I try to run my app

jjmkay
Guest
jjmkay

Imported project into Spring Tools Suite and index.jsp has the following error notification.

Multiple annotations found at this line:
– The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build
Path
– The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build
Path

I see that the javax jars are under referenced libraries – jstl-1.2.jar.

why does index not see these dependencies?

MSM
Guest
MSM

I too have the same error. How to solve this? Please help me I am new to Maven

Stanly Thomas
Guest
Stanly Thomas

i have a doubt..hot deployment will happen when we run using maven right?

Terry Weymouth
Guest
Terry Weymouth

Just downloaded your code and got an error about missing ddl in the config file for logback.
See this for suggestions: http://stackoverflow.com/questions/5731162/xml-schema-or-dtd-for-logback-xml

BTW: Thanks for the concise and illustrative example.

Uma Makeswari Elangovan
Guest
Uma Makeswari Elangovan

how to develop a maven web project without using spring sir.

Khader
Guest
Khader

ITs really helpful blog.

Sahin
Guest
Sahin

Hi Mkyong , thanks for the tutorial but it has that missing dependency in pom.xml

org.apache.tomcat

tomcat-servlet-api

7.0.30

provided

or it can run on eclipse by adding tomcat 7 runtime.

GOWRI SANKAR
Guest
GOWRI SANKAR

Thanks a lot. Mkyong rocks!

John Michael Asejo
Guest
John Michael Asejo

counter is not working help

mkyong
Guest
mkyong

Thanks for your advice.

Aba
Guest
Aba

Pls do not type command directly to your command prompt if you want a maven webapp

you will need to specified the archetype as webapp i had few issue with the example given on top that said type mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

*** Again change the archetype to webapp if you want a web application or will wind up with a jar files

Averousi
Guest
Averousi

We have same problem here, but I still don’t understand your solution. Where should I change the archetype again?

Averousi
Guest
Averousi

I got it! Thank you for short explanation :D

trackback
??? ??????? CXF Servlet « dev-blogs.com

[…] ? CXF http://cxf.apache.org/docs/writing-a-service-with-spring.html — ???? apache CXF http://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven — ???? How To Create A Web Application Project With Maven […]

kNives
Guest
kNives

Decided to finally say ‘thank you’ as well.

This is sooo what I searched for. The most useful starter guide ever.
Thank you very much for this part of work, as well as for all other great articles.

Lisa
Guest
Lisa

Hi,

I’ve followed this tutorial and looked at other related tutorials you’ve posted all of which have been very helpful in getting me started. However I have an error in tomcat. The startup of the server and deploy using maven runs without errors and I have no errors on my tomcat logs but when trying to access my project I receive a 404 status from tomcat. Do you have any suggestions please?

Regards,
Lisa Young

Ryan
Guest
Ryan

Thanks so much for these awesome guides. Your tutorials over spring, jdbc, maven, and now tomcat have helped me a tremendous amount.

thomas
Guest
thomas

I create web with this tutorial but i have problem:
apr 25, 2014 5:59:47 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/grafweb] in DispatcherServlet with name ‘mvc-dispatcher’
Screen: http://share.adamjak.net/obrazky/web_err.png

Where we can make mistakes?? Thanks

mkyong
Guest
mkyong

Review your controller class, Spring can’t find the mapping for your /grafweb. Or you don’t have the valid view resource (jsp page)

Article is updated, please download the attached source code and compare with yours.

Sunil HR
Guest
Sunil HR

i am newer to maven…i am facing a problem while creating new maven
project it throws an below error….

CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from/to central (http://repo.maven.apache.org/maven2): null to http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom

kindly reply as soon as possible……

Regards,

Sunil HR

Sunil HR
Guest
Sunil HR
i am newer to maven…i am facing a problem while creating new maven project it throws an below error….i am using eclipse 4.3(kepler), apache-maven 3.2.1 and i am installed maven integration for eclipse from eclipse market place… CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from/to central… Read more »
Sunil HR
Guest
Sunil HR
hello sir.. this is sunil i am newer to maven…i am facing a problem while creating new maven project it throws an below error….i am using eclipse 4.3(kepler), apache-maven 3.2.1 and i am installed maven integration for eclipse from eclipse market place… Errors occurred during the build. Errors running builder ‘Maven Project Builder’ on project ‘Helloworld’. Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 Could not calculate… Read more »
Alwin Doss
Guest
Alwin Doss

I am seeing
Message : ${message}
When I run this application. I don’t see the text in place of ${message}.
I followed every step in this tutorial

Rohith Nandakumar
Guest
Rohith Nandakumar

If anyone comes across this issue, just recheck your web.xml file. Remove the line with !DOCTYPE web-app PUBLIC….

Hetal Upadhyay
Guest
Hetal Upadhyay

i have removed this but steel can’t see message

Ajay
Guest
Ajay

Great tutorial !!!

Anshu Kumar
Guest
Anshu Kumar

only add this snippet in your pom.xml

org.apache.tomcat.maven
tomcat7-maven-plugin
2.2

and issue command
mvn tomcat7:run

no need to copy paste

you can also use jetty plugin