我是新手,并试图编译我的项目,但也是"阴影" (就像在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')
}
}
答案 0 :(得分:0)
这对我有用:
shade fileTree(dir: 'lib', include: '<filename>.jar')
使用file()对我来说不起作用,不确定是否由于语法错误,但fileTree做了这个伎俩,还允许使用通配符。