首页 > 解决方案 > 您如何在 gradle 子项目中重新定位 JMH 生成的目录?

问题描述

尝试使用 melix/jmh-gradle-plugin 在 kotlin gradle 下重新定位生成的 JMH 构建源

来自:
.../projectroot/ SUBPRJ_A / BUILD /jmh-generated-sources/...

至:
.../projectroot/构建/subProjects/ SUBPRJ_A /jmh-generated-sources/...

我尝试了很多东西,包括...

-- gradle.build.kts --

id("me.champeau.gradle.jmh") version "0.5.2"

... other irrelevant stuff ...

subprojects {

    this.setBuildDir(subPrjBuildDir)

    ... other irrelevant stuff ...

    idea {
        module {
            iml { setGenerateTo(rootIdeaOutFolder) }
            val subIdeaOutFolderRoot = rootIdeaOutFolder.resolve(subPrjExtPath)
            setOutputDir(subIdeaOutFolderRoot.resolve("main"))
            setTestOutputDir(subIdeaOutFolderRoot.resolve("test"))
        }
    }

    sourceSets {
        this.jmh {
            java.setSrcDirs(mutableListOf(subRoot.resolve("perf/java"),subRoot.resolve("main/java")))
            java.setOutputDir(rootPrjDir.resolve("build/subProject/${subPrj.name}"))
        }
    }
}

Gradle 6.6.1
openjdk 版本“11.0.2” 2019-01-15
IntelliJ IDEA 2020.3(社区版)

标签: gradlebuildgradle-kotlin-dsljmhgenerated-code

解决方案


推荐阅读