Skip to content

Gradle deprecation warning of compileOnly not being directly resolved is removed #56998

@breskeby

Description

@breskeby

While running e.g. ./gradlew precommit we see about 120 deprecation warnings of

The compileOnly configuration has been deprecated for resolution.

From investigating the build I found three places that cause a direct resolution of this configuration:

  1. ThirdPartyAuditTask (see https://github.com/elastic/elasticsearch/blob/master/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ThirdPartyAuditTask.java#L177-L180)
  2. DependenciesInfoTask (see
    task.compileOnlyConfiguration = project.configurations.getByName(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME)
    )
  3. DependencyLicensesTask (see configuration at
    project.tasks.withType(DependencyLicensesTask).named('dependencyLicenses').configure {
    it.dependencies = project.configurations.getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME).fileCollection { Dependency dependency ->
    dependency.group.startsWith('org.elasticsearch') == false
    } - project.configurations.getByName(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME)
    )

In all of those 3 places we subtract the compileOnly dependencies from the runtimeClasspath configuration. I wonder what is the scenario here that actually makes this happen or a concern? Shouldn't by design all compileOnly entries never end up on the runtimeClasspath?

Here's an overview of how gradle configurations are related by default: https://docs.gradle.org/6.4.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph

Metadata

Metadata

Assignees

Labels

:Delivery/BuildBuild or test infrastructureTeam:DeliveryMeta label for Delivery team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions