Hi I have such a problem, for some reason I can not relocated google.gson… here I attach the gradle code, thank you for all the advice
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow'
group = 'cz.coffee'
version = '1.3.1'
compileJava.options.encoding = 'UTF-8'
repositories {
mavenCentral()
mavenLocal()
maven {
name = 'papermc-repo'
url = 'https://repo.papermc.io/repository/maven-public/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
maven {
url 'https://repo.skriptlang.org/releases'
}
maven {
url 'https://mvnrepository.com/artifact/com.google.code.gson/gson'
}
maven {
url 'https://mvnrepository.com/artifact/org.eclipse.jdt/org.eclipse.jdt.annotation'
}
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.24'
compileOnly 'org.jetbrains:annotations:23.0.0'
compileOnly 'io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT'
compileOnly 'com.github.SkriptLang:Skript:2.6.3'
shadow('com.google.code.gson:gson:2.10')
implementation group: 'org.eclipse.jdt', name: 'org.eclipse.jdt.annotation', version: '2.2.700'
}
task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
}
tasks.withType(ShadowJar) {
dependsOn relocateShadowJar
configurations = [
project.configurations.shadow
]
relocate 'com.google.gson', 'cz.coffee.skriptgson.google.gson'
manifest {
attributes(
'Name': 'cz/coffee/skriptgson',
'Automatic-Module-Name': 'cz.coffee.skriptgson',
'Sealed': 'true'
)
}
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs += ["-source", "16", "-target", "16"]
}
Collection getListOfFolders(String dir, String pattern) {
file(dir).listFiles({file -> !file.isFile() && file.name ==~ pattern} as FileFilter)
}
task cleanPlugins(type: Delete) {
delete getListOfFolders("A:/Bukkit-Core/purpur/dev-1.17/plugins", "skript-gson*.jar")
}
task Release(type: Copy) {
println("Copied!")
from "${buildDir}/libs"
into "A:/Bukkit-Core/purpur/dev-1.17/plugins"
}
task server(type: Exec) {
commandLine 'cmd', '/c', 'start powershell A:\\psScripts\\buld.ps1 "startServer"'
return 1
}
task reload(dependsOn: ['build', 'cleanPlugins'], type: Exec) {
commandLine 'cmd', '/c', 'start powershell A:\\psScripts\\buld.ps1 "reload"'
return 1
}
task reload_plus(dependsOn: ['build', 'cleanPlugins'], type: Exec) {
commandLine 'cmd', '/c', 'start powershell A:\\psScripts\\buld.ps1 "reload_+"'
return 1
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}