maven项目的pom文件中常用的简单的标签理解

xiaoxiao2021-02-28  136

maven的pom文件一些标签的理解

在本篇文章中,我只是将pom文件中的一些常用的并且比较简单的标签理解标记注释了。还有很多并常用但是也很重要的这里并没有列出。因为本人水平也有限的,所以请谅解。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <!-- 模型版本 maven2.0必须这样写,现在是maven2唯一支持的版本 --> <modelVersion>4.0.0</modelVersion> <!-- 公司或者组织的唯一标识,并且配置时生成的路径也是由此生成。 如com.winner.trade.maven会将该项目打成的jar包放在本地路径:com/winner/trade --> <groupId>xia.testHuaWei</groupId> <!-- 本项目唯一的id,一个groupId下面可以有很多个项目,就是靠artifactId来区分的 --> <artifactId>test_web</artifactId> <!-- 打包机制,如pom,jar,war等 --> <packaging>war</packaging> <!-- 本项目目前所处的版本号 --> <version>0.0.1-SNAPSHOT</version> <!-- 项目的名称,maven生成文档的时候用 --> <name>test_web Maven Webapp</name> <!-- 项目主页的url maven生成文档用 --> <url>http://maven.apache.org</url> <!-- 本项目的详细描述 --> <description>A maven project to study pom of maven</description> <!-- 为本pom文件定义一些常量,在pom文件中可以直接${file-encoding} 这样引用--> <properties> <file-encoding></file-encoding> </properties> <!-- 我们项目中需要的jar依赖 --> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <!-- build进行pom文件的构建配置 --> <build> <!-- 产生的构建的文件名,默认值是${artifactId}-${version} --> <finalName>test_web</finalName> <!-- 项目相关的所有资源路径列表。例如项目相关的配置文件、属性文件、这些资源都被包含在最终的打包文件里 --> <resources> <resource> <!-- 描述资源存放的目录。该路径相对于pom路径 --> <directory>src/mian/resources</directory> <!-- 包含的模式列表 --> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <!--排除的模式列表 如果<include>与<exclude>划定的范围存在冲突,以<exclude>为准 --> <excludes> <exclude>jdbc.properties</exclude> </excludes> </resource> </resources> </build> </project>

后续会随着自己不断的学习,其他标签的理解也会发表出来。让我们一起学习吧!

转载请注明原文地址: https://www.6miu.com/read-18588.html

最新回复(0)