Showing posts with label build. Show all posts
Showing posts with label build. Show all posts

Friday, May 4, 2018

How do you change maven local repository in eclipse !

Problem statement: How do you change the path of maven local repository in you IDE like eclipse/sts ?

step-1: go to eclipse ide menu bar
step-2: select Windows --> Preferences
step-3: select Maven --> User Settings
step-4: Browse.... the path of maven folder in your local machine then -> apply - > ok
step-5: enjoy !!

How do you add M2_REPO classpath variable to your eclipse IDE?

M2_REPO is just a normal classpath variable in eclipse/sts to find your local maven repository.

I can add in two ways M2_REPO classpath variable into eclipse/sts ide.
  • Add M2_REPO manually:
step-1: go to eclipse ide menu bar
step-2: select Windows -> Preferences
step-3: select Java -> Build Path --> Classpath Variable
step-4: click on New... button --> define New Variable Entry Name: M2_REPO variable and Path point it to your local maven repository
step-5: enjoy !!
  • Add M2_REPO automatically:
step-1: execute the following command in the cmd

mvn -Declipse.workspace="your Eclipse Workspace" eclipse:configure-workspace

MAVEN_HOME: MAVEN_HOME : D:\Ishaan\tools\apache-maven-3.0.5

MAVEN PATH: PATH VARIABLE: %MAVEN_HOME%\bin

MAVEN VERSION: mvn -version

How do you configure your own path for maven local repository !

Problem statement: How do you configure your own path for maven build tool in your local repository ?

Step-1: download binary zip archive for apache-maven-3.x.x   (https://maven.apache.org/download.cgi)
Step-2: extract in your own path other than C drive
Step-3: open the extracted folder and go to-> maven_home\conf\settings.xml file

  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ~/.m2/repository 
  <localRepository>/path/to/local/repo/</localRepository> - ->

Step-4: <localRepository>change with your own path</localRepository>
e.g.<localRepository>D:/ishaan/tools/.m2/repository</localRepository>
Step: enjoy !!

Blueprint for self-improvement

To learn faster: Make the process fun To understand yourself : Write To understand the world better : Read To build deeper connection : Lis...