Gradle 格雷德尔清洁<;客户任务>;不起作用

Gradle 格雷德尔清洁<;客户任务>;不起作用,gradle,Gradle,我有一个自定义任务来执行WebSphereEJBDeploy。我已经定义了输入和输出,并获得了成功的增量编译,但我无法使自动生成的clean任务正常工作 根据docs,对于名为“ejbDeploy”的自定义任务以及定义的输出,一个cleanEjbDeploy 有人知道为什么清洁规则不起作用吗 [编辑] 以下是完整的(匿名的)文件内容(自最初的问题帖子以来已更改): 下面是“$gradle任务”的相关部分 build-组装和测试此项目。 buildDependents-组装和测试此项目以及所有依赖

我有一个自定义任务来执行WebSphereEJBDeploy。我已经定义了输入和输出,并获得了成功的增量编译,但我无法使自动生成的clean任务正常工作

根据docs,对于名为“ejbDeploy”的自定义任务以及定义的输出,一个cleanEjbDeploy

有人知道为什么清洁规则不起作用吗

[编辑]

以下是完整的(匿名的)文件内容(自最初的问题帖子以来已更改):

下面是“$gradle任务”的相关部分

build-组装和测试此项目。
buildDependents-组装和测试此项目以及所有依赖的项目
在上面。
buildNeeded-组装和测试此项目及其依赖的所有项目。
类-组装主类。
清除-删除生成目录。
jar—组装包含主类的jar归档文件。
testClasses—组装测试类。
文档任务
-------------------
javadoc-为主要源代码生成JavadocAPI文档。
帮助任务
----------
依赖项-显示项目“”的依赖项。
帮助-显示帮助消息
项目-显示项目“”的子项目。
属性-显示项目“:project”的属性。
任务-显示“项目”中可运行的任务:“项目”(某些
显示的任务可能属于子项目)。
IDE任务
---------
cleanEclipse-清除所有Eclipse文件。
eclipse—生成所有eclipse文件。
核查任务
------------------
检查-运行所有检查。
测试-运行单元测试。
其他任务
-----------
ejbDeploy
规则
-----
模式:构建:组装配置的工件。
模式:上传:组装并上传以下工件
g到一个配置。
模式:清理:清理任务的输出文件。
要查看所有任务和更多详细信息,请使用--all运行。
建设成功
总时间:3.321秒

清除规则由
base
插件提供。由于许多其他插件(例如
java
)已经应用了
base
插件,您通常不必自己应用
base
插件。但如果:

apply plugin: "base"

“java”和“base”都导入到包含自定义ejbDeploy任务的build.gradle中。请仔细检查插件是否应用于声明该任务的同一项目。如果是这样的话,您已经发现了一个bug,尽管这有点难以置信。还要检查为该项目执行时,
gradle tasks
是否显示任务规则。感谢您的帮助!现在在基本帖子中有更多信息。你所说的“我不能让自动生成的清理任务正常工作”到底是什么意思?当你调用它时会发生什么?我只是再次尝试,无论出于什么原因,它现在都成功了。我一定是在其中一项任务的某个地方出错了。谢谢你的帮助,彼得。
task ejbDeploy(dependsOn: 'jar'){
    srcFile = file(jar.archivePath)
    destDir = new File("build/ejbDeploy")

    inputs.file srcFile
    outputs.dir destDir

    def cp = project.files(
        project.sourceSets.main.output.classesDir,
        project.sourceSets.main.resources,
        project.configurations.runtime
        ).getAsPath()

    doLast{
        destDir.mkdirs()

        exec{
            executable = wasEjbDeploy
            workingDir = destDir
            args = [
                jar.archivePath,
                ".",
                jar.archiveName,
                "-cp",
                cp
            ]
        }   
    }
}
version = '1.0-SNAPSHOT'
group = 'com.company'

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath group: 'name.benjaminAbbitt', name: 'WASEjbDeploy', version: '1.0-SNAPSHOT'
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'base'

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    compile 'javax.mail:mail:1.4.5'
    compile 'log4j:log4j:1.2.16'
    compile files(fileTree(dir: 'lib', includes: ['*.jar']) )
}

task ejbDeploy(type:name.benjaminAbbitt.WASEjbDeploy, dependsOn: 'jar'){
    wasEjbDeployPath = wasEjbDeploy
}
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend
on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles the main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles the test classes.

Documentation tasks
-------------------
javadoc - Generates Javadoc API documentation for the main source code.

Help tasks
----------
dependencies - Displays the dependencies of project ':project'.
help - Displays a help message
projects - Displays the sub-projects of project ':project'.
properties - Displays the properties of project ':project'.
tasks - Displays the tasks runnable from project ':project' (some of the
displayed tasks may belong to subprojects).

IDE tasks
---------
cleanEclipse - Cleans all Eclipse files.
eclipse - Generates all Eclipse files.

Verification tasks
------------------
check - Runs all checks.
test - Runs the unit tests.

Other tasks
-----------
ejbDeploy

Rules
-----
Pattern: build<ConfigurationName>: Assembles the artifacts of a configuration.
Pattern: upload<ConfigurationName>: Assembles and uploads the artifacts belongin
g to a configuration.
Pattern: clean<TaskName>: Cleans the output files of a task.

To see all tasks and more detail, run with --all.

BUILD SUCCESSFUL

Total time: 3.321 secs
apply plugin: "base"