Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle multiproject, ext {} at top fails?

Tags:

gradle

I can't figure out why the order of ext {} matters and causes a failure such as below? Without an example to copy, how are you guys figuring the order to put things? The docs seem to just talk about the closures in isolation and not interdependencies between them ?

project-base
    settings.gradle
    build.gradle (inside this one in examples below)
  subproject_folder
    build.gradle


ext {} // this blows up here

 buildscript {}

 plugins {}

 sonarqube {} 

 allprojects {}

 subprojects {}

but if I have the same thing except

buildscript {}

plugins {}

sonarqube {}

allprojects {}

subprojects {}

ext {} // bingo all of a sudden this is legal ?
like image 889
JvmSd121 Avatar asked Nov 20 '25 02:11

JvmSd121


1 Answers

The issue is not the position of the ext {} block, it is the position of buildscript {} and plugins {} blocks.

As indicated in the documentation, the plugins {} block must be the first in a build file. And because the buildscript {} block is also about determining what is accessible in a build file, its classpath effectively, it has similar limitations.

like image 164
Louis Jacomet Avatar answered Nov 22 '25 05:11

Louis Jacomet