Skip to content

Commit 9cb91f8

Browse files
authored
Update 80.1 Generate build information.md
1 parent 56e8f7f commit 9cb91f8

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed
Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,41 @@
1-
###80.1 Generate build information
1+
###80.1 生成构建信息
2+
3+
Maven和Gradle都支持产生包含项目版本,坐标,名称的构建信息,该插件可以通过配置添加其他属性。当这些文件出现时,Spring Boot自动配置一个`BuildProperties` bean。
4+
5+
为了让Maven生成构建信息,你需要为`build-info` goal添加一个execution:
6+
```xml
7+
<build>
8+
<plugins>
9+
<plugin>
10+
<groupId>org.springframework.boot</groupId>
11+
<artifactId>spring-boot-maven-plugin</artifactId>
12+
<version>1.4.1.RELEASE</version>
13+
<executions>
14+
<execution>
15+
<goals>
16+
<goal>build-info</goal>
17+
</goals>
18+
</execution>
19+
</executions>
20+
</plugin>
21+
</plugins>
22+
</build>
23+
```
24+
**** 更多详情查看[Spring Boot Maven插件文档](http://docs.spring.io/spring-boot/docs/1.4.1.RELEASE/maven-plugin/)
25+
26+
使用Gradle实现同样效果:
27+
```gradle
28+
springBoot {
29+
buildInfo()
30+
}
31+
```
32+
可以使用DSL添加其他属性:
33+
```gradle
34+
springBoot {
35+
buildInfo {
36+
additionalProperties = [
37+
'foo': 'bar'
38+
]
39+
}
40+
}
41+
```

0 commit comments

Comments
 (0)