通知短信+运营短信,5秒速达,支持群发助手一键发送🚀高效触达和通知客户 广告
# 10.1.1. Maven安装 Spring Boot兼容Apache Maven 3.2或更高版本。如果本地没有安装Maven,你可以参考[maven.apache.org](http://maven.apache.org/)上的指南。 **注**:在很多操作系统上,可以通过包管理器来安装Maven。OSX Homebrew用户可以尝试`brew install maven`,Ubuntu用户可以运行`sudo apt-get install maven`。 Spring Boot依赖使用的groupId为`org.springframework.boot`。通常,你的Maven POM文件会继承`spring-boot-starter-parent`工程,并声明一个或多个[“Starter POMs”](https://github.com/cwiki-us-spring-guides/Spring-Boot-Reference-Guide/tree/0047aa8098a650dde0c93f4d2e91754c83468c4b/III.%20Using%20Spring%20Boot/13.4.%20Starter%20POMs.md)依赖。此外,Spring Boot提供了一个可选的[Maven插件](https://github.com/cwiki-us-spring-guides/Spring-Boot-Reference-Guide/tree/0047aa8098a650dde0c93f4d2e91754c83468c4b/VIII.%20Build%20tool%20plugins/58.%20Spring%20Boot%20Maven%20plugin.md),用于创建可执行jars。 下面是一个典型的pom.xml文件: ```markup <?xml version="1.0" encoding="UTF-8"?> <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.example</groupId> <artifactId>myproject</artifactId> <version>0.0.1-SNAPSHOT</version> <!-- Inherit defaults from Spring Boot --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.0.BUILD-SNAPSHOT</version> </parent> <!-- Add typical dependencies for a web application --> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> <!-- Package as an executable jar --> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> <!-- Add Spring repositories --> <!-- (you don't need this if you are using a .RELEASE version) --> <repositories> <repository> <id>spring-snapshots</id> <url>http://repo.spring.io/snapshot</url> <snapshots><enabled>true</enabled></snapshots> </repository> <repository> <id>spring-milestones</id> <url>http://repo.spring.io/milestone</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>spring-snapshots</id> <url>http://repo.spring.io/snapshot</url> </pluginRepository> <pluginRepository> <id>spring-milestones</id> <url>http://repo.spring.io/milestone</url> </pluginRepository> </pluginRepositories> </project> ``` **注**:`spring-boot-starter-parent`是使用Spring Boot的一种不错的方式,但它并不总是最合适的。有时你可能需要继承一个不同的父 POM,或只是不喜欢我们的默认配置,那你可以使用import作用域这种替代方案,具体查看[Section 13.2.2, “Using Spring Boot without the parent POM”](https://github.com/cwiki-us-spring-guides/Spring-Boot-Reference-Guide/tree/0047aa8098a650dde0c93f4d2e91754c83468c4b/III.%20Using%20Spring%20Boot/13.1.2.%20Using%20Spring%20Boot%20without%20the%20parent%20POM.md)。