Saturday, July 22, 2017

How to install maven and create a new blank maven project

Step 1 - Go to maven site and download maven binary zip archive as shown below

Step 2 - Once you download the file extract it to a particular location and set below Windows environment variables
M2_HOME - C:\TestMaven\apache-maven-3.5.0
MAVEN_HOME - C:\TestMaven\apache-maven-3.5.0

PATH - C:\TestMaven\apache-maven-3.5.0\bin

Make sure that JDK is installed and "JAVA_HOME" variable is added in your Windows environment variable

Now test maven using below command

mvn -version


Note - You can change the default maven localRepository as per your requirement, just go to apache-maven-3.5.0/conf/settings.xml and change the path


Step 3 - Now you can create a new maven project using below command

mvn archetype:generate -DgroupId=com.javaxp -DartifactId=TestMaven -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

 Once the project is create you can import it to your desire IDE

Maven project created -

Note - You may need to set maven in your eclipse, go to Eclipse -> Windows -> Preferences -> Maven -> User Settings and set maven conf/setting.xml file as shown below

No comments:

Post a Comment