If you are going to start working on maven projects, there are two steps to get started with your first Maven Project-
Step 1: Install Maven in your system. you can get suitable version for your system from download maven here.
Extract downloaded archive to desired location in your system preferably under "C:\Program Files"
Once it is extracted or if it is already there in your system, please make sure you have set environment variable for M2_HOME.
Add environment variable M2_HOME
Update the PATH variable to include Maven bin as shown below-
Step 2: Now go to directory where you wish to create your maven project and run command –
mvnarchetype:generate -DarchetypeRepository=http://repo.adobe.com/nexus/content/groups/public/
-DarchetypeGroupId=com.day.jcr.vault
-DarchetypeArtifactId=multimodule-content-package-archetype
-DarchetypeVersion=1.0.2 -DgroupId=com.example
-DartifactId=sampleproject
-Dversion=1.0-SNAPSHOT
-Dpackage=com.example
-DappsFolderName=apps
-DartifactName="Sample Maven Project"
-DcqVersion="5.6.1"
-DpackageGroup="sampleproject"
In this command
ArtifactId is going to be the name of your project.
Version specifies your build versions.
artifactName is the name will be displayed when you build it.
Package is the default package going to be created in your bundle where you can put all your java code
It’s going to take a while it downloads all the dependencies and put it in your system. And finally there it is your first maven project created "sampleproject".
You can see all the downloaded dependencies in .m2 folder created in C drive or running .m2 in run command box.
You can import that maven project in your IDE and start working on it.
This post is written by
Saurabh Thareja - Linkedin, Facebook, Google Plus
He is a freelance writer, loves to explore latest features in Java technology.
No comments:
Post a Comment