Spring Boot Gradle Plugin 2.6.1 uses the constructor LazyPublishArtifact(Provider<?>), which is soon to be deprecated in Gradle 7.4. It would be best if this internal API could be avoided, or if not, changed to use LazyPublishArtifact(Provider<?>, FileResolver) instead, with a non-null FileResolver. The relevant PR for this change in Gradle is https://github.com/gradle/gradle/pull/18715.

Comment From: mihailcornescu

Hi,

I have identified 2 places in the code where the old constructor, LazyPublishArtifact(Provider<?>), is used:

https://github.com/spring-projects/spring-boot/blob/2.7.x/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java#L135 and

https://github.com/spring-projects/spring-boot/blob/2.7.x/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/WarPluginAction.java#L108

Shall I make the changes to use the new constructor?

Comment From: wilkinsona

@mihailcornescu Thanks for the offer, but that may not be what we want to do here.

@octylFractal We'd quite happily stop using LazyPublishArtifact but I'm not sure how to achieve the same behaviour without public API. Could you please point me in the right direction?

Comment From: mihailcornescu

@wilkinsona thanks for the answer.

Comment From: octylFractal

Could you please point me in the right direction?

Unfortunately I did take a quick look, and I wasn't certain if it would be possible to do this only in public API. I can take a deeper look sometime in the next few weeks if you don't figure it out.

Comment From: wilkinsona

FileResolver is also internal API so moving to LazyPublishArtifact(Provider<?>, FileResolver) will increase the number of internal-yet-public classes that we depend upon. That feels like a step in the wrong direction to me. In the absence of a public alternative to LazyPublishArtifact, I wonder if we'd be better leaving things as-is.

This feels somewhat similar to https://github.com/gradle/gradle/issues/5239. We're trying to do something similar to various first-party plugins but they all rely on internal API:

I'll leave this open for now but mark it as blocked. Unfortunately, I don't think we'll be able to make some progress without some pointers on how to avoid using LazyPublishArtifact.

Comment From: wilkinsona

Closing in favor of #30209. Thanks for the PR, @octylFractal.