From 10012cfddc5479ee9a5cbe98bfe4f76483965bd1 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 17 Mar 2016 16:58:08 +0100 Subject: [PATCH] Rename Maven plugin mojo Rename the goal from `generate-build-info` to `build-info` for consistency. See gh-2559 --- .../spring-boot-sample-actuator/pom.xml | 2 +- .../pom.xml | 4 +- .../main/java/org/test/SampleApplication.java | 0 .../verify.groovy | 2 +- .../pom.xml | 4 +- .../main/java/org/test/SampleApplication.java | 0 .../verify.groovy | 2 +- .../pom.xml | 4 +- .../main/java/org/test/SampleApplication.java | 0 .../verify.groovy | 2 +- ...eBuildInfoMojo.java => BuildInfoMojo.java} | 6 +- .../src/site/apt/examples/build-info.apt.vm | 56 +++++++++++++++++++ .../src/site/apt/index.apt | 6 ++ .../src/site/apt/usage.apt.vm | 2 + .../src/site/site.xml | 1 + 15 files changed, 78 insertions(+), 13 deletions(-) rename spring-boot-tools/spring-boot-maven-plugin/src/it/{generate-build-info-additional-properties => build-info-additional-properties}/pom.xml (92%) rename spring-boot-tools/spring-boot-maven-plugin/src/it/{generate-build-info-additional-properties => build-info-additional-properties}/src/main/java/org/test/SampleApplication.java (100%) rename spring-boot-tools/spring-boot-maven-plugin/src/it/{generate-build-info-additional-properties => build-info-additional-properties}/verify.groovy (78%) rename spring-boot-tools/spring-boot-maven-plugin/src/it/{generate-build-info-cutom-file => build-info-cutom-file}/pom.xml (93%) rename spring-boot-tools/spring-boot-maven-plugin/src/it/{generate-build-info-cutom-file => build-info-cutom-file}/src/main/java/org/test/SampleApplication.java (100%) rename spring-boot-tools/spring-boot-maven-plugin/src/it/{generate-build-info-cutom-file => build-info-cutom-file}/verify.groovy (69%) rename spring-boot-tools/spring-boot-maven-plugin/src/it/{generate-build-info => build-info}/pom.xml (93%) rename spring-boot-tools/spring-boot-maven-plugin/src/it/{generate-build-info => build-info}/src/main/java/org/test/SampleApplication.java (100%) rename spring-boot-tools/spring-boot-maven-plugin/src/it/{generate-build-info => build-info}/verify.groovy (73%) rename spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/{GenerateBuildInfoMojo.java => BuildInfoMojo.java} (95%) create mode 100644 spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/build-info.apt.vm diff --git a/spring-boot-samples/spring-boot-sample-actuator/pom.xml b/spring-boot-samples/spring-boot-sample-actuator/pom.xml index 2f4c08177a..19927cbe3b 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/pom.xml +++ b/spring-boot-samples/spring-boot-sample-actuator/pom.xml @@ -75,7 +75,7 @@ generate build info - generate-build-info + build-info diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-additional-properties/pom.xml b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-additional-properties/pom.xml similarity index 92% rename from spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-additional-properties/pom.xml rename to spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-additional-properties/pom.xml index a02e655ec9..0e13a548a4 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-additional-properties/pom.xml +++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-additional-properties/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.springframework.boot.maven.it - generate-build-info-additional-properties + build-info-additional-properties 0.0.1.BUILD-SNAPSHOT Generate build info @@ -18,7 +18,7 @@ - generate-build-info + build-info diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-additional-properties/src/main/java/org/test/SampleApplication.java b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-additional-properties/src/main/java/org/test/SampleApplication.java similarity index 100% rename from spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-additional-properties/src/main/java/org/test/SampleApplication.java rename to spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-additional-properties/src/main/java/org/test/SampleApplication.java diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-additional-properties/verify.groovy b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-additional-properties/verify.groovy similarity index 78% rename from spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-additional-properties/verify.groovy rename to spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-additional-properties/verify.groovy index fd0c4b364a..0334589ebd 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-additional-properties/verify.groovy +++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-additional-properties/verify.groovy @@ -6,7 +6,7 @@ import static org.junit.Assert.assertTrue def file = new File(basedir, "target/classes/META-INF/boot/build.properties") println file.getAbsolutePath() Properties properties = Verify.verifyBuildInfo(file, - 'org.springframework.boot.maven.it', 'generate-build-info-additional-properties', + 'org.springframework.boot.maven.it', 'build-info-additional-properties', 'Generate build info', '0.0.1.BUILD-SNAPSHOT') assertTrue properties.containsKey('build.time') assertEquals 'bar', properties.get('build.foo') diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-cutom-file/pom.xml b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-cutom-file/pom.xml similarity index 93% rename from spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-cutom-file/pom.xml rename to spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-cutom-file/pom.xml index 24f7106159..0b76eb3d5e 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-cutom-file/pom.xml +++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-cutom-file/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.springframework.boot.maven.it - generate-build-info-custom-file + build-info-custom-file 0.0.1.BUILD-SNAPSHOT Generate custom build info @@ -18,7 +18,7 @@ - generate-build-info + build-info ${project.build.directory}/build.info diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-cutom-file/src/main/java/org/test/SampleApplication.java b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-cutom-file/src/main/java/org/test/SampleApplication.java similarity index 100% rename from spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-cutom-file/src/main/java/org/test/SampleApplication.java rename to spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-cutom-file/src/main/java/org/test/SampleApplication.java diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-cutom-file/verify.groovy b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-cutom-file/verify.groovy similarity index 69% rename from spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-cutom-file/verify.groovy rename to spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-cutom-file/verify.groovy index 97ef5521f8..833ae504a1 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info-cutom-file/verify.groovy +++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info-cutom-file/verify.groovy @@ -5,6 +5,6 @@ import static org.junit.Assert.assertTrue def file = new File(basedir, "target/build.info") println file.getAbsolutePath() Properties properties = Verify.verifyBuildInfo(file, - 'org.springframework.boot.maven.it', 'generate-build-info-custom-file', + 'org.springframework.boot.maven.it', 'build-info-custom-file', 'Generate custom build info', '0.0.1.BUILD-SNAPSHOT') assertTrue properties.containsKey('build.time') \ No newline at end of file diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info/pom.xml b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info/pom.xml similarity index 93% rename from spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info/pom.xml rename to spring-boot-tools/spring-boot-maven-plugin/src/it/build-info/pom.xml index cec8f5ca22..00fef8d016 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info/pom.xml +++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.springframework.boot.maven.it - generate-build-info + build-info 0.0.1.BUILD-SNAPSHOT Generate build info @@ -18,7 +18,7 @@ - generate-build-info + build-info diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info/src/main/java/org/test/SampleApplication.java b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info/src/main/java/org/test/SampleApplication.java similarity index 100% rename from spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info/src/main/java/org/test/SampleApplication.java rename to spring-boot-tools/spring-boot-maven-plugin/src/it/build-info/src/main/java/org/test/SampleApplication.java diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info/verify.groovy b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info/verify.groovy similarity index 73% rename from spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info/verify.groovy rename to spring-boot-tools/spring-boot-maven-plugin/src/it/build-info/verify.groovy index e7e477e908..81d248ce7b 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/it/generate-build-info/verify.groovy +++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/build-info/verify.groovy @@ -5,6 +5,6 @@ import static org.junit.Assert.assertTrue def file = new File(basedir, "target/classes/META-INF/boot/build.properties") println file.getAbsolutePath() Properties properties = Verify.verifyBuildInfo(file, - 'org.springframework.boot.maven.it', 'generate-build-info', + 'org.springframework.boot.maven.it', 'build-info', 'Generate build info', '0.0.1.BUILD-SNAPSHOT') assertTrue properties.containsKey('build.time') \ No newline at end of file diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/GenerateBuildInfoMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildInfoMojo.java similarity index 95% rename from spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/GenerateBuildInfoMojo.java rename to spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildInfoMojo.java index 7c4c5602c3..a3f4ab1691 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/GenerateBuildInfoMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildInfoMojo.java @@ -34,13 +34,13 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; /** - * Generate a {@code build.properties} file based the content of the {@link MavenProject}. + * Generate a {@code build.properties} file based the content of the current {@link MavenProject}. * * @author Stephane Nicoll * @since 1.4.0 */ -@Mojo(name = "generate-build-info", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true) -public class GenerateBuildInfoMojo extends AbstractMojo { +@Mojo(name = "build-info", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true) +public class BuildInfoMojo extends AbstractMojo { /** * The Maven project. diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/build-info.apt.vm b/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/build-info.apt.vm new file mode 100644 index 0000000000..477ef10ab4 --- /dev/null +++ b/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/build-info.apt.vm @@ -0,0 +1,56 @@ + ----- + Generate build information + ----- + Stephane Nicoll + ----- + 2016-03-17 + ----- + + Spring Boot Actuator displays build-related information if a <<>> + file is present. The <<>> goal generates such file with the coordinates of the project + and the build time. It also allows you to add an arbitrary number of additional properties: + +--- + + ... + + ... + + ... + + ${project.groupId} + ${project.artifactId} + ${project.version} + + + + build-info + + + + UTF-8 + UTF-8 + ${maven.compiler.source} + ${maven.compiler.target} + + + + + ... + + ... + + ... + + ... + +--- + + This configuration will generate a <<>> at the expected location with four + additional keys. Note that <<>> and <<>> are + expected to be regular properties available in the project. They will be interpolated as you + would expect. + + + + diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt b/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt index f52a3654bb..dcf5084405 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt +++ b/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt @@ -22,6 +22,10 @@ Spring Boot Maven Plugin * {{{./start-mojo.html}spring-boot:start}} and {{{./stop-mojo.html}spring-boot:stop}} to manage the lifecycle of your Spring Boot application (i.e. for integration tests). + * {{{./build-info-mojo.html}spring-boot:build-info}} generates build information that can be used + by the Actuator. + + * Usage @@ -52,6 +56,8 @@ Spring Boot Maven Plugin * {{{./examples/run-profiles.html}Specify active profiles}} + * {{{./examples/build-info.html}Generate build information}} + [] diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/usage.apt.vm b/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/usage.apt.vm index 44f96101dd..28fa008459 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/usage.apt.vm +++ b/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/usage.apt.vm @@ -19,6 +19,8 @@ Usage * <<>> and <<>>: integrate your Spring Boot application to the <<>> phase so that the application starts before it. + * <<>>: generate a build information that can be used by the Actuator. + [] Each goal is further described below. diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml b/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml index 0d27faaed2..0975cc901d 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml +++ b/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml @@ -13,6 +13,7 @@ +