1. What is Maven
①maven is a tool software that enables automated building.
② Build: From the source program → The execution of the program
clean → compile → test → report → package → deploy → execute
③ Build tool: Make→ant→maven→gradle ...
④maven operation Mechanism is the main program call plug-in implementation of specific functions, the required plug-in requires a networked download to use
The default warehouse directory can be modified by modifying the value of the localrepository tag in the Extract directory/conf/settings.xml file
2.Maven Automation build mechanism
1 Item object Model Project
The project is understood as an object model for management, and all information related to project construction is saved in the Pom.xml configuration file
2 agreed-upon directory structure
MAVEN's ability to automate compilation, testing, and more is a contract-based directory structure
3 coordinates
① is used to uniquely locate a "build" in the world of Maven
the composition of ② coordinates
<groupId>com.atguigu.maven</groupId>
<artifactId>Hello</artifactId>
<version>0.0.1-SNAPSHOT</version>
<package>jar</package>
4 Dependency Management
①maven build finds the jar package it relies on to find it in the local repository first, if none in the warehouse.
The build you rely on must be installed in a warehouse to be used by other builds
The concept of ② dependency: the other constructs needed for the current build
implementation of ③ dependency: the build to which the coordinate reference built by the target is dependent
range of ④ dependencies:
dependent target builds are effective for which classes in the current project
Compile: Indicates that all classes in the current project need to use this jar package
Test : Indicates that only the tested classes in the current project are dependent on this jar package
provider: Indicates that the current project relies on this jar package only during the development phase, and this jar package is provided by the container after deployment
Example: Servlet-api
the principle of ⑤ dependence
[1] Shortest Path preferred
[2] The path is preceded by a declaration of precedence
5 Warehouse Management
① How to find a build in a warehouse
groupid+artifactid+version
Com\atguigu\maven\hello\0.0.1-snapshot
② Warehouse Concept: The location of all MAVEN build storage
③ stored content: Maven build
[1]maven's Own plugin
[2] program modules that were built using MAVEN during the software development process
[3] Large number of third-party supplied jar packages
④ Warehouse Classification
[1] Local warehouse
(1) run on user native
(2) Provide dependency support for all MAVEN builds on the current host
[2] Remote Storage
(1) servers: A server built in a local area network to build services for MAVEN in the current local area network
sharing third-party jar packages
share common modules in a project
(2) Central Warehouse
Maven's total server for program developers around the world
(3) Mirror warehouse
share the pressure from the central warehouse, mirror servers built on every continent
⑤maven The principle of finding a build from a warehouse: from small to large range
6 life cycle
① Concept: The entire process through which projects run from cleanup and compilation to deployment to the server
② Three sets of independent life cycles
[1] Cleanup: Perform all aspects of project cleanup
[2] Default: Perform the project from compilation to deployment of each link
[3] site: The implementation of the project information site automatic generation of various links
③ features: At any stage in the execution lifecycle, Maven starts from the beginning of the cycle,
until the specified link
7 plugins and targets
① plugin: All of Maven's features are not executed by the main program, and the specific functionality is done by the plugin.
The main program only plays the role of scheduling.
the ②maven plugin itself is a maven build, so you need to find it in Maven's repository
a subset of the plugins in ③maven are directly related to the lifecycle. Each plugin will have multiple targets,
Each goal corresponds to a phase in the life cycle.
8 Aggregation and inheritance
① Inheritance: Extract the duplicate content from the Pom file into the parent pom, simplifying the configuration file,
Unified management of all dependent versions of the entire project at the same time
② Aggregation: Aggregation of multiple building blocks into one project, installation of aggregation works can be automatically installed
MAVEN Basic notes, principle