springboot工程pom的兩種配置方式


<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.hjzgg.simulation</groupId>
    <artifactId>service</artifactId>
    <version>1.0-SNAPSHOT</version>

    <modules>
        <module>provider</module>
        <module>consumer</module>
        <module>register</module>
        <module>common</module>
        <module>api</module>
    </modules>
    <packaging>pom</packaging>

    <name>service</name>
    <url>http://maven.apache.org</url>
  
  //這里讓 spring boot parent 當做項目的 parent <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>${spring-boot.version}</version> </parent> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> <common.lang3.version>3.4</common.lang3.version> <pagehelper.version>4.1.1</pagehelper.version> <fastjson.version>1.2.17</fastjson.version> <swagger2-version>2.6.1</swagger2-version> <spring-boot.version>1.5.2.RELEASE</spring-boot.version> </properties> <dependencyManagement> <dependencies> <!-- 公共組件 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>${common.lang3.version}</version> </dependency> <!--fast json--> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>${fastjson.version}</version> </dependency> <!--swagger2--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>${swagger2-version}</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>${swagger2-version}</version> </dependency>         
        //這里,是另一種依賴 spring boot方式
<!--<dependency>--> <!--<groupId>org.springframework.boot</groupId>--> <!--<artifactId>spring-boot-dependencies</artifactId>--> <!--<version>${spring-boot.version}</version>--> <!--<type>pom</type>--> <!--<scope>import</scope>--> <!--</dependency>--> </dependencies> </dependencyManagement> </project>

 

參考:spring-boot-dependencies

 

參考示例工程1  參考示例工程2(maven多module情況下使用springboot)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM