Today I want to talk about Maven. It’s very powerful instrument and if you know how to use it you will make minimum effort to achieve maximum result. In general Maven helps you to manage a project including library dependencies, building process and etc…
Here is a simple tutorial which you can go through to create Dynamic Web Project having Maven enabled in Eclipse. This project can be used as base project and can be easily converted to most kind of advanced Java project like Spring MVC based etc. How to create a Web Application Project with Maven?
Tools I’m using:
- Eclipse EE
- Maven
- JSK 1.7
- M2Eclipse Plugin
Assumption:
You have setup
Maven
and Apache Tomcat
Server successfully in your Eclipse Environment.Step-1
Create a simple maven Project in Eclipse.
Step-2
Select default Workspace location
Step-3
Select the maven archetype as:
maven-archetype-webapp
and click on next.Step-4
Fill out below details and click Finish. This step created Maven Project in your Eclipse Environment.
Step-5
If you see error “The superclass “
javax.servlet.http.HttpServlet
” was not found on the Java Build Path index.jsp /CrunchifyMavenTutorial/src/main/webapp” then add Apache Tomcat to your Targeted Runtimes
.Step-6
Your Maven Project should look like this.
Step-7
Now build project with “
Maven Clean Install
” to check there isn’t any dependency issue with project. Step-8
Deploy Application on Apache Tomcat Server.
Steps:
- Right click on Server -> Add and Remove -> Select CrunchifyMavenTutorial -> Click Finish.
- Start tomcat server.
Step-9
Visit
http://localhost:8080/CrunchifyMavenTutorial/index.jsp
to see your result.
And you are all set.
Have anything to add to this article? Please chime in and join the conversion.
Some more articles you might also be interested in …
- Convert Java Project to Dynamic Web Project in Eclipse Environment
- How to Create a .war file from Eclipse using Maven Plugin? Apache ‘maven-war-plugin’ usage
- How to convert existing Java Project to Maven in Eclipse?
- How to Create Build Java Project including all Dependencies Using Maven? ‘maven-resources’, ‘maven-dependency’ & ‘maven-jar’ Plugins
- Create and Deploy Simple Web Service and Web Service Client in Eclipse
- Step by Step Guide to Setup and Install Apache Tomcat Server in Eclipse Development Environment (IDE)
- Eclipse: How to Fix Installation of Apache Tomcat Server Issue – Blank Server Name Field?
- Eclipse: Missing web.xml file? How can I create web.xml in Eclipse?
- How to Setup/Install Maven Classpath Variable on Windows
- How to Resolve Exception HttpServlet cannot be resolved to a type – servlet-api.jar Maven Dependency
No comments:
Post a Comment