【发布时间】:2015-11-15 17:54:08
【问题描述】:
我从 Gradle 开始,我想知道如何将单个依赖项(在我的情况下为 TeamSpeak API)包含到我的 JAR 中,以便它可以在运行时可用。
这是我的 build.gradle 的一部分:
apply plugin: 'java'
compileJava {
sourceCompatibility = '1.8'
options.encoding = 'UTF-8'
}
jar {
manifest {
attributes 'Class-Path': '.......'
}
from {
* What should I put here ? *
}
}
dependencies {
compile group: 'org.hibernate', name: 'hibernate-core', version: '4.3.7.Final'
compile group: 'org.spigotmc', name: 'spigot', version: '1.8-R0.1-RELEASE'
// Many other dependencies, all available at runtime...
// This one isn't. So I need to include it into my JAR :
compile group: 'com.github.theholywaffle', name: 'teamspeak3-api', version: '+'
}
感谢您的帮助:)
【问题讨论】:
-
依赖项不存储在 jar 文件中。它们在 jar 文件之外,并且 Class-Path 清单条目包含该 jar 的相对路径。
标签: java jar gradle dependencies build.gradle