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?
Can you provide a bit more information:
-
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? -
What’s your directory layout both for normal devs and on the CI server?
-
How do you know the
settings.gradle
file is being ignored?
Thesettings.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 thesettings.gradle
file.
- That’s a good idea, and I could just add a task to all projects with an init script? I will try this out.
- They are the same, but it does not adhere to convention (
src/main/groovy
, etc…) so thesettings.gradle
file is necessary for it to properly identify the subprojects - 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.