Maven - works


chapter


In Maven POM file (item Object Model) as a center, POM files are xml format, automatically build a profile, located at the root item.

If you are familiar with make Makefile, it can be seen, maven equivalent make, pom.xml equivalent makefile

Below is a schematic diagram Maven POM file read process of building the

image

The following briefly explain some of the concepts in the figure above, the follow-up will have a more detailed introduction.

POM file

Maven command is executed, Maven POM file to execute commands based on the configuration.

Dependencies and repositories

pom file contains configuration dependencies, dependencies are external JAR files used by the project (Java library). If the local library to find no dependencies, Maven to download dependencies from a central repository, and stored in a local library. Only a local store directory on the machine, the directory location may be configured. Another addition to the central library, you can also configure other remote libraries, such as internal company can set up a remote repository for all developers. Follow-up will be described in detail.

Building life cycle stages and objectives

Construction project generally comprise a plurality of independent tasks, may be performed independently, such as generated document, etc. jar package build. During the execution of a single task is called the life cycle of a building, build lifecycle to build a series of stages, each stage contains a series of build targets.

We can perform construction or build targets. Stage executed in order to perform a first phase will be the implementation of all stages prior to the stage. When performing the build phase, will be constructed in order to perform all targets contained therein. Construction of the target can be assigned to one or more of the build phase. We can also directly execute the build target.

Plug

Plug-ins are a collection of build targets, also called MOJO (Maven Old Java Object). It can be understood as a plugin class, the class of a target constructed. Construction phase consists of a series of build targets, it can be understood as calling each plug-in build targets (method) in order, then a series of stages to build a build lifecycle.

Maven is actually a plugin framework for implementation. If necessary, you can customize the plug-in java.

Build profile

If you need to build different versions of the project, can be used to build profile. For example, projects need to build development version, beta version and the official version, these versions can be built by adding different constructs profile pom file. Specify a different profile can build execution maven.

Guess you like

Origin blog.csdn.net/weixin_43031412/article/details/91891062