Maven配置文件解读--pom

SpringBoot项目pom.xml文件学习

<?xml version="1.0" encoding="UTF-8"?>
<!--<?xml version="1.0" encoding="UTF-8"?>xml文件版本号与编码格式声明,必须放在文件第一行-->

<!--<project></project>工程的根标签,项目中所需的各种配置、依赖、插件等,依此为根目录,依次以标签方式填入,xmlns表示命名空间,类似包
名,因为xml的标签可自定义,需要命名空间来区分,xmlns:xsi(xml schema instance)表示xml遵循的标签规范,xsi:包含两个链接,前者表示命名
空间地址,后者表示xsd地址,xsd(xmlschema,xml书写时需要遵循的语法)-->
<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/xsd/maven-4.0.0.xsd">
<!--    <modelVersion>maven对应的模型版本,声明项目描述符遵循哪一个POM模型版本</modelVersion>-->
    <modelVersion>4.0.0</modelVersion>
<!--    <parent></parent>父项目的坐标。如果项目中没有规定某个元素的值,那么父项目中的对应值即为项目的默认值。 坐标包括group ID,
artifact ID和version。 -->
    <parent>
<!--<groupId>与<artifactId>表示父项目的坐标,作为全球唯一标识符,表示项目地址和名字-->
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.6.RELEASE</version><!-- 用来表示所继承的父项目的版本号,此链接可以打开,可以看到其中包含的各种依赖及其版本
        ,子项目的依赖中,如果表示版本号则默认使用,父项目中对应的依赖的版本号-->
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
<!--    groupId一般分为多个段,分别表示域名、公司名、项目名称等:org、com、cn等等许多,其中org为非营利组织,com为商业组织,cn表示中
国,cn.ymy表示中国和我的名字缩写,spring-boot-learn表示项目名字,artifactId表示我的项目名称-->
    <groupId>cn.ymy.spring-boot-learn</groupId>
    <artifactId>spring-boot-learn</artifactId>
<!--    <packaging></packaging>,项目产生的构件类型,例如jar、war、ear、pom,默认为jar,也可执行创建构件类型,pom的意思是使用
maven分模块管理,一般来说所有的父级项目的packaging都为pom,其下包括各个子项目模块-->
    <packaging>pom</packaging>
    <!--<version>表示项目当前版本,格式为:主版本.次版本.增量版本-限定版本号,Snapshot 版本代表不稳定、尚处于开发中的版本,Release
     版本则代表稳定的版本 -->
    <version>1.0-SNAPSHOT</version>
    <!--表示项目下包含的各个模块,各个模块再包含各自的pom.xml,在此项目下直接进行构建就能完成对下面各个module的构建-->
    <modules>
        <module>learn-service</module>
        <module>learn-enum</module>
        <module>learn-util</module>
        <module>learn-dao</module>
        <module>learn-netty</module>
    </modules>
<!--spring-boot-learn项目的名称, Maven产生的文档用-->
    <name>spring-boot-learn</name>
    <!--项目主页的URL, Maven产生的文档用-->
    <url>http://www.example.com</url>
<!--    <properties>可以用来定义项目的各种属性-->
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
<!--   父项目使用 dependencyManagement 标签来管理, 表示子项目默认不继承, 可以配置继承,  optional 表示子 pom 无论如何都不能继承
 <dependencies>表示项目使用到的各种以来,子项目也可选择是否继承-->
    <dependencies>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
     <build>
        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
            <plugins>
                <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.7.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <!--<repositories>表示仓库地址-->
    <repositories>
        <repository>
            <id>maven-net-cn</id>
            <name>Maven China Mirror</name>
            <url>http://maven.net.cn/content/groups/public/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
<!--    <distributionManagement>,用来配置构建的分发地址,可以将本地仓库的构建分发到远程仓库,这样可供多人访问此构件-->
    <distributionManagement>
        <repository>
            <id>nexus-releases</id>
            <url>http://10.123.234.345:8081/nexus/content/repositories/releases</url>
        </repository>
    </distributionManagement>
</project>

maven build标签(参考:https://blog.csdn.net/u010010606/article/details/79727438
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值