【发布时间】:2017-01-11 17:25:24
【问题描述】:
我是 gradle 新手,正在尝试编译我的项目,但也“隐藏”(就像在 maven 中一样)本地 jar 文件。
我正在尝试使用 gradle shadow 插件,但是当我运行“shadowJar”时,它不会创建一个带有我希望在其中遮蔽/遮蔽的依赖项的 jar 文件。
如何使用 gradle 正确隐藏本地 jar 依赖项的内容?只需要有人指出我正确的方向,因为我找不到任何关于它的信息。谢谢!
这是我的 build.gradle:
group 'org.primemc'
version '1.0-SNAPSHOT'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
}
}
apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven {
name 'Spigot'
url 'https://hub.spigotmc.org/nexus/content/groups/public/'
}
maven {
name 'BungeeCord'
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
maven {
url 'https://nexus.solucorpus.com/repository/maven-all/'
}
}
dependencies {
compile 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
compileOnly "org.projectlombok:lombok:1.16.12"
compile files('./lib/redemptive-core-1.1-SNAPSHOT.jar')
compile files('./lib/craftbukkit-1.8.8.jar')
compile 'io.reactivex:rxjava:1.1.6'
// Not sure if this is correct or not.. doesn't seem to work.
shadow files('./lib/redemptive-core-1.1-SNAPSHOT.jar')
}
shadowJar {
dependencies {
//Attempting to shade/shadow this jar into the one built.
include('./lib/redemptive-core-1.1-SNAPSHOT.jar')
}
}
【问题讨论】: