gpt4 book ai didi

java - 在gradle中包括本地源jar,以便使用Eclipse?

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

我将gradle与eclipse结合使用,并具有本地jar和其源jar:

我将本地jar包含为:

dependencies {
compile name: 'mgwt-2.0.1-SNAPSHOT'
}

我也有这个本地jar的本地源jar: mgwt-2.0.1-SNAPSHOT:sources

如何包含此内容,以便Eclipse可以读取代码?

最佳答案

我们通过为这些 jar 定义本地存储库来使其工作:

allprojects {
repositories {
flatDir name: 'localRepo', dirs: [new File("theDirectory").absolutePath]
}
}

目录 theDirectory包含符合Maven命名约定的jar文件:
mgwt-2.0.1-SNAPSHOT.jar
mgwt-2.0.1-SNAPSHOT-sources.jar

我们通过省略 groupId来引用这些jar文件,如下所示:
dependencies {
compile ':mwgt:2.0.1-SNAPSHOT'
}

然后,Eclipse(以及IntelliJ)也将识别相应的来源-Jar并正确连接它们。

关于java - 在gradle中包括本地源jar,以便使用Eclipse?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34567155/

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