MAVEN is a successful open source project in the Apache organization that serves project building based on the Java platform, and relies on management and project information management.
During the Itoo project development process, we all realized the package deployment process. Using MAVEN helps us automate the build process , from cleaning, compiling, testing to generating reports, to packaged deployments, and we don't have to enter commands over and over again, and then place the mouse over and over again, With Maven, everything is going to be done, and that's the automatic build. And, Maven is cross-platform, the same command on Windows and Linux or on Mac, which provides a consistent interface for operations, which is an important reason for its popularity.
In addition to being a build tool, Maven is a dependency management tool . Specifically, it provides a central repository where we can get the artifacts we want, and these artifacts are automatically downloaded by maven. In our project, we want to borrow some third party open source class libraries, These libraries are introduced into the project through dependency, but too much reliance can create a series of problems, such as inconsistent versions, version conflicts, and dependencies. At this point, MAVEN provides a particularly good solution, which is to accurately locate a component through a coordinate system, In other words, using a set of coordinates to find a unique Java class library, with the help of the coordinate management component to keep our dependencies in order.
Maven or project information management tools , management including project description, developer list and other information, to help us obtain test reports, log reports and other project information. MAVEN has established rules for both the project directory structure and the test case naming method, and following these rules, users do not need additional learning costs when switching between projects, which can be said to be better than configuration.
The specific installation and use of MAVEN is not repeated here, and with more project developers, there will be an environment build manual and a quick Start instruction document, and the installation and use of MAVEN is an essential part of it. Skilled deployment of MAVEN is our basic skill.
The core of the MAVEN project is Pom.xml.POM (Project object model), which defines the basic information of the project, describes how the project is built, declares project dependencies, and so on. Like the Itoo pom.xml file, the following code example:
<dependencies>
<dependency>
<groupId>com.tgb</groupId>
<artifactId> itoo-base</artifactid>
<version>${itoo-base.version}</version>
</dependency>
<dependency>
<span style= "White-space:pre" > </span><groupid>com.tgb</ groupid>
<artifactId>itoo-tool</artifactId>
<version>${itoo-tool.version}</ version>
</dependency>
</dependencies>
This code defines the basic coordinates of an item, GroupID defines which group the project belongs to, and this group is often associated with the organization or company where the project is located. Artifactid defines the current MAVEN project as the only id,version in the group is the current version of the project.
This is the POM code, we have not written a line of actual Java code to define a MAVEN project Pom, which shows that the Pom and Java code is decoupled, which avoids the interaction between Java code and POM Code as much as possible.
The above is only from the macro introduction of Maven, in the project development process for MAVEN use skills need to be carefully understood, I will be my own experience to organize and share with you.