Reputation: 914
I have the following project-structure:
Root project 'base'
+--- Project ':server'
+--- Project ':testManager'
Each module has its own artifactoryPublish
task.
How can I exclude execution of artifactoryPublish
of testManager
module when I run the root task in the base
root dir?
> ./gradlew artifactoryPublish
- this should not run the testManager:artifactoryPublish
.
But I need to be able to run this task separately for one testmanager
module:
> ./gradlew
testManager:artifactoryPublish` - this should start the task in specified module.
I tried to add the following to settings.gradle
:
startParameter.excludedTaskNames << ':testManager:artifactoryPublish'
But in this case the task is skipped always even if I run it with the module name.
Or maybe there is a way to check if artifactoryPublish
was called only for testManager
, otherwise set artifactoryPublish.skip
flag?
Thanks in advance.
Upvotes: 1
Views: 772
Reputation: 21
You can just add to build.gradle
of testManager
module next script
artifactoryPublish.onlyIf { false }
Upvotes: 0
Reputation: 914
The solution that suits my case is to add the following to the testManager build.gradle:
artifactoryPublish.onlyIf {
ext.has("publishTestFiles")
}
This allows using additional flags only if the launch of this module's task is required.
Upvotes: 0
Reputation: 3175
You can exclude tasks from running with -x
switch
$> gradle --dry-run artifactoryPublish
:artifactoryPublish SKIPPED
:server:artifactoryPublish SKIPPED
:testManager:artifactoryPublish SKIPPED
$> gradle --dry-run artifactoryPublish -x :testManager:artifactoryPublish
:artifactoryPublish SKIPPED
:server:artifactoryPublish SKIPPED
Upvotes: 1