Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Boot 1.5.1 deprecation warning with Gradle 3.3, sub-module, and springBoot classifier #8154

Closed
bamapookie opened this issue Jan 31, 2017 · 10 comments
Labels
type: enhancement A general enhancement
Milestone

Comments

@bamapookie
Copy link

I am getting this with Spring Boot 1.5.1 and Gradle 3.3. Note there has to be a sub-module (even if it is empty) and a classifier in the springBoot task.

build.gradle

buildscript {
    ext {
        springBootVersion = '1.5.1.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: springBootVersion
    }
}
apply plugin: 'org.springframework.boot'
repositories {
    mavenCentral()
}
dependencies {
    compile project(':sub') // Important!  Needed to reproduce the bug!
}
springBoot {
    classifier = 'boot' // Important!  Needed to reproduce the bug!
}
allprojects {
    apply plugin: 'java'
}
task wrapper(type: Wrapper) {
    gradleVersion = '3.3'
    distributionType = Wrapper.DistributionType.ALL
}

settings.gradle

include 'sub'

Empty sub/build.settings file.

Running ./gradlew clean will invoke the error.

@wilkinsona
Copy link
Member

wilkinsona commented Jan 31, 2017

I'm not sure there's much we can do about this. The call to the deprecated API is being made by Gradle:

ModuleDependency.getConfiguration() has been deprecated and is scheduled to be removed in Gradle 4.0. Use ModuleDependency.getTargetConfiguration() instead.
        at org.gradle.api.internal.artifacts.dependencies.AbstractModuleDependency.getConfiguration(AbstractModuleDependency.java:56)
        at org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency_Decorated.getConfiguration(Unknown Source)
        at org.springframework.boot.gradle.repackage.ProjectLibraries.getLibrariesForFileDependencies(ProjectLibraries.java:132)
        at org.springframework.boot.gradle.repackage.ProjectLibraries.getLibraries(ProjectLibraries.java:113)
        at org.springframework.boot.gradle.repackage.ProjectLibraries.doWithLibraries(ProjectLibraries.java:90)
        at org.springframework.boot.gradle.repackage.RepackagePluginFeatures$RegisterInputsOutputsAction.addLibraryDependencies(RepackagePluginFeatures.java:158)
        at org.springframework.boot.gradle.repackage.RepackagePluginFeatures$RegisterInputsOutputsAction.setupInputOutputs(RepackagePluginFeatures.java:151)
        at org.springframework.boot.gradle.repackage.RepackagePluginFeatures$RegisterInputsOutputsAction.execute(RepackagePluginFeatures.java:136)
        at org.springframework.boot.gradle.repackage.RepackagePluginFeatures$RegisterInputsOutputsAction.execute(RepackagePluginFeatures.java:114)

Note that we're calling ProjectDependency.getConfiguration(), the implementation of which is calling ModuleDependency.getConfiguration() which is deprecated.

@wilkinsona
Copy link
Member

@eriwen If you have a moment, your input would be much appreciated here

@eriwen
Copy link

eriwen commented Jan 31, 2017

@wilkinsona Acknowledged. I've raised this with the team and I expect we'll get back to you with guidance in the next few days.

@eriwen
Copy link

eriwen commented Feb 3, 2017

@wilkinsona This looks very similar to #8120. You say you're calling ProjectDependency.getConfiguration(). Is there any reason you can't replace that with .getTargetConfiguration()?

The nebula-dependency-recommender-plugin had this same issue and resolved it thusly.

Additional information available at gradle/gradle#1311

Let me know if that does not solve your need.

@wilkinsona
Copy link
Member

wilkinsona commented Feb 4, 2017

@eriwen Unless I've missed it, getTargetConfiguration() doesn't exist in Gradle 2.9 which is the minimum version that we support. I guess we could resort to reflection but I'd prefer it if that wasn't necessary.

Edit: I see they've used reflection in the Nebula plugin. I guess we'll have to do the same then

@pkubowicz
Copy link

@wilkinsona Could you backport this fix to Spring Boot 1.4? I am not able to update to Spring Boot 1.5 because I am forced to stay with an older release of Spring Data. Gradle team does not fix bugs in versions older than current, so I have to update it to avoid being exposed to bugs. As result, I cannot use Gradle 2 as it has broken Maven support (https://issues.gradle.org/browse/GRADLE-3496). Maven is broken again in 3.5 (gradle/gradle#1811). I would like to use Gradle 4.0 as it promises an important fix to Maven publishing, but this issue breaks Gradle.

I understand Gradle >2 is not officially supported in Spring Boot 1.4, but backporting this fix does not seem to be complicated or risky, and enables users to at least try to use Gradle 4+.

@eriwen
Copy link

eriwen commented Apr 23, 2017 via email

@wilkinsona
Copy link
Member

@pkubowicz I am rather reluctant to introduce the use of reflection in 1.4 to attempt to support something that we have already stated that we do not support. It's very difficult to justify the risk (and there is always some risk).

https://issues.gradle.org/browse/GRADLE-3496

That issues claims to be fixed in 2.14.1. Is that not an option for you?

@pkubowicz
Copy link

Generally, I don't like the idea that a single library is able to force me to choose which build tool should I use. For me it's more natural that build dependencies and project dependencies are completely independent. I would welcome a possibility that you can use the most current Spring Boot Gradle plugin with the Spring Boot JAR version overridden to an older release.

@wilkinsona
Copy link
Member

Generally, I don't like the idea that a single library is able to force me to choose which build tool should I use.

I don't believe we're forcing you. You are free to ignore the deprecation warning if you wish.

I would welcome a possibility that you can use the most current Spring Boot Gradle plugin with the Spring Boot JAR version overridden to an older release

That's already possible, although not recommended, with 2.0 snapshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

6 participants