SpringBoot pom.xml内容解析

在这里插入图片描述

SpringBoot pom.xml内容解析

pom.xml文件是Maven进行工作的主要配置文件。在这个文件中我们可以配置Maven项目的groupId、artifactId和version等Maven项目必须的元素;可以配置Maven项目需要使用的远程仓库;可以定义Maven项目打包的形式;可以定义Maven项目的资源依赖关系等等。

请添加图片描述


pom.xml标签

 <!--project是pom.xml的根元素,包含了一些约束的信息,比如xlms,xsi-->
<project>
        <!--指定了当前pom的版本-->
         <modelVersion>4.0.0</modelVersion>
        <!--maven2.0必须是这样写,现在是maven2唯一支持的版本-->
        <!-- 基础设置 -->
        <groupId>反写公司的网址+项目名称</groupId>
        <artifactId>项目名称+模块名</artifactId>
        <version>当前项目版本号</version>
         <!-- 默认是jar,还可以打包成war/zip/pom-->
        <packaging>...</packaging>
        <!-- 项目描述名,一般是写项目文档的时候才使用 -->
        <name>...</name>
        <!-- 项目的地址-->
        <url>...</url>
        <!-- 项目的描述 -->
        <description>...</description>
        <!-- 开发人员的列表 -->
        <developers>...</developers>
        <!-- 许可证的信息 -->
        <licenses>...</licenses>
        <!-- 组织信息 -->
        <organization>...</organization>

        <!-- 依赖列表,下面可以包含多个依赖项dependency-->
        <dependencies>
           <dependency>
               <!-- 指定坐标确定依赖项的位置 -->
               <groupId></groupId>
               <artifactId></artifactId>
               <version></version>
               <type></type>
               <!-- 依赖包的依赖范围-->
               <scope></scope>
               <!-- 这个标签只有truefalse两个值,是用来设置依赖是否可选 -->
               <optional></optional>
               <!-- 排除依赖传递列表 -->
               <exclusions> 
                 <exclusion>
                 </exclusion>  
               </exclusions>
            </dependency>
         </dependencies>

         <!-- 依赖管理,里面包含多个依赖,但是它并不会被运行,即不会被引用到实际的依赖中-->
         <!--这个标签主要是用来定义在父模块中,供子模块继承用 -->
         <dependencyManagement>                              
             <dependencies>
                <dependency>
                </dependency>
             </dependencies>
        </dependencyManagement>

         <!-- 常用于给构件的行为提供相应的支持 -->
          <build>
            <!-- 插件列表 -->
            <plugins>
                <plugin>
                   <groupId></groupId>
                   <artifactId></artifactId>
                   <version></version>
                 </plugin>
             </plugins>
          </build>

        <!-- 用于在子模块中对父模块的pom的继承 -->
        <parent>...</parent>
         <!-- 用来聚合多个模块,让多个模块进行编译,不用一个一个来 -->
        <modules>
          <module>
          </module>
        </modules>
</project>

如:

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.dvms</groupId>
    <artifactId>data_view</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>data_view</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <!--导入Thymeleaf依赖,基于3.x开发-->
        <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf-spring5</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!--导入springboot和mybatis依赖 包含mybatis的核心-->
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.1.0</version>
        </dependency>

        <!--导入druid依赖,基于3.x开发-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.1.22</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!--导入lombok小辣椒驱动依赖,用来生成get/set方法依赖-->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <!--<optional>true</optional>-->
            <version>1.18.12</version>
            <scope>provided</scope><!--自动生成有参无参构造-->
        </dependency>
        <!--热部署插件-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!--引入pagehelper分页插件-->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.2.10</version>
        </dependency>
        <!--kaptcha 框架-->
        <dependency>
            <groupId>com.github.penggle</groupId>
            <artifactId>kaptcha</artifactId>
            <version>2.3.2</version>
        </dependency>
        <!--安全框架-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <!--Thymeleaf整合security-->
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
            <version>3.0.4.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!--fork :  如果没有该项配置,devtools不会起作用,即应用不会restart -->
                    <fork>true</fork>
                    <addResources>true</addResources>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>


END

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

*猪耳朵*

听我说谢谢你,因为有你。。。。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值