Steps to install MAVEN:-
- Download the binary file form apache's site
- Unzip the zip file and add to the environment variable.
- To confirm installation use mvn -version on command prompt.
- project
- src
- main
- java (the source code)
- resources
- test
- java (the unit test code )
- resources ()
- pom.xml (the configuration file containing the information to build the project)
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>PROJECT_NAME_IN_PACKAGE_NAME_STYLE</groupId>
<artifactId>NAME_OF_JAR</artifactId>
<version>VERSION_OF_JAR</version>
</project>
MVN Install:-
- It is used to install the package to local repository so that it can be referenced by several projects
- It is used to build the project
To create a java project in java
mvn archetype:generate
-DgroupId=com.anshul.ws
-DartifactId=MyWebService
-DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=false
To support eclipse
mvn eclipse:eclipse -Dwtpversion=2.0
Like we have targets in case of Ant , we have phases in maven
Features of MAVEN:-
- Build process becomes very easy
To create a web-app using maven
- Using command prompt go to the directory where project needs to be created
- Type below
mvn archetype:generate -DgroupId=org.arsoft.projects.sood -DartifactId=arsood -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false - To be able to access the project on eclipse go to the directory and run command
mvn eclipse:eclipse -Dwtpversion=2.0
To create a Java project:
mvn archetype:generate -DgroupId=org.arsoft.projects.sood -DartifactId=arsood -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
To create an EJB project:
mvn archetype:generate -DgroupId=com.arsoft.projects -DartifactId=Common -DarchetypeArtifactId=ejb-javaee6 -DinteractiveMode=false
Understanding POM
- It stands for Project Object Model and is the fundamental unit of work in maven.
No comments:
Post a Comment