用Intellij 2017.2 / out目录构建与/ build目录中的文件重复 [英] Building with Intellij 2017.2 /out directory duplicates files in /build directory

查看:546
本文介绍了用Intellij 2017.2 / out目录构建与/ build目录中的文件重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新到Intellij 2017.2后,构建我的项目将创建一个包含生成的源文件和资源文件的 / out 目录。这些文件复制已包含在 / build 中的文件,并导致生成的类的重复的类编译器错误。在Gradle或IntelliJ中需要修复的任何想法?

解决方案

IntelliJ IDEA不再与Gradle共享输出,请<

>您可以通过以下配置覆盖它:

  allprojects {
apply plugin:'idea'
idea {
module {
outputDir file('build / classes / main')
testOutputDir file('build / classes / test')
}
}
if(project.convention.findPlugin(JavaPluginConvention)){
//将主和测试源集的输出目录更改回旧路径
sourceSets.main.output.classesDir = new (buildDir,classes / test)
}
}

或将构建委托给Gradle:File |设置|构建,执行,部署|构建工具| Gradle | Runner =>将IDE构建/运行操作委托给Gradle。


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 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")
 }
}

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屋!

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