Showing posts with label maven. Show all posts
Showing posts with label maven. 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 NameM2_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 !!

Thursday, April 26, 2018

Maven repository

What are maven plugins?

  • Maven plugin is an execution framework to execute specific set of goals like
Maven core plugins:
  1. clean : Clean up after the build.
  2. install : Install the built artifact into the local repository.
  3. deploy : Deploy the built artifact to the remote repository.
  4. compiler : Compiles Java sources.
  5. resources : Copy the resources to the output directory for including in the JAR.
  6. surefire : Run the JUnit unit tests in an isolated classloader.
Maven tools:
  1. jar - create jar file
  2. war- create war file
  3. ejb - create ejb from current project
  4. ear - create ear from current project 
  5. rar - create rar from current project
  6. archetype - generate a skeleton project structure from an archetype.
  7. dependency - dependency manipulation (copy, unpack) and analysis.
  • There are two type of maven plugins.
  1. Build plugins will be executed during the build and they should be configured in the <build/> element from the POM.
  2. Reporting plugins will be executed during the site generation and they should be configured in the <reporting/> element from the POM.

What is maven ?

  • Maven is a build automation tool used primarily for Java-based project. 
  • It can also be used to build and manage projects written in C#, Ruby, Scala, and other languages.
  • Maven addresses two aspects of building software: first, it describes how software is built, and second, it describes its dependencies.
  • An pom.xml file describes the software project being built.

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...