Using Spring Boot —— Build Systems

时间:2019-09-11
本文章向大家介绍Using Spring Boot —— Build Systems,主要包括Using Spring Boot —— Build Systems使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

使用spring boot —— maven构建

1.继承 starter parent

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.8.RELEASE</version>
</parent>

2.如果你的系统pom已经有自定义的parent,又想使用springboot。还可以直接添加如下依赖:

<dependencyManagement>
    <dependencies>
     <!-- 这儿写其他依赖 -->
        <dependency>
            <!-- Import dependency management from Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>2.1.8.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

3. Spring Boot包含一个Maven插件,可以将项目打包为可执行jar。需要在pom中添加如下的<plugin>

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

4.springboot 提供了很多种starters,使用时只需要添加对应的依赖即可。





  

原文地址:https://www.cnblogs.com/han6/p/11505388.html