xl0e
xl0e

Reputation: 371

How disable war plugin for specific project

I have following lines in my main build.gradle

subprojects {
    apply plugin: 'war'
}

But I'd like to disable war building for specific project. How to achieve that? I had tried to overwrite task in project config but didn't succeeded.

task war(type: War, overwrite: true) << {
    //
}

Upvotes: 3

Views: 8287

Answers (2)

Jeremy Bunn
Jeremy Bunn

Reputation: 671

Here is a way it can be accomplished:

Instead of this:

subprojects {

    apply plugin: 'war'

This:

subprojects {


    if (!project.name.equals("MySpecificProjectName")) {
      apply plugin: 'war'
    }

Upvotes: 2

Peter Niederwieser
Peter Niederwieser

Reputation: 123986

It's better to apply the plugin to the right projects in the first place, rather than trying to undo its effects later. For example:

configure(subprojects - project(":specific")) {
   apply plugin: "war"
}

Alternatively, you could push down application of the plugin to (some of) the subprojects' build scripts.

Upvotes: 3

Related Questions