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 .
