Recent Pos

Maven Examples

Example#1:

Note: MAVEN requires a good Internet connection to download .jar and dependencies from internet automatically.

MavenAppMain.java

 
HelloMaven.java

 
pom.xml

 
⇒ Steps to execute MavenAppMain.java
1. Open command prompt and then go to the project directory and execute the below command:
For example: D:mavenExample1

Download this example: Example1.zip

Example#2:

Project structure:
maven build tool project example tutorial
Note: Create a simple Struts project with the files as mentioned on the above. Develop Junit test cases.
 
pom.xml

Download this example: Example2.zip
 

Deploying .war file into Tomcat:

Step 1: Tomcat Authentication:

⇒ First add an user with administrator access right for Tomcat. To add Tomcat user, edit this file – “%TOMCAT_PATH%/conf/tomcat-users.xml”.

tomcat-users.xml

 
Step 2: Maven Authentication:

⇒ In Maven side, you need to add the same user authentication information in “%MAVEN_HOME%/conf/setting.xml”.

settings.xml

 
Step 3: Maven-Tomcat-Plugin:

⇒ Declare “Maven-Tomcat plugin” and related Tomcat server details in your pom.xml file:
 
pom.xml

 
Complete pom.xml

Download this example: Example3.zip
 

Example Maven Hibernate Project:

Note: First create a simple Hibernate web application. Develop Junit test cases.
 
pom.xml

Download this example: Example4.zip
 
 

<-Previous: Maven Architecture Objectives And Commands

0
0