Skip to content

Instantly share code, notes, and snippets.

@gildor
Last active August 17, 2019 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gildor/0a83105479b49a7ebf6b466ed0d5aa6d to your computer and use it in GitHub Desktop.
Save gildor/0a83105479b49a7ebf6b466ed0d5aa6d to your computer and use it in GitHub Desktop.
Assert for Gradle to check that configuration is not resolved on configuration time
def afterEvaluation = false
gradle.projectsEvaluated {
afterEvaluation = true
}
allprojects { project ->
configurations.all { configuration ->
configuration.incoming.beforeResolve {
if (!afterEvaluation) {
throw new Exception("Configuration $configuration.name of project $project.name is being resolved at configuration time.")
}
}
}
}
gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS_FULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment