From f5ad4be2c133d2b2165d3d4c258dee663869dd2e Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 23 Dec 2013 11:14:15 +0000 Subject: [PATCH] Add basic build.xml to actuator sample $ ant -lib ivy-2.2.jar (substitute the location of your actual ivy jar) $ java -jar target/*.jar Fixes gh-140 --- .gitignore | 1 + docs/howto.md | 44 +++++++++++++++++ .../spring-boot-sample-actuator/build.xml | 48 +++++++++++++++++++ .../spring-boot-sample-actuator/ivy.xml | 13 +++++ .../ivysettings.xml | 16 +++++++ 5 files changed, 122 insertions(+) create mode 100644 spring-boot-samples/spring-boot-sample-actuator/build.xml create mode 100644 spring-boot-samples/spring-boot-sample-actuator/ivy.xml create mode 100644 spring-boot-samples/spring-boot-sample-actuator/ivysettings.xml diff --git a/.gitignore b/.gitignore index 29b287eb60..dc9fe73105 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ .settings bin build +lib/ target .springBeans dependency-reduced-pom.xml diff --git a/docs/howto.md b/docs/howto.md index a230a18f7c..3f4a1424fe 100644 --- a/docs/howto.md +++ b/docs/howto.md @@ -843,3 +843,47 @@ To do the same thing with properties files you can use `application-${profile}.properties` to specify profile-specific values. +## Build An Executable Archive with Ant + +To build with Ant you need to grab dependencies and compile and then +create a JAR or WAR archive as normal. To make it executable: + +1. Use the appropriate launcher as a `Main-Class`, +e.g. `org.springframework.boot.loader.JarLauncher` for a JAR file, and +specify the other stuff it needs as manifest entries, principally a +`Start-Class`. + +2. Add the runtime dependencies in a nested "lib" directory (for a +JAR) and the "provided" (embedded container) dependencies in a nested +"lib-provided" directory. Remember *not* to compress the entries in +the archive. + +3. Add the `spring-boot-loader` classes at the root of the archive (so +the `Main-Class` is available). + +Example + + + + + + + + + + + + + + + + +The [Actuator Sample]() has a `build.xml` that should work if you run +it with + + $ ant -lib /ivy-2.2.jar + +after which you can run the application with + + $ java -jar target/*.jar + diff --git a/spring-boot-samples/spring-boot-sample-actuator/build.xml b/spring-boot-samples/spring-boot-sample-actuator/build.xml new file mode 100644 index 0000000000..cac3fb1078 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-actuator/build.xml @@ -0,0 +1,48 @@ + + + + Sample ANT build script for a Spring Boot executable JAR project. Uses ivy for dependency management so run with + '$ ant -lib ivy-2.2.jar' (substitute the location of your actual ivy jar). Run with '$ java -jar target/*.jar'. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-actuator/ivy.xml b/spring-boot-samples/spring-boot-sample-actuator/ivy.xml new file mode 100644 index 0000000000..e60dfcbd96 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-actuator/ivy.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-actuator/ivysettings.xml b/spring-boot-samples/spring-boot-sample-actuator/ivysettings.xml new file mode 100644 index 0000000000..864f970126 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-actuator/ivysettings.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + \ No newline at end of file