spring-boot pom.xml探究

一个spirng-boot的web项目
一、父项目spring-boot-starter-parent是做依赖管理的

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.20.BUILD-SNAPSHOT</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

它还依赖于一个父项目spring-boot-dependencies

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>1.5.20.BUILD-SNAPSHOT</version>
        <relativePath>../../spring-boot-dependencies</relativePath>
    </parent>

spring-boot-dependencies项目才是真正管理springboot应用里面的所有依赖版本的项目,下面是它的properties配置。所以以后我们导入依赖默认是不需写版本的,而没有在dependencies里面管理的项目就需要声明版本号了。

    <properties>
        <!-- Dependency versions -->
        <activemq.version>5.14.5</activemq.version>
        <antlr2.version>2.7.7</antlr2.version>
        <appengine-sdk.version>1.9.71</appengine-sdk.version>
        <artemis.version>1.5.6</artemis.version>
        <aspectj.version>1.8.13</aspectj.version>
        <assertj.version>2.6.0</assertj.version>
        <atomikos.version>3.9.3</atomikos.version>
        <bitronix.version>2.1.4</bitronix.version>
        <caffeine.version>2.3.5</caffeine.version>
        <cassandra-driver.version>3.1.4</cassandra-driver.version>
        <classmate.version>1.3.4</classmate.version>
        <commons-beanutils.version>1.9.3</commons-beanutils.version>
        <commons-collections.version>3.2.2</commons-collections.version>
        <commons-codec.version>1.10</commons-codec.version>
        <commons-dbcp.version>1.4</commons-dbcp.version>
        <commons-dbcp2.version>2.1.1</commons-dbcp2.version>
        <commons-digester.version>2.1</commons-digester.version>
        <commons-pool.version>1.6</commons-pool.version>
        <commons-pool2.version>2.4.3</commons-pool2.version>
        <couchbase-client.version>2.3.7</couchbase-client.version>
        <couchbase-cache-client.version>2.1.0</couchbase-cache-client.version>
        <crashub.version>1.3.2</crashub.version>
        <derby.version>10.13.1.1</derby.version>
        <dom4j.version>1.6.1</dom4j.version>
        <dropwizard-metrics.version>3.1.5</dropwizard-metrics.version>
        <ehcache.version>2.10.5</ehcache.version>
        <ehcache3.version>3.2.3</ehcache3.version>
        <embedded-mongo.version>1.50.5</embedded-mongo.version>
        <flyway.version>3.2.1</flyway.version>
        <freemarker.version>2.3.28</freemarker.version>
        <elasticsearch.version>2.4.6</elasticsearch.version>
        <gemfire.version>8.2.13</gemfire.version>
        <glassfish-el.version>3.0.0</glassfish-el.version>
        <gradle.version>2.9</gradle.version>
        <groovy.version>2.4.16</groovy.version>
        <gson.version>2.8.5</gson.version>
        <h2.version>1.4.197</h2.version>
        <hamcrest.version>1.3</hamcrest.version>
        <hazelcast.version>3.7.8</hazelcast.version>
        <hazelcast-hibernate4.version>3.7.1</hazelcast-hibernate4.version>
        <hazelcast-hibernate5.version>1.1.3</hazelcast-hibernate5.version>
        <hibernate.version>5.0.12.Final</hibernate.version>
        <hibernate-validator.version>5.3.6.Final</hibernate-validator.version>
        <hikaricp.version>2.5.1</hikaricp.version>
        <hikaricp-java6.version>2.3.13</hikaricp-java6.version>
        <hikaricp-java7.version>2.4.13</hikaricp-java7.version>
        <hsqldb.version>2.3.6</hsqldb.version>
        <htmlunit.version>2.21</htmlunit.version>
        <httpasyncclient.version>4.1.4</httpasyncclient.version>
        <httpclient.version>4.5.6</httpclient.version>
        <httpcore.version>4.4.10</httpcore.version>
        <infinispan.version>8.2.11.Final</infinispan.version>
        <jackson.version>2.8.11.20181123</jackson.version>
        <janino.version>2.7.8</janino.version>
        <javassist.version>3.21.0-GA</javassist.version> <!-- Same as Hibernate -->
        <javax-cache.version>1.0.0</javax-cache.version>
        <javax-mail.version>1.5.6</javax-mail.version>
        <javax-transaction.version>1.2</javax-transaction.version>
        <javax-validation.version>1.1.0.Final</javax-validation.version>
        <jaxen.version>1.1.6</jaxen.version>
        <jaybird.version>2.2.14</jaybird.version>
        <jboss-logging.version>3.3.2.Final</jboss-logging.version>
        <jboss-transaction-spi.version>7.6.0.Final</jboss-transaction-spi.version>
        <jdom2.version>2.0.6</jdom2.version>
        <jedis.version>2.9.1</jedis.version>
        <jersey.version>2.25.1</jersey.version>
        <jest.version>2.0.4</jest.version>
        <jetty.version>9.4.14.v20181114</jetty.version>
        <jetty-jsp.version>2.2.0.v201112011158</jetty-jsp.version>
        <jetty-el.version>8.0.33</jetty-el.version>
        <jms-api.version>1.1-rev-1</jms-api.version>
        <jmustache.version>1.13</jmustache.version>
        <jna.version>4.2.2</jna.version>
        <joda-time.version>2.9.9</joda-time.version>
        <jolokia.version>1.3.7</jolokia.version>
        <jooq.version>3.9.6</jooq.version>
        <json.version>20140107</json.version>
        <jsonassert.version>1.4.0</jsonassert.version>
        <json-path.version>2.2.0</json-path.version>
        <jstl.version>1.2</jstl.version>
        <jtds.version>1.3.1</jtds.version>
        <junit.version>4.12</junit.version>
        <liquibase.version>3.5.5</liquibase.version>
        <log4j2.version>2.7</log4j2.version>
        <logback.version>1.1.11</logback.version>
        <lombok.version>1.16.22</lombok.version>
        <mariadb.version>1.5.9</mariadb.version>
        <mssql-jdbc.version>6.1.0.jre7</mssql-jdbc.version>
        <mockito.version>1.10.19</mockito.version>
        <mongodb.version>3.4.3</mongodb.version>
        <mysql.version>5.1.47</mysql.version>
        <narayana.version>5.5.34.Final</narayana.version>
        <nekohtml.version>1.9.22</nekohtml.version>
        <neo4j-ogm.version>2.1.6</neo4j-ogm.version>
        <postgresql.version>9.4.1212.jre7</postgresql.version>
        <querydsl.version>4.1.4</querydsl.version>
        <rabbit-amqp-client.version>4.8.3</rabbit-amqp-client.version>
        <reactor.version>2.0.8.RELEASE</reactor.version>
        <reactor-spring.version>2.0.7.RELEASE</reactor-spring.version>
        <selenium.version>2.53.1</selenium.version>
        <selenium-htmlunit.version>2.21</selenium-htmlunit.version>
        <sendgrid.version>2.2.2</sendgrid.version>
        <servlet-api.version>3.1.0</servlet-api.version>
        <simple-json.version>1.1.1</simple-json.version>
        <slf4j.version>1.7.25</slf4j.version>
        <snakeyaml.version>1.17</snakeyaml.version>
        <solr.version>5.5.5</solr.version>
        <spock.version>1.0-groovy-2.4</spock.version>
        <spring.version>4.3.22.RELEASE</spring.version>
        <spring-amqp.version>1.7.12.RELEASE</spring-amqp.version>
        <spring-cloud-connectors.version>1.2.7.RELEASE</spring-cloud-connectors.version>
        <spring-batch.version>3.0.10.RELEASE</spring-batch.version>
        <spring-data-releasetrain.version>Ingalls-SR18</spring-data-releasetrain.version>
        <spring-hateoas.version>0.23.0.RELEASE</spring-hateoas.version>
        <spring-integration.version>4.3.19.RELEASE</spring-integration.version>
        <spring-integration-java-dsl.version>1.2.3.RELEASE</spring-integration-java-dsl.version>
        <spring-kafka.version>1.1.8.RELEASE</spring-kafka.version>
        <spring-ldap.version>2.3.2.RELEASE</spring-ldap.version>
        <spring-loaded.version>1.2.8.RELEASE</spring-loaded.version>
        <spring-mobile.version>1.1.5.RELEASE</spring-mobile.version>
        <spring-plugin.version>1.2.0.RELEASE</spring-plugin.version>
        <spring-restdocs.version>1.1.3.RELEASE</spring-restdocs.version>
        <spring-retry.version>1.2.3.RELEASE</spring-retry.version>
        <spring-security.version>4.2.11.RELEASE</spring-security.version>
        <spring-security-jwt.version>1.0.9.RELEASE</spring-security-jwt.version>
        <spring-security-oauth.version>2.0.16.RELEASE</spring-security-oauth.version>
        <spring-session.version>1.3.5.RELEASE</spring-session.version>
        <spring-social.version>1.1.6.RELEASE</spring-social.version>
        <spring-social-facebook.version>2.0.3.RELEASE</spring-social-facebook.version>
        <spring-social-linkedin.version>1.0.2.RELEASE</spring-social-linkedin.version>
        <spring-social-twitter.version>1.1.2.RELEASE</spring-social-twitter.version>
        <spring-ws.version>2.4.4.RELEASE</spring-ws.version>
        <sqlite-jdbc.version>3.15.1</sqlite-jdbc.version>
        <statsd-client.version>3.1.0</statsd-client.version>
        <sun-mail.version>${javax-mail.version}</sun-mail.version>
        <thymeleaf.version>2.1.6.RELEASE</thymeleaf.version>
        <thymeleaf-extras-springsecurity4.version>2.1.3.RELEASE</thymeleaf-extras-springsecurity4.version>
        <thymeleaf-extras-conditionalcomments.version>2.1.2.RELEASE</thymeleaf-extras-conditionalcomments.version>
        <thymeleaf-layout-dialect.version>1.4.0</thymeleaf-layout-dialect.version>
        <thymeleaf-extras-data-attribute.version>1.3</thymeleaf-extras-data-attribute.version>
        <thymeleaf-extras-java8time.version>2.1.0.RELEASE</thymeleaf-extras-java8time.version>
        <tomcat.version>8.5.37</tomcat.version>
        <undertow.version>1.4.26.Final</undertow.version>
        <unboundid-ldapsdk.version>3.2.1</unboundid-ldapsdk.version>
        <webjars-hal-browser.version>9f96c74</webjars-hal-browser.version>
        <webjars-locator.version>0.32-1</webjars-locator.version>
        <wsdl4j.version>1.6.3</wsdl4j.version>
        <xml-apis.version>1.4.01</xml-apis.version>
        <!-- Plugin versions -->
        <build-helper-maven-plugin.version>1.10</build-helper-maven-plugin.version>
        <exec-maven-plugin.version>1.5.0</exec-maven-plugin.version>
        <git-commit-id-plugin.version>2.2.6</git-commit-id-plugin.version>
        <maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
        <maven-assembly-plugin.version>2.6</maven-assembly-plugin.version>
        <maven-clean-plugin.version>2.6.1</maven-clean-plugin.version>
        <maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
        <maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
        <maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
        <maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
        <maven-enforcer-plugin.version>1.4.1</maven-enforcer-plugin.version>
        <maven-failsafe-plugin.version>2.18.1</maven-failsafe-plugin.version>
        <maven-install-plugin.version>2.5.2</maven-install-plugin.version>
        <maven-invoker-plugin.version>1.10</maven-invoker-plugin.version>
        <maven-help-plugin.version>2.2</maven-help-plugin.version>
        <maven-jar-plugin.version>2.6</maven-jar-plugin.version>
        <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
        <maven-resources-plugin.version>2.7</maven-resources-plugin.version>
        <maven-shade-plugin.version>2.4.3</maven-shade-plugin.version>
        <maven-site-plugin.version>3.5.1</maven-site-plugin.version>
        <maven-source-plugin.version>2.4</maven-source-plugin.version>
        <maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
        <maven-war-plugin.version>2.6</maven-war-plugin.version>
        <versions-maven-plugin.version>2.2</versions-maven-plugin.version>
    </properties>

二、导入的依赖spring-boot-starter-web

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

spring-boot-starter叫做spring-boot场景启动器
spring-boot-starter-web依赖了如下关键的项目,它帮我们导入了web模块正常运行所需要的组件

            <!-- Spring Boot基础项目 -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot</artifactId>
                <version>1.5.20.BUILD-SNAPSHOT</version>
            </dependency>
            <!-- 内置tomcat -->
            <dependency>
                <groupId>org.apache.tomcat.embed</groupId>
                <artifactId>tomcat-embed-core</artifactId>
                <version>${tomcat.version}</version>
            </dependency>
            <!-- jackson-->
            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${jackson.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <!-- 内置spring-webmvc -->
            <dependency>
                <groupId>io.projectreactor.spring</groupId>
                <artifactId>reactor-spring-webmvc</artifactId>
                <version>${reactor-spring.version}</version>
            </dependency>

starters是一系列依赖描述的组合,spring-boot将所有的功能场景全部抽取出来,做成一个一个的starter(启动器),只需要在项目里面引用这些starter的相关场景,所有依赖都会导入进来,版本由springboot自动控制,要用什么功能就导入什么场景的启动器。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 201,468评论 5 473
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 84,620评论 2 377
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 148,427评论 0 334
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,160评论 1 272
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,197评论 5 363
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,334评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,775评论 3 393
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,444评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,628评论 1 295
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,459评论 2 317
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,508评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,210评论 3 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,767评论 3 303
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,850评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,076评论 1 258
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,627评论 2 348
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,196评论 2 341

推荐阅读更多精彩内容