为什么 gradle 在构建下创建一个 "java" 目录
Why is gradle creating a "java" directory under build
我使用 gradle init 创建了一个新的 Gradle 项目。我更改了很少的默认属性。对于一个较旧的项目,classes 将转到 [project-dir]/build/classes,但在我的新项目中,有一个非常相似的 build.gradle 文件,classes 将转到到 [project-dir]/build/java/classes。 buildDir 的 属性 是 [project-dir]/build。那么 [project-dir]/build/java 是从哪里来的呢?我认为这导致 class 加载程序出现问题。
(Nizet 用 link 打败了我)
在主要版本 Gradle 4 中,他们允许自己更改构建目录以支持多种 JVM 语言。它是在发布之前宣布的。
Cache-safe mixed JVM language compilation In Gradle 3.5, projects that
used both Java and another JVM language (like Groovy or Scala) would
encounter problems when using the build cache. The class files created
by multiple compilation tasks were all placed into the same output
directory, which made determining the set of outputs to cache for each
task difficult and would cause Gradle to cache the wrong outputs for
each compilation task.
Gradle now uses separate output directories for each JVM language.
所以你会有 /build/java、build/scala 等
我使用 gradle init 创建了一个新的 Gradle 项目。我更改了很少的默认属性。对于一个较旧的项目,classes 将转到 [project-dir]/build/classes,但在我的新项目中,有一个非常相似的 build.gradle 文件,classes 将转到到 [project-dir]/build/java/classes。 buildDir 的 属性 是 [project-dir]/build。那么 [project-dir]/build/java 是从哪里来的呢?我认为这导致 class 加载程序出现问题。
(Nizet 用 link 打败了我)
在主要版本 Gradle 4 中,他们允许自己更改构建目录以支持多种 JVM 语言。它是在发布之前宣布的。
Cache-safe mixed JVM language compilation In Gradle 3.5, projects that used both Java and another JVM language (like Groovy or Scala) would encounter problems when using the build cache. The class files created by multiple compilation tasks were all placed into the same output directory, which made determining the set of outputs to cache for each task difficult and would cause Gradle to cache the wrong outputs for each compilation task.
Gradle now uses separate output directories for each JVM language.
所以你会有 /build/java、build/scala 等