Skip to content

Commit d69364c

Browse files
committed
Merge pull request #7741 from ArloL/fix-7701
* pr/7741: Notify BuildContext of changed build-info file
2 parents 8baac23 + 3a70951 commit d69364c

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

spring-boot-parent/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@
222222
<artifactId>kotlin-runtime</artifactId>
223223
<version>1.0.4</version>
224224
</dependency>
225+
<dependency>
226+
<groupId>org.sonatype.plexus</groupId>
227+
<artifactId>plexus-build-api</artifactId>
228+
<version>0.0.7</version>
229+
</dependency>
225230
<dependency>
226231
<groupId>org.zeroturnaround</groupId>
227232
<artifactId>zt-zip</artifactId>

spring-boot-tools/spring-boot-maven-plugin/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@
170170
<groupId>org.codehaus.plexus</groupId>
171171
<artifactId>plexus-utils</artifactId>
172172
</dependency>
173+
<dependency>
174+
<groupId>org.sonatype.plexus</groupId>
175+
<artifactId>plexus-build-api</artifactId>
176+
</dependency>
173177
<!-- Optional -->
174178
<dependency>
175179
<groupId>org.apache.maven.plugins</groupId>

spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildInfoMojo.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
import org.apache.maven.plugin.AbstractMojo;
2323
import org.apache.maven.plugin.MojoExecutionException;
2424
import org.apache.maven.plugin.MojoFailureException;
25+
import org.apache.maven.plugins.annotations.Component;
2526
import org.apache.maven.plugins.annotations.LifecyclePhase;
2627
import org.apache.maven.plugins.annotations.Mojo;
2728
import org.apache.maven.plugins.annotations.Parameter;
2829
import org.apache.maven.project.MavenProject;
30+
import org.sonatype.plexus.build.incremental.BuildContext;
2931

3032
import org.springframework.boot.loader.tools.BuildPropertiesWriter;
3133
import org.springframework.boot.loader.tools.BuildPropertiesWriter.NullAdditionalPropertyValueException;
@@ -41,6 +43,9 @@
4143
@Mojo(name = "build-info", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true)
4244
public class BuildInfoMojo extends AbstractMojo {
4345

46+
@Component
47+
private BuildContext buildContext;
48+
4449
/**
4550
* The Maven project.
4651
*/
@@ -67,6 +72,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
6772
.writeBuildProperties(new ProjectDetails(this.project.getGroupId(),
6873
this.project.getArtifactId(), this.project.getVersion(),
6974
this.project.getName(), this.additionalProperties));
75+
this.buildContext.refresh(this.outputFile);
7076
}
7177
catch (NullAdditionalPropertyValueException ex) {
7278
throw new MojoFailureException(

0 commit comments

Comments
 (0)