Building with Intellij 2017.2 /out directory duplicates files in /build directory

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.

Leave a Comment