11.1. Maven tutorial

发布时间 : 2025-10-25 13:35:07 UTC      

Page Views: 10 views

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.

《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。