Is there any gradle life cycle after the creation of the project object and before the dependencies?

I want to use Extension to modify project dependencies in Plugin .
now encounters such a problem.

if I get extension directly in my apply method, then extension of project has not been assigned.

but if I get extension in project-sharpafterEvaluate {} and then modify dependencies , I will report an error

.
Cannot change dependencies of configuration

so I would like to ask, what life cycle is after the project object is created ( extension is assigned) but dependencies is not finished?

Update questions

class PluginDemo implements Plugin<Project> {
    @Override
    void apply(Project target) {
        printExtension(target)

        target.rootProject.subprojects.each {
            if (it.name.startsWith("m_")) {
                println("${it.name}")
                target.dependencies.implementation it
            } else {
                println("${it.name}")
            }
        }
    }

    void printExtension(Project target) {
        target.extensions.create("myextension", MyExtension)
        println("myextension${target.myextension.merge}")
    }
}

I want to use an external switch to make : app rely on other subProject , so I want to control it through extension .

May.22,2021

dependencies configuration itself has exclude and transitive configurations. Isn't that enough for you? ide/managing_transitive_dependencies.html" rel=" nofollow noreferrer "> https://docs.gradle.org/curre.

do not understand your specific needs, can you post build.gradle DSL configuration to help analysis?

< hr >

EDIT: if you expect to judge by switch, you can actually borrow groovy DSL directly:


dependendies {
    if ("${myProp}" == 'true') {
         compile ':subproj'
    }
}

this myProp can be configured in the gradle.properties file, or it can be passed in through the command line system properties when the command line is executed:

./gradlew -DmyProp=true build

if your switch condition is get through other channels, then you need to write the corresponding get mode in groovy DSL

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31bb3-2ab00.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31bb3-2ab00.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?