Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
da82f086
Commit
da82f086
authored
Jun 30, 2015
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create Apache Ant sample
See gh-3339
parent
ae4559eb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
255 additions
and
8 deletions
+255
-8
pom.xml
spring-boot-samples/pom.xml
+1
-0
build.xml
spring-boot-samples/spring-boot-sample-ant/build.xml
+50
-0
ivy.xml
spring-boot-samples/spring-boot-sample-ant/ivy.xml
+2
-5
ivysettings.xml
spring-boot-samples/spring-boot-sample-ant/ivysettings.xml
+3
-3
pom.xml
spring-boot-samples/spring-boot-sample-ant/pom.xml
+105
-0
SampleAntApplication.java
...le-ant/src/main/java/sample/ant/SampleAntApplication.java
+35
-0
SampleAntApplicationIT.java
...-ant/src/test/java/sample/ant/SampleAntApplicationIT.java
+58
-0
application.properties
...boot-sample-ant/src/test/resources/application.properties
+1
-0
No files found.
spring-boot-samples/pom.xml
View file @
da82f086
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
<main.basedir>
${basedir}/..
</main.basedir>
<main.basedir>
${basedir}/..
</main.basedir>
</properties>
</properties>
<modules>
<modules>
<module>
spring-boot-sample-ant
</module>
<module>
spring-boot-sample-activemq
</module>
<module>
spring-boot-sample-activemq
</module>
<module>
spring-boot-sample-actuator
</module>
<module>
spring-boot-sample-actuator
</module>
<module>
spring-boot-sample-actuator-log4j
</module>
<module>
spring-boot-sample-actuator-log4j
</module>
...
...
spring-boot-samples/spring-boot-sample-a
ctuator
/build.xml
→
spring-boot-samples/spring-boot-sample-a
nt
/build.xml
View file @
da82f086
<project
xmlns:ivy=
"antlib:org.apache.ivy.ant"
name=
"spring-boot-sample-actuator"
default=
"build"
>
<project
xmlns:ivy=
"antlib:org.apache.ivy.ant"
xmlns:spring-boot=
"antlib:org.springframework.boot.ant"
name=
"spring-boot-sample-ant"
default=
"build"
>
<description>
<description>
Sample ANT build script for a Spring Boot executable JAR project. Uses ivy for dependency management so run with
Sample ANT build script for a Spring Boot executable JAR project. Uses ivy for
'$ ant -lib ivy-2.2.jar' (substitute the location of your actual ivy jar). Run with '$ java -jar target/*.jar'.
dependency management and spring-boot-antlib for additional tasks. Run with
'$ ant -lib ivy-2.2.jar spring-boot-antlib.jar' (substitute the location of your
actual jars). Run with '$ java -jar target/*.jar'.
</description>
</description>
<property
name=
"spring-boot.version"
value=
"1.3.0.BUILD-SNAPSHOT"
/>
<property
name=
"spring-boot.version"
value=
"1.3.0.BUILD-SNAPSHOT"
/>
<property
name=
"
start-class"
value=
"org.springframework.boot.sample.actuator.SampleActuatorApplication
"
/>
<property
name=
"
lib.dir"
location=
"${basedir}/target/lib
"
/>
<target
name=
"resolve"
description=
"--> retrieve dependencies with ivy"
>
<target
name=
"resolve"
description=
"--> retrieve dependencies with ivy"
>
<ivy:retrieve
pattern=
"
lib
/[conf]/[artifact]-[type]-[revision].[ext]"
/>
<ivy:retrieve
pattern=
"
${lib.dir}
/[conf]/[artifact]-[type]-[revision].[ext]"
/>
</target>
</target>
<target
name=
"classpaths"
depends=
"resolve"
>
<target
name=
"classpaths"
depends=
"resolve"
>
<path
id=
"compile.classpath"
>
<path
id=
"compile.classpath"
>
<fileset
dir=
"
lib
/compile"
includes=
"*.jar"
/>
<fileset
dir=
"
${lib.dir}
/compile"
includes=
"*.jar"
/>
</path>
</path>
</target>
</target>
...
@@ -26,23 +32,19 @@
...
@@ -26,23 +32,19 @@
<javac
srcdir=
"src/main/java"
destdir=
"target/classes"
classpathref=
"compile.classpath"
/>
<javac
srcdir=
"src/main/java"
destdir=
"target/classes"
classpathref=
"compile.classpath"
/>
</target>
</target>
<target
name=
"clean-all"
description=
"cleans all created files/dirs"
depends=
"clean"
>
<delete
dir=
"${lib.dir}"
/>
</target>
<target
name=
"clean"
description=
"cleans all class files"
>
<target
name=
"clean"
description=
"cleans all class files"
>
<delete
dir=
"target/classes"
/>
<delete
dir=
"target/classes"
/>
</target>
</target>
<target
name=
"build"
depends=
"compile"
>
<target
name=
"build"
depends=
"compile"
>
<copy
todir=
"target/classes/lib"
>
<spring-boot:exejar
destfile=
"target/${ant.project.name}-${spring-boot.version}.jar"
classes=
"target/classes"
>
<fileset
dir=
"lib/runtime"
/>
<spring-boot:lib>
</copy>
<fileset
dir=
"${lib.dir}/runtime"
/>
<jar
destfile=
"target/spring-boot-sample-actuator-${spring-boot.version}.jar"
compress=
"false"
>
</spring-boot:lib>
<fileset
dir=
"target/classes"
/>
</spring-boot:exejar>
<fileset
dir=
"src/main/resources"
/>
<zipfileset
src=
"lib/loader/spring-boot-loader-jar-${spring-boot.version}.jar"
/>
<manifest>
<attribute
name=
"Main-Class"
value=
"org.springframework.boot.loader.JarLauncher"
/>
<attribute
name=
"Start-Class"
value=
"${start-class}"
/>
</manifest>
</jar>
</target>
</target>
</project>
</project>
\ No newline at end of file
spring-boot-samples/spring-boot-sample-a
ctuator
/ivy.xml
→
spring-boot-samples/spring-boot-sample-a
nt
/ivy.xml
View file @
da82f086
<ivy-module
version=
"2.0"
>
<ivy-module
version=
"2.0"
>
<info
organisation=
"org.springframework.boot"
module=
"spring-boot-sample-a
ctuator
"
/>
<info
organisation=
"org.springframework.boot"
module=
"spring-boot-sample-a
nt
"
/>
<configurations>
<configurations>
<conf
name=
"loader"
description=
"helpers added to final jar"
/>
<conf
name=
"compile"
description=
"everything needed to compile this module"
/>
<conf
name=
"compile"
description=
"everything needed to compile this module"
/>
<conf
name=
"runtime"
extends=
"compile"
description=
"everything needed to run this module"
/>
<conf
name=
"runtime"
extends=
"compile"
description=
"everything needed to run this module"
/>
</configurations>
</configurations>
<dependencies>
<dependencies>
<dependency
org=
"org.springframework.boot"
name=
"spring-boot-loader"
rev=
"1.0.0.BUILD-SNAPSHOT"
conf=
"loader->default"
/>
<dependency
org=
"org.springframework.boot"
name=
"spring-boot-starter"
rev=
"${spring-boot.version}"
conf=
"compile"
/>
<dependency
org=
"org.springframework.boot"
name=
"spring-boot-starter-web"
rev=
"1.0.0.BUILD-SNAPSHOT"
conf=
"compile"
/>
<dependency
org=
"org.springframework.boot"
name=
"spring-boot-starter-actuator"
rev=
"1.0.0.BUILD-SNAPSHOT"
conf=
"runtime"
/>
</dependencies>
</dependencies>
</ivy-module>
</ivy-module>
spring-boot-samples/spring-boot-sample-a
ctuator
/ivysettings.xml
→
spring-boot-samples/spring-boot-sample-a
nt
/ivysettings.xml
View file @
da82f086
<ivysettings>
<ivysettings>
<settings
defaultResolver=
"chain"
/>
<settings
defaultResolver=
"chain"
/>
<resolvers>
<resolvers>
<chain
name=
"chain"
>
<chain
name=
"chain"
returnFirst=
"true"
>
<!-- NOTE: You should declare only repositories that you need here -->
<!-- NOTE: You should declare only repositories that you need here -->
<filesystem
name=
"local"
local=
"true"
m2compatible=
"true"
>
<filesystem
name=
"local"
local=
"true"
m2compatible=
"true"
>
<artifact
pattern=
"${user.home}/.m2/[organisation]/[module]/[revision]/[module]-[revision].[ext]"
/>
<artifact
pattern=
"${user.home}/.m2/
repository/
[organisation]/[module]/[revision]/[module]-[revision].[ext]"
/>
<ivy
pattern=
"${user.home}/.m2/[organisation]/[module]/[revision]/[module]-[revision].pom"
/>
<ivy
pattern=
"${user.home}/.m2/
repository/
[organisation]/[module]/[revision]/[module]-[revision].pom"
/>
</filesystem>
</filesystem>
<ibiblio
name=
"ibiblio"
m2compatible=
"true"
/>
<ibiblio
name=
"ibiblio"
m2compatible=
"true"
/>
<ibiblio
name=
"spring-milestones"
m2compatible=
"true"
root=
"http://repo.spring.io/release"
/>
<ibiblio
name=
"spring-milestones"
m2compatible=
"true"
root=
"http://repo.spring.io/release"
/>
...
...
spring-boot-samples/spring-boot-sample-ant/pom.xml
0 → 100644
View file @
da82f086
<?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"
>
<!-- This POM is just to trigger the Ant/Ivy sample from Maven and to test -->
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-samples
</artifactId>
<version>
1.3.0.BUILD-SNAPSHOT
</version>
</parent>
<artifactId>
spring-boot-sample-ant
</artifactId>
<name>
Spring Boot Ant Sample
</name>
<description>
Spring Boot Ant Sample
</description>
<url>
http://projects.spring.io/spring-boot/
</url>
<organization>
<name>
Pivotal Software, Inc.
</name>
<url>
http://www.spring.io
</url>
</organization>
<properties>
<main.basedir>
${basedir}/../..
</main.basedir>
<ant.version>
1.9.3
</ant.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-loader-tools
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-antlib
</artifactId>
<version>
${spring-boot.version}
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<executions>
<execution>
<id>
default-compile
</id>
<phase>
none
</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-antrun-plugin
</artifactId>
<executions>
<execution>
<id>
antbuild
</id>
<phase>
package
</phase>
<configuration>
<target>
<property
name=
"build.compiler"
value=
"extJavac"
/>
<ant
dir=
"${basedir}"
/>
</target>
</configuration>
<goals>
<goal>
run
</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>
org.apache.ant
</groupId>
<artifactId>
ant
</artifactId>
<version>
${ant.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.ivy
</groupId>
<artifactId>
ivy
</artifactId>
<version>
2.4.0
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-antlib
</artifactId>
<version>
${spring-boot.version}
</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-failsafe-plugin
</artifactId>
<executions>
<execution>
<goals>
<goal>
integration-test
</goal>
<goal>
verify
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
spring-boot-samples/spring-boot-sample-ant/src/main/java/sample/ant/SampleAntApplication.java
0 → 100644
View file @
da82f086
/*
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
.
ant
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
SampleAntApplication
implements
CommandLineRunner
{
@Override
public
void
run
(
String
...
args
)
{
System
.
out
.
println
(
"Spring Boot Ant Example"
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SpringApplication
.
run
(
SampleAntApplication
.
class
,
args
);
}
}
spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java
0 → 100644
View file @
da82f086
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
.
ant
;
import
static
org
.
hamcrest
.
Matchers
.*;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
java.io.File
;
import
java.io.FileFilter
;
import
java.io.InputStreamReader
;
import
java.util.concurrent.TimeUnit
;
import
org.junit.Test
;
import
org.springframework.boot.loader.tools.JavaExecutable
;
import
org.springframework.util.FileCopyUtils
;
/**
* Integration Tests for {@code SampleAntApplication}.
*
* @author Dave Syer
* @author Phillip Webb
*/
public
class
SampleAntApplicationIT
{
@Test
public
void
runJar
()
throws
Exception
{
File
target
=
new
File
(
"target"
);
File
[]
jarFiles
=
target
.
listFiles
(
new
FileFilter
()
{
@Override
public
boolean
accept
(
File
file
)
{
return
file
.
getName
().
endsWith
(
".jar"
);
}
});
assertThat
(
"Number of jars"
,
jarFiles
.
length
,
equalTo
(
1
));
Process
process
=
new
JavaExecutable
().
processBuilder
(
"-jar"
,
jarFiles
[
0
].
getName
()).
directory
(
target
).
start
();
process
.
waitFor
(
5
,
TimeUnit
.
MINUTES
);
assertThat
(
process
.
exitValue
(),
equalTo
(
0
));
String
output
=
FileCopyUtils
.
copyToString
(
new
InputStreamReader
(
process
.
getInputStream
()));
assertThat
(
output
,
containsString
(
"Spring Boot Ant Example"
));
}
}
spring-boot-samples/spring-boot-sample-ant/src/test/resources/application.properties
0 → 100644
View file @
da82f086
name
:
Phil
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment