gpt4 book ai didi

java - Gradle 中仅包含多个主要的sourcsets

转载 作者:行者123 更新时间:2023-12-03 05:42:51 24 4
gpt4 key购买 nike

我有一个gradle项目,其中有两个sourceset main和api。
但是当我执行gradle build时,仅包含main的源
我正在使用以下代码:

sourceSets {
api {
java {
runtimeClasspath += main.output
compileClasspath += main.output
}
}

添加源集。
希望您能对我有所帮助,gradle还包括api源集

最佳答案

对于所有其他源集,您必须在dependenciesjar中添加适当的条目。如果您有一个名为“api”的源集:

sourceSets {
api{
}
}

dependencies {
//depend on the source set
compile sourceSets.api.output
}

jar{
//include output of API source set
from sourceSets.api.output
}

关于java - Gradle 中仅包含多个主要的sourcsets,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51687436/

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