Spring Boot学习-pom初探

Maven的用户能够经过继承spring-boot-starter-parent项目来得到一些合理的默认配置:spring

默认使用Java 8
使用UTF-8编码
一个引用管理的功能,在dependencies里的部分配置能够不用填写version信息,这些version信息会从spring-boot-dependencies里获得继承。
识别过来资源过滤(Sensible resource filtering.)
识别插件的配置(Sensible plugin configuration (exec plugin, surefire, Git commit ID, shade).)
可以识别application.properties和application.yml类型的文件,同时也能支持profile-specific类型的文件(如: application-foo.properties and application-foo.yml,这个功能能够更好的配置不一样生产环境下的配置文件)。
maven把默认的占位符${…​}改成了@..@

若是dependencies中的一些引用不想使用默认的版本,能够直接加上version信息<properties>把默认的覆盖掉。app

注意:parent的pom中依然默认有<parent>标签:spring-boot-dependencies;maven

若是不想使用spring-boot-starter-parent,也能够本身来配置所要使用的版本,可是,这种方式下若是想要某些引用的版本特殊说明,就要在上面的声明以前配置(spring-boot-dependencies以前,同时<scope>import</scope>是关键):ide

<dependencyManagement>
    <dependencies>
        <!-- Override Spring Data release train provided by Spring Boot -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-releasetrain</artifactId>
            <version>Fowler-SR2</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>2.0.0.BUILD-SNAPSHOT</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
相关文章
相关标签/搜索