How to Add Clean Task - Task 'Clean' Not Found

How to Add Clean Task - Task 'Clean' Not Found

I am using 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")
}
0

5 Answers

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'
4

Make sure you are running the

gradle -d clean

command from your project home path.

3

According to this guideline, the syntax is as follows:

plugins {
    id "base"
}

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

2

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

include ':library'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.