简体   繁体   中英

Gradle: reinitialize / reload settings.gradle

I have developed a plugin and placed it into buildSrc. In addition, the build.gradle of the buildSrc is generating a settings.gradle for the parent folder (runs recursively to discover all the gradle projects) and it's done correctly.

But when the buildSrc/build.gradle is over (it compiled the plugin, and it run the gradle task to generate settings.gradle) and gradle jumps to the main build on the parent dir, I found out that the new settings.gradle that it generated is not the one that matters but the one read before the buildSrc.

Any way to refresh and reload it?

I'm not aware of a way to reload settings.gradle , and it's certainly not a supported feature. The way this is typically done is to script settings.gradle rather than generating it. If required, you also have access to buildSrc classes from settings.gradle.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM