Clean does not work with 'java-base' plugin

Hi.

We have a project like so,

apply plugin: 'base'
apply plugin: 'java-base'
  task GenPropsSet {
    ext.srcFilePre
= file("${SRC_DIR}/util/Properties.prologue")
    ext.srcFilePost = file("${SRC_DIR}/util/Properties.epilogue")
    ext.srcFileAct
= file("${SRC_DIR}/util/Properties.txt")
    ext.destFile
  = file("${SRC_DIR}/util/Properties.java")
      inputs.files (srcFilePre, srcFilePost, srcFileAct)
    outputs.file destFile
      doLast {
        // Logic to create 'destFile' goes here
    }
}

When I try,

gradle cleanGenPropsSet it fails saying

“Task ‘cleanGenPropsSet’ not found in root project ‘Project’”

Configurations: ------------------------------------------------------------ Gradle 1.11 ------------------------------------------------------------

Build time:

2014-02-11 11:34:39 UTC Build number: none Revision:

a831fa866d46cbee94e61a09af15f9dd95987421

Groovy:

1.8.6 Ant:

Apache Ant™ version 1.9.2 compiled on July 8 2013 Ivy:

2.2.0 JVM:

1.7.0_45 (Oracle Corporation 24.45-b08) OS:

Windows XP 5.1 x86

Your task name starts with an uppercase character and CleanRule expects lowercase - https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/groovy/org/gradle/api/internal/plugins/CleanRule.java

Hi Radim,

I just changed it, and tested it, it still does not seem to work.

task genProperties {
    ext.srcFilePre
= file("${S_TS_DIR}/util/Properties.prologue")
    ext.srcFilePost = file("${S_TS_DIR}/util/Properties.epilogue")
    ext.srcFileAct
= file("${S_TS_DIR}/util/Properties.txt")
    ext.destFile
  = file("${S_TS_DIR}/util/Properties.java")
      inputs.files (srcFilePre, srcFilePost, srcFileAct)
    outputs.file destFile
      doLast {
          // Logic to create 'destFile' goes here
    }
}

Output is as follows:

C:\SVN\Source>gradle cleangenProperties

FAILURE: Build failed with an exception.

  • What went wrong: Task ‘cleangenProperties’ not found in root project ‘Server’.

  • Try: Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or

  • -debug option to get more log output.

BUILD FAILED

Total time: 5.578 secs

Almost there.

task genProps {
  ...
}

and then

gradle cleanGenProps

I.e. task name needs to start with lowercase and the rule matches to name where it is upper-case and prepended with ‘clean’.

Radim Kubacki,

brilliant… Thank you so much :slight_smile: