latvian
latvian

Reputation: 3225

How to add clean task - Task 'clean' not found

I am using https://github.com/eriwen/gradle-js-plugin and i would like to be able run task 'clean'. When i run 'gradle -d clean', it gives the following error

Task 'clean' not found in root project

To my understanding, gradle comes with task - 'clean', however the gradles-js-plugin doesn't seem to support that at this time or something. How do i add the task 'clean'?

Here is my build.gradle:

// Pull the plugin from Maven Central
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.eriwen:gradle-js-plugin:1.5.0'
    }
}
// Invoke the plugin
apply plugin: 'js'

def jsSrcDir = 'public/js'

javascript.source {
    dev {
        js {
            srcDir jsSrcDir
            include "*.js"
            exclude "*.min.js"
        }
    }
    prod {
        js {
            srcDir jsSrcDir
            include "*.min.js"
        }
    }
}

combineJs{
    source = fileTree(javascript.source.dev.js.files)
    dest = file("${buildDir}/all.js")
}

Upvotes: 45

Views: 63907

Answers (5)

Santosh Rachakonda
Santosh Rachakonda

Reputation: 143

Make sure you are running the

gradle -d clean

command from your project home path.

Upvotes: 5

Donki
Donki

Reputation: 815

On android I added settings.gradle file with the a single line

include ':library'

Upvotes: 0

connelblaze
connelblaze

Reputation: 793

Just run it from your /android/ folder, i.e navigate to your android folder and run the command from there in the project dir.

you can also add

plugins {
    id "base"
}

to your gradle file

Upvotes: 3

030
030

Reputation: 11719

According to this guideline, the syntax is as follows:

plugins {
    id "base"
}

Upvotes: 3

Rene Groeschke
Rene Groeschke

Reputation: 28663

The clean task is introduced by the base plugin. So you need to apply this plugin to get the clean task and the clean task rules for cleaning up specific task outputs:

apply plugin:'base'

Upvotes: 42

Related Questions