gradle:跳过任务“:compileJava”,因为它没有源文件 [英] gradle: Skipping task ':compileJava' as it has no source files

查看:143
本文介绍了gradle:跳过任务“:compileJava”,因为它没有源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的尝试项目中尝试 gradle -d compileJava / a>,并且gradle引发正在跳过任务':compileJava',因为它没有源文件。。更糟糕的是,我看不到build /中创建的任何内容。我仅通过运行 gradle init 并创建一个 src / Ex.java来创建该项目。

i try gradle -d compileJava in my try project, and gradle raise "Skipping task ':compileJava' as it has no source files.". the worse thing is that i can't see anything created in build/. i create this project only with running gradle init and creating a "src/Ex.java".

我的问题是:

如何加载默认的 compileJava或定义我的 compileJava以解决此警告。

How to load default "compileJava" or define my "compileJava" to fix this warning.

推荐答案

默认情况下,Java源文件需要放入 src / main / java (或 src / test / java 作为测试源)。要么相应地调整目录结构,要么重新配置源目录,如下所示:

By default, Java source files need to go into src/main/java (or src/test/java for test sources). Either adapt your directory structure accordingly, or reconfigure the source directory as follows:

sourceSets {
    main {
        java {
            srcDirs = ["src"]
        }
    }
}

这篇关于gradle:跳过任务“:compileJava”,因为它没有源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆