使用 Intellij 2017.2 构建/out 目录会复制/build 目录中的文件 [英] Building with Intellij 2017.2 /out directory duplicates files in /build directory
问题描述
更新到 Intellij 2017.2 后,构建我的项目会创建一个 /out
目录,其中包含生成的源文件和资源文件.这些文件重复了 /build
中已经包含的文件,并导致生成的类的 duplicate class
编译器错误.关于我需要在 Gradle 或 IntelliJ 中修复的任何想法?
After updating to Intellij 2017.2, building my project creates an /out
directory that contains generated source files and resource files. These files duplicate files that are already contained in /build
and result in duplicate class
compiler errors for the generated classes. Any ideas on a fix I need in Gradle or IntelliJ?
推荐答案
IntelliJ IDEA 不再与 Gradle 共享输出,请详情请见这张票.
IntelliJ IDEA is no longer sharing the output with Gradle, please see this ticket for details.
您可以通过以下配置覆盖它:
You can either override it via the following configuration:
allprojects {
apply plugin: 'idea'
idea {
module {
outputDir file('build/classes/main')
testOutputDir file('build/classes/test')
}
}
if(project.convention.findPlugin(JavaPluginConvention)) {
// Change the output directory for the main and test source sets back to the old path
sourceSets.main.output.classesDir = new File(buildDir, "classes/main")
sourceSets.test.output.classesDir = new File(buildDir, "classes/test")
}
}
或将构建委托给 Gradle:文件 |设置 |构建、执行、部署 |构建工具 |摇篮 |Runner => 将 IDE 构建/运行操作委托给 gradle.
or delegate the build to Gradle: File | Settings | Build, Execution, Deployment | Build Tools | Gradle | Runner => Delegate IDE build/run actions to gradle.
这篇关于使用 Intellij 2017.2 构建/out 目录会复制/build 目录中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!