如何使用gradle kotlin-dsl添加新的sourceset [英] How to add new sourceset with gradle kotlin-dsl

查看:251
本文介绍了如何使用gradle kotlin-dsl添加新的sourceset的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加一个源集src/gen/java.使用groovy,这非常容易,并且已经在 https://discuss.gradle.org/t/how-to-use-gradle-with-generation-sources/9401/5

I want to add a sourceset src/gen/java. With groovy this is rather easy and already described in https://discuss.gradle.org/t/how-to-use-gradle-with-generated-sources/9401/5

sourceSets {
   gen {
        java.srcDir "src/gen/java"
    }
}

但是我坚持使用kotlin-dsl来添加一个新的.我所拥有的是:

But I stuck with the kotlin-dsl to add a new one. All I've got is:

java {
    sourceSets {

    }
}

任何人都可以在这里帮助

Can anyone help here to

推荐答案

您应尝试以下操作:

java.sourceSets.create("src/gen/java")

希望这就是您所需要的!

Hope it's what you need!

这篇关于如何使用gradle kotlin-dsl添加新的sourceset的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆