Rename Maven plugin mojo

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

See gh-2559
pull/3799/merge
Stephane Nicoll 9 years ago
parent 9c733128ac
commit 10012cfddc

@ -75,7 +75,7 @@
<execution>
<id>generate build info</id>
<goals>
<goal>generate-build-info</goal>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>

@ -3,7 +3,7 @@
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>
<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>
<name>Generate build info</name>
<properties>
@ -18,7 +18,7 @@
<executions>
<execution>
<goals>
<goal>generate-build-info</goal>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>

@ -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')

@ -3,7 +3,7 @@
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>
<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>
<name>Generate custom build info</name>
<properties>
@ -18,7 +18,7 @@
<executions>
<execution>
<goals>
<goal>generate-build-info</goal>
<goal>build-info</goal>
</goals>
<configuration>
<outputFile>${project.build.directory}/build.info</outputFile>

@ -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')

@ -3,7 +3,7 @@
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>
<groupId>org.springframework.boot.maven.it</groupId>
<artifactId>generate-build-info</artifactId>
<artifactId>build-info</artifactId>
<version>0.0.1.BUILD-SNAPSHOT</version>
<name>Generate build info</name>
<properties>
@ -18,7 +18,7 @@
<executions>
<execution>
<goals>
<goal>generate-build-info</goal>
<goal>build-info</goal>
</goals>
</execution>
</executions>

@ -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')

@ -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.

@ -0,0 +1,56 @@
-----
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
* {{{./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}}
[]

@ -19,6 +19,8 @@ Usage
* <<<start>>> and <<<stop>>>: integrate your Spring Boot application to the <<<integration-test>>> phase so that
the application starts before it.
* <<<build-info>>>: generate a build information that can be used by the Actuator.
[]
Each goal is further described below.

@ -13,6 +13,7 @@
<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="Specify active profiles" href="examples/run-profiles.html"/>
<item name="Generate build information" href="examples/build-info.html"/>
</menu>
<menu ref="reports"/>
</body>

Loading…
Cancel
Save