如何将依赖项org.spongepowered:configurate-hocon:4.1.2
包含在项目的jar文件中?
这是我的gradle文件
plugins {
id 'java'
}
group 'main.test'
version '1.0.7'
repositories {
mavenCentral()
maven { url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
maven { url = 'https://repo.codemc.io/repository/maven-public/' }
maven { url = 'https://mvnrepository.com/artifact/it.unimi.dsi/fastutil' }
maven { url = "https://repo.dmulloy2.net/repository/public/" }
maven { url = "https://hub.spigotmc.org/nexus/content/groups/public/" }
}
dependencies {
implementation("org.spongepowered:configurate-hocon:4.1.2")
compileOnly 'org.jetbrains:annotations:23.0.0'
compileOnly 'me.clip:placeholderapi:2.11.1'
compileOnly 'fr.xephi:authme:5.6.0-SNAPSHOT'
compileOnly 'it.unimi.dsi:fastutil:8.5.8'
compileOnly "com.comphenix.protocol:ProtocolLib:4.7.0";
compileOnly fileTree(dir: 'lib', include: 'spigot-1.8.8.jar')
compileOnly fileTree(dir: 'lib', include: 'spigot-1.12.2.jar')
compileOnly fileTree(dir: 'lib', include: 'spigot-1.16.5.jar')
compileOnly fileTree(dir: 'lib', include: 'spigot-1.18.2-R0.1-SNAPSHOT.jar')
}
试试这个:
task buildFatJar(type: Jar) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
baseName = rootProject.name
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
jar.finalizedBy(buildFatJar)
您可以选择使用classifier = "all"
设置分类器