Skip to content

Commit 09e5aee

Browse files
authored
Update 80.10 Build an executable archive from Ant without using spring-boot-antlib.md
1 parent 7fceaca commit 09e5aee

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

IX. ‘How-to’ guides/80.10 Build an executable archive from Ant without using spring-boot-antlib.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,30 @@
1111
示例:
1212
```xml
1313
<target name="build" depends="compile">
14-
<copy todir="target/classes/lib">
15-
<fileset dir="lib/runtime" />
16-
</copy>
17-
<jar destfile="target/spring-boot-sample-actuator-${spring-boot.version}.jar" compress="false">
18-
<fileset dir="target/classes" />
19-
<fileset dir="src/main/resources" />
20-
<zipfileset src="lib/loader/spring-boot-loader-jar-${spring-boot.version}.jar" />
14+
<jar destfile="target/${ant.project.name}-${spring-boot.version}.jar" compress="false">
15+
<mappedresources>
16+
<fileset dir="target/classes" />
17+
<globmapper from="*" to="BOOT-INF/classes/*"/>
18+
</mappedresources>
19+
<mappedresources>
20+
<fileset dir="src/main/resources" erroronmissingdir="false"/>
21+
<globmapper from="*" to="BOOT-INF/classes/*"/>
22+
</mappedresources>
23+
<mappedresources>
24+
<fileset dir="${lib.dir}/runtime" />
25+
<globmapper from="*" to="BOOT-INF/lib/*"/>
26+
</mappedresources>
27+
<zipfileset src="${lib.dir}/loader/spring-boot-loader-jar-${spring-boot.version}.jar" />
2128
<manifest>
2229
<attribute name="Main-Class" value="org.springframework.boot.loader.JarLauncher" />
2330
<attribute name="Start-Class" value="${start-class}" />
2431
</manifest>
2532
</jar>
2633
</target>
2734
```
28-
该Actuator示例中有一个build.xml文件,可以使用以下命令来运行:
35+
[Ant示例](https://github.com/spring-projects/spring-boot/tree/v1.4.1.RELEASE/spring-boot-samples/spring-boot-sample-ant)中有一个`build.xml`文件及`manual`任务,可以使用以下命令来运行:
2936
```shell
30-
$ ant -lib <path_to>/ivy-2.2.jar
37+
$ ant -lib <folder containing ivy-2.2.jar> clean manual
3138
```
3239
在上述操作之后,你可以使用以下命令运行该应用:
3340
```shell

0 commit comments

Comments
 (0)