Before going to know about how to write maven based web application, we will discuss the advantages of maven based applications over Ant based application,
- Maven’s primary goal is to allow a developer to complete state of a development
- It can be used for building and managing any java based project
- An easy way to publish project information
- A way to share JARs across several projects
- Making the build process easy
- Providing a uniform build system
- Providing quality project information
- Providing guidelines for best practices development
- Allowing transparent migration to new features
- Making the build process easy
In previous post we came to know about how to install maven. Now we will come to know how to create maven based web application step by step,
Step 1:
Creation of maven based web application structure from command prompt by using following commands,
DgroupId=in.devinfo99 - Unique indication for this project
DartifactId=SampleMavenWebApplication - Project name
DarchetypeArtifactId=maven-archtype-webapp - Information to maven for creating web application
Maven structure is created successfully for SampleMavenWebApplicationStructure.
Step 2:
We need to generate some of the configuration files for importing the project into Eclipse
We need to run the following command from root location of SampleMavenWebApplicationStructure
in command prompt through following comand
mvn eclipse:eclipse –Dwtpversion=2.0
Configuration files are generated successfully and we can chechk in corresponding folder as follows,
Step 3:
Now we need to import maven project into eclipse as follows,
Right click on project explorer - > import->import->General->Existing project into Eclipse->click on browse selects the project location - >Finish
We can see the project structure after importing into eclipse as follows,
Step 4:
Now run the application on tomcat server as follows,
Right click on project -> Run As -> Run on server - > select the server -> click on next->click on finish,
No comments:
Post a Comment