A.Installing maven
1.Download maven standalone package at https://maven.apache.org/download.cgi
2.unzip on to a prefered location
3.copy the path of the bin say D:\installedSoft\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin
4.create environment variable (USER variable) M2_HOME = D:\installedSoft\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin
5.copy the M2_HOME user variable to the system variable path=%M2_HOME%;
B.Install java JDK
1.create JAVA_HOME and copy to path
C. Check installation and run demo project
1. check the version by executing >> mvn --version in the command line
you should get:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T22:11:4
7+05:30)
Maven home: D:\installedSoft\apache-maven-3.3.9-bin\apache-maven-3.3.9
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_65\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows server 2008", version: "6.0", arch: "amd64", family: "dos"
2.Creating a Project by executing
>> mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
3.Build the Project
First change directory to the place where project is generated usually
>> CD C:\Users\Administrator\my-app
>> mvn package
Now that the maven has compiled and created the exucutable jar in the new target folder.
4.Run the application
>> java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
OUTPUT:
Hello World!
No comments:
Post a Comment