parent
ae4559eb4f
commit
da82f08692
@ -1,48 +0,0 @@
|
|||||||
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="spring-boot-sample-actuator" default="build">
|
|
||||||
|
|
||||||
<description>
|
|
||||||
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'.
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<property name="spring-boot.version" value="1.3.0.BUILD-SNAPSHOT" />
|
|
||||||
<property name="start-class" value="org.springframework.boot.sample.actuator.SampleActuatorApplication" />
|
|
||||||
|
|
||||||
<target name="resolve" description="--> retrieve dependencies with ivy">
|
|
||||||
<ivy:retrieve pattern="lib/[conf]/[artifact]-[type]-[revision].[ext]" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="classpaths" depends="resolve">
|
|
||||||
<path id="compile.classpath">
|
|
||||||
<fileset dir="lib/compile" includes="*.jar" />
|
|
||||||
</path>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="init" depends="classpaths">
|
|
||||||
<mkdir dir="target/classes" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="compile" depends="init" description="compile">
|
|
||||||
<javac srcdir="src/main/java" destdir="target/classes" classpathref="compile.classpath" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="clean" description="cleans all class files">
|
|
||||||
<delete dir="target/classes" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build" depends="compile">
|
|
||||||
<copy todir="target/classes/lib">
|
|
||||||
<fileset dir="lib/runtime" />
|
|
||||||
</copy>
|
|
||||||
<jar destfile="target/spring-boot-sample-actuator-${spring-boot.version}.jar" compress="false">
|
|
||||||
<fileset dir="target/classes" />
|
|
||||||
<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>
|
|
||||||
|
|
||||||
</project>
|
|
@ -0,0 +1,50 @@
|
|||||||
|
<project
|
||||||
|
xmlns:ivy="antlib:org.apache.ivy.ant"
|
||||||
|
xmlns:spring-boot="antlib:org.springframework.boot.ant"
|
||||||
|
name="spring-boot-sample-ant"
|
||||||
|
default="build">
|
||||||
|
|
||||||
|
<description>
|
||||||
|
Sample ANT build script for a Spring Boot executable JAR project. Uses ivy for
|
||||||
|
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>
|
||||||
|
|
||||||
|
<property name="spring-boot.version" value="1.3.0.BUILD-SNAPSHOT" />
|
||||||
|
<property name="lib.dir" location="${basedir}/target/lib" />
|
||||||
|
|
||||||
|
<target name="resolve" description="--> retrieve dependencies with ivy">
|
||||||
|
<ivy:retrieve pattern="${lib.dir}/[conf]/[artifact]-[type]-[revision].[ext]" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="classpaths" depends="resolve">
|
||||||
|
<path id="compile.classpath">
|
||||||
|
<fileset dir="${lib.dir}/compile" includes="*.jar" />
|
||||||
|
</path>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="init" depends="classpaths">
|
||||||
|
<mkdir dir="target/classes" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="compile" depends="init" description="compile">
|
||||||
|
<javac srcdir="src/main/java" destdir="target/classes" classpathref="compile.classpath" />
|
||||||
|
</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">
|
||||||
|
<delete dir="target/classes" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="build" depends="compile">
|
||||||
|
<spring-boot:exejar destfile="target/${ant.project.name}-${spring-boot.version}.jar" classes="target/classes">
|
||||||
|
<spring-boot:lib>
|
||||||
|
<fileset dir="${lib.dir}/runtime" />
|
||||||
|
</spring-boot:lib>
|
||||||
|
</spring-boot:exejar>
|
||||||
|
</target>
|
||||||
|
</project>
|
@ -1,13 +1,10 @@
|
|||||||
<ivy-module version="2.0">
|
<ivy-module version="2.0">
|
||||||
<info organisation="org.springframework.boot" module="spring-boot-sample-actuator" />
|
<info organisation="org.springframework.boot" module="spring-boot-sample-ant" />
|
||||||
<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>
|
@ -1,11 +1,11 @@
|
|||||||
<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" />
|
@ -0,0 +1,105 @@
|
|||||||
|
<?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>
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* 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"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
name: Phil
|
Loading…
Reference in New Issue