Sunday, March 6, 2016


MAVEN TUTORIAL


Build Life Cycle

A build life cycle is a well defined sequence of phases which defined in which order goals needs to be executed phases represent stages in build life cycles a typical maven project consist of below phases:

  • prepare-resources
  • compile
  • package
  • install
Below are the concepts related to maven build life cycles:

  • When a phase is called only phases upto and including that phase will be executed
  • Different maven goals are bounded to different phases of maven lifecycle depending upon the type of the packaging (ear/jar/war)

BUILD PROFILE

A build profile is a set of configuration values which can be used to set or override default values of maven build profiles modify the pom.xml duing the build phase and are used to give parameters and target environments.

  • Per Project defined in project pom.xml
  • Per User defined in maven settings xml (%USER_HOME%/.m2/settings.xml)
  • Global Defined in Maven global settings xml file (%M2_HOME%/conf/settings.xml)

MAVEN REPOSITORY

A maven repository is a place i.e. directory where all the projects jars,library jars,plugins or any maven other project specific artifacts are stored and can be used by Maven easily.

Maven repository are of three types:

  • Local
  • Central
  • remote

Maven Dependency Search Sequence

  1. Search the dependency in local repository if not found go to step 2 else then do further procession
  2. Search dependency in central repository if not found and remote repository is mentioned will go to step 4 and if found will download it in local repository
  3. if remote repository is not defined maven simply stop searching and will throw error
  4. search for dependency in remote repository or repositories if found its downloaded to local repository otherwise send error saying the dependency not found.

CREATE JAVA PROJECT



No comments:

Post a Comment