gpt4 book ai didi

Gradle 多模块 intellij 设置

转载 作者:行者123 更新时间:2023-12-03 05:34:28 25 4
gpt4 key购买 nike

项目设置是带有 main、integTest、test 和 peroformanceTest 模块的 build.gradle 文件,每个模块都位于一组 java 类和资源文件夹中。

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

有没有办法将此配置包含在 build.gradle 文件中?
=> Intellij - set default output path to gradle output

但是在设置这个之后,我的所有模块共享资源,这意味着因为我在每个模块中都有相同的资源文件(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
}
}

关于Gradle 多模块 intellij 设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57288945/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com