1. Maven is essentially a project management tool, which abstracts the process of project development and management into a project object model (POM). 2. Maven is a build tool contributed by Apache open source organization.
1. Maven manages all the dependency packages in a unified and centralized way, so programmers don't need to look for them. 2. For common jars used by third-party components, Maven automatically solves the problems of duplication and conflict. 3. As an open architecture, Maven provides a common interface to facilitate integration with third-party plug-ins. Programmers can dynamically integrate their plug-ins into Maven to extend new management functions. 4. Maven can unify the construction process of each project and realize the compatibility management of different projects
Download, install, and configure the environment
- Download, install and configure Maven environment for MAC system
Introduction to the standard directory structure:
- Introduction of Maven standard directory structure
Maven’s directory structure is different from traditional projects. The following is the directory structure that a jar package usually has.
Src / main / Java: source code directory
Src / main / resources: resource file directory
Src / test / Java: test code directory
Src / test / resources: test resource file directory
This is only part of the structure, such as jar or war project. If the source code is generally this structure, but this structure is not necessary. Different projects and different requirements can have different structures.
The following is the expected directory structure given by maven, and the Maven project is created according to this structure by using templates, so we try to comply with this specification.
Let’s look at the directory structure of a jar project
Among them, Maven dependencies are all dependent jar packages. Target directory is the temporary directory file generated by packaging, including class files, test related files, and generated jar packages. POM file is the core configuration file of Maven project
pom.xml Is Maven's configuration file, usually in the root directory.
Maven project structure:
Introduction of official documents Maven project structure
Get help: mvn -h
mvn -P:Activate profile in profiles, use, split list.
Execute the MVN command corresponding to the phase: mvn <phase>
. Available lifecycle phases
Execute MVN plugin (goal)
mvn somePrefix:[email protected]
Someprefix indicates the prefix of plugin name, usually the following prefix:
- Goal is the goalname in < goal > goalname < goal >
- Executionid is the idname in < ID > idname < / ID > under < execution >
mvn groupId:artifactId:version:[email protected]
- Version is not required