Gradle多模块Intellij设置



project设置是构建的。grandle文件,具有主,integtest,test和peroformancetest模块,每个模块都在Java类和资源文件夹中。

将项目导入Intellij单元测试将无法正常工作,因为Intellij将所有资源合并到一个文件夹中,直到您在Intellij Project settings-> Modules-> myProject-> myProject-> PATH中选择Use module compile output path

有没有办法将此配置包含在build.gradle文件中?=> Intellij-将默认输出路径设置为gradle输出

设置此之后,我所有的模块共享资源,这意味着我在每个模块中都有相同的资源文件(application.conf(,这些文件被覆盖。我需要为每个模块指定不同的输出文件夹:

apply plugin: 'idea'
idea{
    module{
        inheritOutputDirs = false
        outputDir = compileJava.destinationDir + ${module.name}
        testOutputDir = compileTestJava.destinationDir + ${module.name}
    }
}

解决方案将是:

idea {
  module {
    inheritOutputDirs = false
    outputDir = new File("${rootDir}/build/java/${name}")
    testOutputDir = new File("${rootDir}/build/java/test/${name}")
    downloadJavadoc = true
    downloadSources = true
  }
}

最新更新