Commit 10012cfd authored by Stephane Nicoll's avatar Stephane Nicoll

Rename Maven plugin mojo

Rename the goal from `generate-build-info` to `build-info` for consistency.

See gh-2559
parent 9c733128
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<execution> <execution>
<id>generate build info</id> <id>generate build info</id>
<goals> <goals>
<goal>generate-build-info</goal> <goal>build-info</goal>
</goals> </goals>
<configuration> <configuration>
<additionalProperties> <additionalProperties>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.boot.maven.it</groupId> <groupId>org.springframework.boot.maven.it</groupId>
<artifactId>generate-build-info-additional-properties</artifactId> <artifactId>build-info-additional-properties</artifactId>
<version>0.0.1.BUILD-SNAPSHOT</version> <version>0.0.1.BUILD-SNAPSHOT</version>
<name>Generate build info</name> <name>Generate build info</name>
<properties> <properties>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<executions> <executions>
<execution> <execution>
<goals> <goals>
<goal>generate-build-info</goal> <goal>build-info</goal>
</goals> </goals>
<configuration> <configuration>
<additionalProperties> <additionalProperties>
......
...@@ -6,7 +6,7 @@ import static org.junit.Assert.assertTrue ...@@ -6,7 +6,7 @@ import static org.junit.Assert.assertTrue
def file = new File(basedir, "target/classes/META-INF/boot/build.properties") def file = new File(basedir, "target/classes/META-INF/boot/build.properties")
println file.getAbsolutePath() println file.getAbsolutePath()
Properties properties = Verify.verifyBuildInfo(file, 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') 'Generate build info', '0.0.1.BUILD-SNAPSHOT')
assertTrue properties.containsKey('build.time') assertTrue properties.containsKey('build.time')
assertEquals 'bar', properties.get('build.foo') assertEquals 'bar', properties.get('build.foo')
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.boot.maven.it</groupId> <groupId>org.springframework.boot.maven.it</groupId>
<artifactId>generate-build-info-custom-file</artifactId> <artifactId>build-info-custom-file</artifactId>
<version>0.0.1.BUILD-SNAPSHOT</version> <version>0.0.1.BUILD-SNAPSHOT</version>
<name>Generate custom build info</name> <name>Generate custom build info</name>
<properties> <properties>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<executions> <executions>
<execution> <execution>
<goals> <goals>
<goal>generate-build-info</goal> <goal>build-info</goal>
</goals> </goals>
<configuration> <configuration>
<outputFile>${project.build.directory}/build.info</outputFile> <outputFile>${project.build.directory}/build.info</outputFile>
......
...@@ -5,6 +5,6 @@ import static org.junit.Assert.assertTrue ...@@ -5,6 +5,6 @@ import static org.junit.Assert.assertTrue
def file = new File(basedir, "target/build.info") def file = new File(basedir, "target/build.info")
println file.getAbsolutePath() println file.getAbsolutePath()
Properties properties = Verify.verifyBuildInfo(file, 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') 'Generate custom build info', '0.0.1.BUILD-SNAPSHOT')
assertTrue properties.containsKey('build.time') assertTrue properties.containsKey('build.time')
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.boot.maven.it</groupId> <groupId>org.springframework.boot.maven.it</groupId>
<artifactId>generate-build-info</artifactId> <artifactId>build-info</artifactId>
<version>0.0.1.BUILD-SNAPSHOT</version> <version>0.0.1.BUILD-SNAPSHOT</version>
<name>Generate build info</name> <name>Generate build info</name>
<properties> <properties>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<executions> <executions>
<execution> <execution>
<goals> <goals>
<goal>generate-build-info</goal> <goal>build-info</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
......
...@@ -5,6 +5,6 @@ import static org.junit.Assert.assertTrue ...@@ -5,6 +5,6 @@ import static org.junit.Assert.assertTrue
def file = new File(basedir, "target/classes/META-INF/boot/build.properties") def file = new File(basedir, "target/classes/META-INF/boot/build.properties")
println file.getAbsolutePath() println file.getAbsolutePath()
Properties properties = Verify.verifyBuildInfo(file, 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') 'Generate build info', '0.0.1.BUILD-SNAPSHOT')
assertTrue properties.containsKey('build.time') assertTrue properties.containsKey('build.time')
\ No newline at end of file
...@@ -34,13 +34,13 @@ import org.apache.maven.plugins.annotations.Parameter; ...@@ -34,13 +34,13 @@ import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject; 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 * @author Stephane Nicoll
* @since 1.4.0 * @since 1.4.0
*/ */
@Mojo(name = "generate-build-info", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true) @Mojo(name = "build-info", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true)
public class GenerateBuildInfoMojo extends AbstractMojo { public class BuildInfoMojo extends AbstractMojo {
/** /**
* The Maven project. * The Maven project.
......
-----
Generate build information
-----
Stephane Nicoll
-----
2016-03-17
-----
Spring Boot Actuator displays build-related information if a <<<META-INF/boot/build.properties>>>
file is present. The <<<build-info>>> 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>
...
<build>
...
<plugins>
...
<plugin>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<encoding.source>UTF-8</encoding.source>
<encoding.reporting>UTF-8</encoding.reporting>
<java.source>${maven.compiler.source}</java.source>
<java.target>${maven.compiler.target}</java.target>
</additionalProperties>
</configuration>
</execution>
</executions>
...
</plugin>
...
</plugins>
...
</build>
...
</project>
---
This configuration will generate a <<<build.properties>>> at the expected location with four
additional keys. Note that <<<maven.compiler.source>>> and <<<maven.compiler.target>>> are
expected to be regular properties available in the project. They will be interpolated as you
would expect.
...@@ -22,6 +22,10 @@ Spring Boot Maven Plugin ...@@ -22,6 +22,10 @@ Spring Boot Maven Plugin
* {{{./start-mojo.html}spring-boot:start}} and {{{./stop-mojo.html}spring-boot:stop}} to manage * {{{./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). 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 * Usage
...@@ -52,6 +56,8 @@ Spring Boot Maven Plugin ...@@ -52,6 +56,8 @@ Spring Boot Maven Plugin
* {{{./examples/run-profiles.html}Specify active profiles}} * {{{./examples/run-profiles.html}Specify active profiles}}
* {{{./examples/build-info.html}Generate build information}}
[] []
......
...@@ -19,6 +19,8 @@ Usage ...@@ -19,6 +19,8 @@ Usage
* <<<start>>> and <<<stop>>>: integrate your Spring Boot application to the <<<integration-test>>> phase so that * <<<start>>> and <<<stop>>>: integrate your Spring Boot application to the <<<integration-test>>> phase so that
the application starts before it. the application starts before it.
* <<<build-info>>>: generate a build information that can be used by the Actuator.
[] []
Each goal is further described below. Each goal is further described below.
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<item name="Debug the application" href="examples/run-debug.html"/> <item name="Debug the application" href="examples/run-debug.html"/>
<item name="Random port for integration tests" href="examples/it-random-port.html"/> <item name="Random port for integration tests" href="examples/it-random-port.html"/>
<item name="Specify active profiles" href="examples/run-profiles.html"/> <item name="Specify active profiles" href="examples/run-profiles.html"/>
<item name="Generate build information" href="examples/build-info.html"/>
</menu> </menu>
<menu ref="reports"/> <menu ref="reports"/>
</body> </body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment