Why do I have to apply plugins in the top level project for multiprojects?


(Nigel Magnay) #1

I’m trying to understand multiproject builds wrt. ‘apply plugin’, with the hope of converting our large maven codebase to gradle, but I suspect I’m not understanding something because I’m too used to maven.

Our project has many different sub-projects of differing types :

  • java (jar)

  • java (war)

  • groovy (|groovy + java) (jar);

  • flex

  • etc…

    Coming from a maven background, I was expecting each one to need something like

    apply plugin: ‘java’ or

apply plugin: ‘gradlefx’

Which seems sensible. But what I don’t grok is why nothing happens (non-working of ‘gradle build’ at the top level) unless I also do something like this in my top-level build file:

subprojects { subProject ->

apply plugin: ‘java’

}

Surely I don’t have to declare project types in this file too, just to get a multi-project build to work?


(Peter Niederwieser) #2

If applying plugins in subproject build scripts doesn’t seem to have any effect, something is wrong with your build script(s). Do you have a ‘settings.gradle’?