How MAVEN plug-ins run
Maven runs a command with each life cycle, and each life cycle executes to see which plug-ins are configured in the Pom.xml file and then run it.
Maven's lifecycle is tied to plug-ins to accomplish actual build tasks. More specifically, the phase of the lifecycle is tied to the goals of the plug-in to accomplish a specific build task. The specific functionality is implemented by the plug-in (Plugin). A plug-in can achieve multiple targets (Goal)
To understand the functional and engineering phases of the decoupling plug-in, and to achieve a high degree of flexibility, maven dictates that the plug-in is simply a function of achieving the goal, which is configured to determine at what stage (execution) which target operations are performed. You can even bind a goal to multiple phase for reuse.
MAVEN has some default plugins built in, and some goal are bound by default in each phase based on the different project packing types. The following table lists the goal of the default bindings for each stage of the default life cycle, where goal is used by management plugin
Some basic settings for the MAVEN plugin packaging
Pom.xml in <packaging> is the package of the project, MAVEN preset several packaging methods are:Jar/war/ejb/ejb3/rar;
Packaging will be a binding with lifecycle, MVN will call different plug-ins according to the type of packaging to complete the packaging work, such as the jar package will call the Maven-jar-plugin Jar task to package, the war will invoke the war: War to finish packing
Several default lifecycle bindings (Ejb/jar/rar/war):
Concept |
Description |
LifeCycle |
Life cycle, Maven built-in Default,sie,clean three lifecycles |
Phase |
Stages, each life cycle has different stages |
Plugin |
Plug-ins for real-world build capabilities |
Goal |
A plug-in can implement multiple goal,goal with specific functions |
Execution |
By configuration, decide which goal to perform in a phase |
Project |
MAVEN Management goals: Software engineering, small projects can be aggregated into large projects |
PackageType |
In order to facilitate the management of the project, according to the construction target area into different project types, such as Jar,war,ear |
Dependency |
dependencies, there is a dependency between project |
Dependencyscope |
MAVEN defines different scopes for dependencies |
Management |
You can configure how a project manages dependencies |
Repository |
Warehouse, storage package, divided into local library and remote library |
Build |
The action of the build. Using MAVEN to manage your project, it is primarily to specify that project be built into a phase |
Life cycle |
Life cycle Phase |
Plug-in target |
Perform tasks |
Clean |
Pre-clean |
|
|
|
Clean |
Maven-clean-plugin:clean |
Deletes the output directory of the project. |
|
Post-clean |
|
|
Site |
Pre-site |
|
|
|
Site |
Maven-site-plugin:site |
|
|
Post-site |
|
|
|
Site-deploy |
Maven-site-plugin:deploy |
|
Default |
Process-resources |
Maven-resources-plugin:resources |
Copy the master resource file to the main output directory |
|
Compile |
Maven-compiler-plugin:compile |
Compiling the main code to the main output directory |
|
Process-test-resources |
Maven-resources-plugin:testresources |
Copy test resource file to test output |
|
Test-compile |
Maven-compiler-plugin:testcompile |
Compiling test code to test output directory |
|
Test |
Maven-surefire-plugin:test |
Executing test Cases |
|
Package |
Maven-jar-plugin:jar (ejb:ejb jar:jar rar:rar war:war) |
Create a project jar package |
|
Install |
Maven-install-plugin:install |
To install the project output artifacts to the local warehouse |
|
Deploy |
Maven-deploy-plugin:deploy |
Deploy project output artifacts to remote warehouses |
|
|
|
|
MAVEN details-Plug-in MAVEN plugin mechanism