Sunday, 7 August 2022

Maven configuration

Setup latest Maven with the latest Eclipse (eclipse already comes with Maven plugin) to use CLI:

1. Download and unzip the latest version of Apache Maven: e:\maven

2. Download the unzip the latest version of Eclipse IDE : e:\eclipse  

3. Set up the System Properties >> Advance >> environment variables >> System Variables:

MAVEN_HOME  =  e:\maven ; 

M2          =  e:\maven ;

JAVA_HOME = C:\Program Files\Java\jdk-17 ;

        JRE_HOME   = C:\Program Files (x86)\Java\jre-1.8; 

PATH= C:\Program Files\Java\jdk-17\bin ; e:\maven\bin ;  C:\Program Files (x86)\Java\jre-1.8\bin

4. Launch Eclipse --> go to "Window" > "Preferences"  >>  "Maven" > "Installations" >>  Add...>> browse to the Maven installation directory (e:\maven)  >>  "Apply and Close".

5.  Eclipse → Window → Preferences → Java → Installed JREs.  Add ..  C:\Program Files\Java\jdk-17 ( make this JAVA_HOME checked )

6. Check Maven is working using the below commands

C:\Users\ravin>mvn --version                       check the version

C:\Users\ravin>echo %MAVEN_HOME%            to check if it is working or not




Running Maven from CLI :
go to pom.xml and src folder and shift right click and Open the command window here 
mvn clean install 
mvn clean 
mvn compile
mvn test-compile
mvn test
mvn install 

* Below command updates all the dependencies to latest available versions:
mvn clean versions:use-latest-versions scm:checkin deploy -Dmessage="update versions" -DperformRelease=true

* Maven downloaded dependencies are stored on the location:  c:\user\ravi\.m2\ 

* https://www.journaldev.com/33645/maven-commands-options-cheat-sheet

* https://www.softwaretestingmaterial.com/execute-maven-project-using-jenkins/

No comments:

Post a Comment