Home > Software engineering >  Migration from Gradle 5.0 to 7.0
Migration from Gradle 5.0 to 7.0

Time:11-25

Here's a little piece of build.gradle:

apply plugin: 'java'
repositories {
    mavenCentral() 
}
dependencies {
    implementation 'commons-io:commons-io:2.5' 
    implementation fileTree(dir: 'libs', include: '*.jar') 
}
task printDependencies {
    doLast {
        configurations.compile.each { println it.name } 
        }    
    }

how should the line "configurations.compile.each { println it.name }" be written in a task to make it work in Gradle 7?

I couldn't find the syntax to replace this line in the documentation (Gradle), I must have looked in the wrong place (

CodePudding user response:

The ConfigurationContainer doesn't have a property compile, see Gradle API documentation. Remove the compile and just call the following:

configurations.each { println it.name } 
  • Related