11.1. Maven tutorial

发布时间 :2025-10-25 12:23:15 UTC      

image0

Maven, translated as “expert” and “expert”, is an open source project developed by pure Java under Apache. Based on the concept of the Project object Model (abbreviation: POM), Maven uses a central piece of information to manage the construction, reporting, and documentation of a project.

Maven is a project management tool that can build and rely on Java projects.

Maven can also be used to build and manage a variety of projects, such as projects written in Clipper and other languages. Maven, once a sub-project of the Jakarta project, is now an independent Apache project hosted by the Apache Software Foundation.

11.1.1. What you need to know before reading this tutorial

This tutorial is aimed at beginners to help them learn the basic functions of the Maven tool. After completing this tutorial, your Apache Maven expertise will reach an intermediate level, and then you can learn more advanced knowledge.

To read this tutorial, you need to have the following foundations: Java 基础 .

11.1.2. Maven function

Maven can help developers do the following:

  • Construction

  • Document generation

  • Report

  • Dependence

  • SCMs

  • Publish

  • Distribute

  • Mailing list

11.1.3. Agreed configuration

Maven advocates the use of a common standard directory structure, the principle that Maven uses conventions over configuration, and we follow this directory structure as much as possible. As follows:

Catalogue

Purpose

${basedir}

存放pom.xml和所有的子目录

${basedir} / src/main/java

Java source code for the project

${basedir} / src/main/resources

项目的资源,比如说property文件,springmvc.xml

${basedir} / src/test/java

Test classes for the project, such as Junit code

${basedir} / src/test/resources

Resources for testing

${basedir} / src/main/webapp/WEB-INF

web应用文件目录,web项目的信息,比如存放web.xml、本地图片、jsp视图页面

${basedir} / target

Package output directory

${basedir} / target/classes

Compile output directory

${basedir} / target/test-classes

Test compilation output directory

Test.java

Maven will only automatically run test classes that conform to that naming convention

~/.m2/repository

Maven default local warehouse directory location

11.1.4. Characteristics of Maven

  • Project settings follow uniform rules.

  • Share in any project.

  • Dependency management includes automatic updates.

  • A large and growing library.

  • Extensible, you can easily write plug-ins for Java or scripting languages.

  • New features can be accessed instantly with little or no additional configuration.

  • 基于模型的构建 − Maven can build any number of projects into predefined output types, such as JAR,WAR or distribution based on project metadata, without the need to execute any script in most cases.

  • 项目信息的一致性站点 − uses the same metadata as the build process, and Maven can generate a Web site or PDF, including any documents you want to add, to a standard report on the development status of the project.

  • 发布管理和发布单独的输出 − Maven will not require additional configuration to integrate with source control systems such as Subversion or Git, and can manage project releases based on a tag. It can also publish it to a distribution location for use by other projects. Maven can publish separate output, such as JAR, with other dependencies and documentation archived, or as source code.

  • 向后兼容性 − you can easily migrate multiple modules from older versions of Maven to Maven 3.

  • When a child project uses a parent project dependency, normally the child project should inherit the parent project dependency without using the version number

  • 并行构建 The speed of − compilation can generally be increased by 20-50%.

  • 更好的错误报告 − Maven improves error reporting by providing you with a link to the Maven wiki page, where you can click to see a full description of the error.

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.