1.使用maven作为parent管理

maven用户可以继承spring-boot-starter-parent项目获取合适的默认设置。该父项目提供一下特性:

  1. 默认编译级别为Java1.6
  2. 源编码格式为UTF-8
  3. 一个依赖管理节点,允许你省略普通依赖的标签,继承自Spring-boot-dependencies POM .
  4. 合适的资源过滤
  5. 合适的插件配置(exec插件,surefire,git commit ID,shade)
  6. 针对application.properties和application.yml的资源过滤
    在项目的POM文件中添加parent配置
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
</parent> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>

如果需要生成一个可执行的jar,则添加配置

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

2.使用没有父POM的Spring Boot

如果不喜欢继承 spring-boot-starter-parent POM。 你可能需要使用公司标准parent, 或你可能倾向于显式声明所有Maven配置。如果你不使用 spring-boot-starter-parent , 通过使用一个 scope=import 的依赖, 你仍能获取到依赖管理的好处:

<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.3.0.BUILD-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

改变Java的版本

spring-boot-starter-parent 选择相当保守的Java兼容策略。 如果你遵循我们的建议, 使用最新的Java版本, 你可以添加一个 java.version 属性

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

最新文章

  1. Java的几个同步辅助类
  2. 修改主机hostname
  3. EF架构~为BulkInsert引入SET IDENTITY_INSERT ON功能
  4. Windows Service 开发,安装与调试
  5. Android图片适配,drawable文件夹,低分辨率图片是否必要
  6. Spring For Android初体验
  7. CLSID {91493441-5A91-11CF-8700-00AA0060263B}错误
  8. 域名的a记录转过来他的公网ip
  9. Node.js tools for visual studio 在vs中使用Node.js
  10. 【Android】Android的优点和不足之处
  11. 排名最重要的三个优化阶段分析 ---------------------&gt;&gt;转至(卧牛SEO/武汉SEO http://blog.sina.com.cn/zhengkangseo )
  12. SQL使用记录
  13. launch failed.Binary not found
  14. (转载)python日期函数
  15. 从性能角度看react组件拆分的重要性
  16. CREATE DATABASE RoomReservation
  17. SmartSql 快速使用指南
  18. CSS学习笔记_day1
  19. 如何使用@vue/cli 3.0在npm上创建,发布和使用你自己的Vue.js组件库
  20. Mybaits动态Sql

热门文章

  1. Atlassian官方合作伙伴
  2. Android MVP 构架初试
  3. Fireworks如何制作透明窗口PNG
  4. UVALive 4857 Halloween Costumes
  5. 解决Linux平台下VMware出现&quot;No 3d support is available from the host&quot;或&quot;Hardware graphics acceleration is not available&quot; 错误
  6. poj 3311 Hie with the Pie dp+状压
  7. 算法笔记_018:旅行商问题(Java)
  8. react 调用项目中的 .html 文件
  9. couldn&#39;t find &quot;libstlport_shared.so&quot;
  10. 2.4.1 用NPOI操作EXCEL关于HSSFClientAnchor(dx1,dy1,dx2,dy2,col1,row1,col2,row2)的参数