Could not get unknown property for task in Gradle?

11,289

Gradle's API has changed a lot between version 1.x (you indicated 1.7) and 3x (latest release as of today is 3.4.1).

I think what you need is to query the value of the subprojects property https://docs.gradle.org/3.4.1/dsl/org.gradle.api.Project.html#org.gradle.api.Project:subprojects

rootProject.subprojects.each { ... }

Unfortunately there's no single document where you may find all the changes between version 1.x and 3.x. My recommendation is to update build version whenever possible to minimize migration impact. Be always in the lookout of behavior/binary incompatibilities when switching between major release versions.

Share:
11,289

Related videos on Youtube

java123999
Author by

java123999

Updated on September 15, 2022

Comments

  • java123999
    java123999 almost 2 years

    I have the following Gradle Task:

      task makeZipDependencies << {
            allDeps = (configurations.runtime + configurations.archives.allArtifacts.files).findAll {
                !(it.name =~ /clover/)
            }                                                                              .unique()
            if ("myApp".equals(project.name)) {
                rootProject.childProjectsRecursive.each {
    
                    try {
                        databaseSqlFileDeps.put(it.name, it.configurations["mySQLFiles"].files)
                    } catch (UnknownConfigurationException e) {
    
                    }
                }
            }
    

    This was not causing an error previously when I was running my project with java 7 and gradle 1.7.

    However, I have moved to Java 8 and gradle 3.4.1 and now I get this error:

    Execution failed for task "makeZipDependencies", could not get unknown property:childProjectsRecursive for root Project myApp of type org.gradle.api.project" 
    

    What changes do I need to make to my task to fix this?