How to Use -b Switch AND settings.gradle, Impossible?


(Chris Sphinx) #1

Looking for a way to lock devs out of certain tasks so they don’t accidentally run them, but need to be available to CI server. I’m trying to use -b switch, but then it ignores settings.gradle and I have a multiproject build set up. How should this be accomplished?


(Pepper Lebeck-Jobe) #2

Can you provide a bit more information:

  1. What exactly are you trying to accomplish? You’ve said, “lock devs out of certain tasks so they don’t accidentally run them, but need to be available to CI server.” Does that mean you want to allow the developers to use one build.gradle file, but have a different one you only have available on the CI servers? Have you considered doing the same thing with Init Scripts?

  2. What’s your directory layout both for normal devs and on the CI server?

  3. How do you know the settings.gradle file is being ignored?
    The settings.gradle file is located according to these rules. So, depending on where you are pointing with the -b option, you might be making Gradle not find the settings.gradle file.


(Chris Sphinx) #3
  1. That’s a good idea, and I could just add a task to all projects with an init script? I will try this out.
  2. They are the same, but it does not adhere to convention (src/main/groovy, etc…) so the settings.gradle file is necessary for it to properly identify the subprojects
  3. Well it says right here in the docs. The file is in the top level right next to build.gradle and the secondary build script.

Currently I’m just using .onlyIf to define that a command line property must be specified correctly for the task to run, which stops it from running inside Intellij which might be good enough. Thanks for the initscript idea.