栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

《Spring篇》-- Maven pom中构建springboot项目

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

《Spring篇》-- Maven pom中构建springboot项目

pom中构建springboot项目
  • 两种方式
    • 第一种是继承spring-boot-starter-parent
    • [推荐,常用]通过dependencyManagement进行依赖管理
  • 总结
  • 在贴一下pom中的构造

两种方式

spring-boot-dependencies 跟 spring-boot-starter-parent

第一种是继承spring-boot-starter-parent

上代码:


   org.springframework.boot
    spring-boot-starter-parent
    2.2.2.RELEASE
     

[推荐,常用]通过dependencyManagement进行依赖管理

上代码:

 
     
         
             org.springframework.boot
             spring-boot-dependencies
             ${spring-boot.version}
             pom
             import
         

         
             org.mybatis.spring.boot
             mybatis-spring-boot-starter
             ${mybatis.spring.boot.version}
         

         
         
             com.baomidou
             mybatis-plus-boot-starter
             ${baomidou.version}
         
         
             com.baomidou
             mybatis-plus-generator
             ${baomidou.version}
         
         
     
 
总结

这两种方式,我们在使用里面一些相关起步依赖时,都不需要指定版本号。


   
    
        org.springframework.boot
        spring-boot-starter-web
        
            
                org.springframework.boot
                spring-boot-starter-logging
            
        
    

    
        org.springframework.boot
        spring-boot-starter-freemarker
    

    
    
        org.springframework.boot
        spring-boot-starter-log4j2
    

    
    
        org.springframework.boot
        spring-boot-starter-aop
    

    
    
        com.lmax
        disruptor
        3.3.6
    

    
    
        org.springframework.boot
        spring-boot-starter-test
        test
    

    
    
        mysql
        mysql-connector-java
        true
    

    
    
        org.springframework.boot
        spring-boot-starter-data-redis
    

    
    
        org.springframework.boot
        spring-boot-starter-validation
    

    
    
        com.baomidou
        mybatis-plus-boot-starter
        true
    

    
        com.baomidou
        mybatis-plus-generator
        true
    

在贴一下pom中的构造

这都是根据自己项目和业务来的,这里只是简单贴一下代码,做一个参考。


   
        
            org.springframework.boot
            spring-boot-maven-plugin
            
                true
            
        
        
            org.apache.maven.plugins
            maven-compiler-plugin
            
                -parameters
                UTF-8
                1.8
                1.8
            
        
        
            org.apache.maven.plugins
            maven-jar-plugin
            
                
                    ***.xml
                
                
                    **ehcache_3_1.xml
                    **/log4j2-spring.xml
                    **/package.xml
                

                
                    
                        true
                        lib/
                        ${main.class}
                        false
                        true
                        true
                    
                    
                        .
                    
                

            
        
        
            org.apache.maven.plugins
            maven-assembly-plugin
            
                
                    src/main/resources/config/package.xml
                
            
            
                
                    make-assembly
                    package
                    
                        single
                    
                
            
        
        
            org.apache.maven.plugins
            maven-surefire-plugin
            
                true
                -Dfile.encoding=UTF-8
            
        
    

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/631147.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号