Update 11.2. Adding classpath dependencies.md

master
qibaoguang 2015-05-15 10:08:30 +08:00
parent 06d95c1e4e
commit b606d449a2
1 changed files with 2 additions and 2 deletions

View File

@ -1,13 +1,13 @@
### 11.2. 添加classpath依赖 ### 11.2. 添加classpath依赖
Spring Boot提供很多"Starter POMs"这能够让你轻松的将jars添加到你的classpath下。我们的示例程序已经在POM的`partent`节点使用了`spring-boot-starter-parent`。`spring-boot-starter-parent`是一个特殊的starter它提供了有用的Maven默认设置。同时它也提供了一个`dependency-management`节点这样对于”blessed“依赖你可以省略`version`标记。 Spring Boot提供很多"Starter POMs"这能够让你轻松的将jars添加到你的classpath下。我们的示例程序已经在POM的partent节点使用了`spring-boot-starter-parent`。`spring-boot-starter-parent`是一个特殊的starter它提供了有用的Maven默认设置。同时它也提供了一个`dependency-management`节点这样对于”blessed“依赖你可以省略version标记。
其他的”Starter POMs“简单的提供依赖这些依赖可能是你开发特定类型的应用时需要的。由于正在开发一个web应用我们将添加一个`spring-boot-starter-web`依赖-但在此之前,让我们看下目前所拥有的: 其他的”Starter POMs“简单的提供依赖这些依赖可能是你开发特定类型的应用时需要的。由于正在开发一个web应用我们将添加一个`spring-boot-starter-web`依赖-但在此之前,让我们看下目前所拥有的:
```shell ```shell
$ mvn dependency:tree $ mvn dependency:tree
[INFO] com.example:myproject:jar:0.0.1-SNAPSHOT [INFO] com.example:myproject:jar:0.0.1-SNAPSHOT
``` ```
`mvn dependency:tree`命令以树形表示来打印你的项目依赖。你可以看到`spring-boot-starter-parent`本身并没有提供依赖。编辑我们的`pom.xml`,并在`parent`节点下添加`spring-boot-starter-web`依赖: `mvn dependency:tree`命令以树形表示来打印你的项目依赖。你可以看到`spring-boot-starter-parent`本身并没有提供依赖。编辑我们的pom.xml并在parent节点下添加`spring-boot-starter-web`依赖:
```xml ```xml
<dependencies> <dependencies>
<dependency> <dependency>