详解用maven搭建springboot环境的方法

网友投稿 283 2023-04-12


详解用maven搭建springboot环境的方法

SpringBoot不是一个新框架,它是让开发者更快的开发Spring应用的一条捷径。使用它和使用标准java类库一样,只要简单的指定合适的 spring-boot-*.jar 就可以了。这里我们说怎么用maven导入SpringBoot的包。

SpringBoot要去Maven的版本达到3.2或以上,Maven的下载地址是 maven.apache.org.

http://

SpringBoot的依赖包形式都如 org.springframework.boot + groupId,一般是继承项目 spring-boot-starter-parent。下面是一个典型的POM文件:

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0

com.example

myproject

0.0.1-SNAPSHOT

org.springframework.boot

spring-boot-starter-parent

1.3.0.BUILD-SNAPSHOT

org.springframework.boot

spring-boot-starter-web

org.springframework.boot

spring-boot-maven-plugin

spring-snapshots

http://repo.spring.io/snapshot

true

http://repo.spring.io/milestone

spring-snapshots

http://repo.spring.io/snapshot

spring-milestones

http://repo.spring.io/milestone

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0

com.example

myproject

0.0.1-SNAPSHOT

org.springframework.boot

spring-boot-starter-parent

1.3.0.BUILD-SNAPSHOT

org.springframework.boot

spring-boot-starter-web

org.springframework.boot

spring-boot-maven-plugin

spring-snapshots

http://repo.spring.io/snapshot

true

http://repo.spring.io/milestone

spring-snapshots

http://repo.spring.io/snapshot

spring-milestones

http://repo.spring.io/milestone

Parent里面把版本指定好了,下面的依赖项就不能指定版本了。如果你不想要它固定的版本,可以自己http://修改。怎么改呢?很简单,只要指定scope为import就行:

org.springframework.boot

spring-boot-dependencies

1.3.0.BUILD-SNAPSHOT

pom

import


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Java整型数与网络字节序byte[]数组转换关系详解
下一篇:包含在线http接口测试的词条
相关文章

 发表评论

暂时没有评论,来抢沙发吧~