Gradle 7 change to configurations property compile

Tried the new Gradle 7, and got some errors when building

> Could not get unknown property 'compile' for configuration container of type org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.
jar {
    manifest {
        attributes(
            'Implementation-Title': project.name,
            'Implementation-Version': project.version,
            'Implementation-Vendor': vendorName,
            'Implementation-Vendor-Id': project.group,
            'Specification-Title': project.name,
            'Specification-Version': project.version,
            'Specification-Vendor': vendorName,
            'Application-Name': applicationName,
            'Main-Class': project.application.mainClass,
            'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
            'Built-By': userName,
            'Build-Time': buildDateTime,
            'Created-By': createdBy,
            'Permissions': 'all-permissions',
            'Codebase': '*'
        )
    }
}

I could not find anything in the Gradle 7 Release Not why configurations.compile no longer works.

Taking a look at the JavaDoc
https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/ConfigurationContainer.html

I then tried to use instead configurations.compileClasspath which seems to work.
When did this change occour?

The use of compile has been discouraged in favor of implementation since 3.4: Gradle 3.4 Release Notes

It was officially deprecated per the normal release process and then finally removed in 7.0:
https://docs.gradle.org/current/userguide/upgrading_version_5.html#dependencies_should_no_longer_be_declared_using_the_compile_and_runtime_configurations

2 Likes