局部罐子中的阴影/阴影到渐变项目



我是gradle的新手,并尝试编译我的项目,但也"着色"(就像你在maven中一样)一个本地jar文件。

我正在尝试使用 gradle 影子插件,但是当我运行"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')
    }
}

这对我有用:

shade fileTree(dir: 'lib', include: '<filename>.jar')

使用 file() 对我不起作用,不确定这是否是由于语法不正确,但 fileTree 做到了,并且还允许通配符。

最新更新