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

后端 未结 3 407
北荒
北荒 2020-11-28 22:44

After updating to Intellij 2017.2, building my project creates an /out directory that contains generated source files and resource files. These files duplicate

相关标签:
3条回答
  • 2020-11-28 22:49

    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.

    0 讨论(0)
  • 2020-11-28 22:49

    File | Project Structure | Project Settings | Modules | Paths tab | Compiler output

    Select 'Inherit project compile output path' to continue using /build for build artifacts

    0 讨论(0)
  • 2020-11-28 23:04

    Here is my understanding:

    Basically, this is a work-around for an incompatibility issue between Gradle build path and IDEA output path.

    • the issue is - https://github.com/gradle/gradle/issues/2315
    • the solution is - keep these two directories seperate, therefore you have two (out/ and build/) https://youtrack.jetbrains.com/issue/IDEA-189063
    0 讨论(0)
提交回复
热议问题