POM: Project Object Model
Maven has three life cycle:
Clean Life cycle has following phases:
Syntax for life-cycle and phase:
mvn <life-cycle> : <phase>
ex: mvn clean:clean
Syntax for activating profile:
mvn <life-cycle>/<phase> -P<profile>
ex: mvn clean -P phix
When a phase is called via Maven command, for example mvn compile, only phases upto and including that phase will execute.
In Maven terminology, a repository is a place i.e. directory where all the project jars, library jar, plugins or any other project specific artifacts are stored and can be used by Maven easily.
Maven repository are of three types
A plugin generally provides a set of goals and which can be executed using following syntax:
mvn <plugin-name>:<goal-name>
Maven provided two types of plugin:
Dependency Management:
The dependency management section is a mechanism for centralizing dependency information. When you have a set of projects that inherits a common parent it's possible to put all information about the dependency in the common POM and have simpler references to the artifacts in the child POMs.
For parent:
For child: If below code is not copied in child then no dependency will be included in child project from parent. Need to define all required dependency in child project.
Maven has three life cycle:
- Clean
- default (build)
- Site
Clean Life cycle has following phases:
- Pre-Clean
- Clean
- Post-Clean
- prepare-resources
- compile
- package
- Install
- pre-site
- site
- post-site
- site-deploy
Syntax for life-cycle and phase:
mvn <life-cycle> : <phase>
ex: mvn clean:clean
Syntax for activating profile:
mvn <life-cycle>/<phase> -P<profile>
ex: mvn clean -P phix
When a phase is called via Maven command, for example mvn compile, only phases upto and including that phase will execute.
In Maven terminology, a repository is a place i.e. directory where all the project jars, library jar, plugins or any other project specific artifacts are stored and can be used by Maven easily.
Maven repository are of three types
- local
- central (by default: http://repo1.maven.org/maven2/) can be browsed: http://search.maven.org/#browse
- remote (if not available in local and central repository, then if configured searched)
A plugin generally provides a set of goals and which can be executed using following syntax:
mvn <plugin-name>:<goal-name>
Maven provided two types of plugin:
- Build plugins (They execute during the build and should be configured in the <build/> element of pom.xml)
- Reporting plugins (They execute during the site generation and they should be configured in the <reporting/> element of the pom.xml)
Dependency Management:
The dependency management section is a mechanism for centralizing dependency information. When you have a set of projects that inherits a common parent it's possible to put all information about the dependency in the common POM and have simpler references to the artifacts in the child POMs.
For parent:
<dependencyManagement> <dependencies> <dependency> <groupId>test</groupId> <artifactId>a</artifactId> <version>1.2</version> </dependency>
</dependencies>
</dependencyManagement>
For child: If below code is not copied in child then no dependency will be included in child project from parent. Need to define all required dependency in child project.
<dependencies> <dependency> <groupId>group-a</groupId> <artifactId>artifact-a</artifactId> </dependency>
</dependencies>
No comments:
Post a Comment