运行gradle任务时如何避免创建构建目录?

时间:2019-03-07 10:36:17

标签: gradle gwt build.gradle gradle-plugin

我正在尝试执行一个非常简单的任务来显示包含的build.gradle存储库。

buildscript {
    repositories {
      mavenCentral()
    }
    dependencies {
        classpath "org.wisepersist:gwt-gradle-plugin:1.0.8"
    }
}

plugins {
    id 'java'
}
...
apply plugin: 'gwt-compiler'
...
task showRepos {
    group 'Circus'
    description 'Show all included repositories'
    doLast {
        println "\nAll repos:"
        println repositories.collect { it.name } 
        println "\n"
    }
}

但是,当我使用gradle showRepos运行它时,它会自动创建“ build” 目录:

build/
└── gwt
    ├── cache
    ├── extra
    ├── gen
    └── work

如何防止这种自动创建?


UPDATE-1

似乎有些顽皮的GWT配置东西正在运行...

# gradle showRepos --console verbose --info

> Configure project :
Evaluating root project 'circuitjs' using build file 'F:\...\build.gradle'.
Using gwt.args for test: 
    -war     F:\...\war 
    -extra   F:\...\build\gwt\extra 
    -workDir F:\...\build\gwt\work 
    -gen     F:\...\build\gwt\gen 
    -logLevel INFO
Using gwt.persistentunitcachedir for test: {0}
All projects evaluated.
Selected primary task 'showRepos' from project :
Tasks to be executed: [task ':showRepos']
:showRepos (Thread[Execution worker for ':' Thread 2,5,main]) started.

1 个答案:

答案 0 :(得分:1)

您要从命令行运行什么任务?如果您正在跑步

gradle showRepos

那么它不应该创建那些GWT文件夹。我猜

  1. 您在任务图中有一个gwt任务(即,您正在运行一个依赖于gwt任务的任务)
  2. 您有一个顽皮的gwt任务,该任务在配置阶段创建文件夹(当它仅应在执行阶段出现时)