英文:
Trying to use org.json library in java
问题
I'm using Gradle and trying to reload my plugin, but I can't seem to get it to work. Here is the Gradle file. When I click the reload button on Gradle, it gives this error:
Failed to process the entry 'org/gradle/internal/impldep/com/amazonaws/services/kms/model/transform/CreateGrantRequestProtocolMarshaller.class' from '/Applications/IntelliJ IDEA CE.app/Contents/plugins/gradle/lib/gradle-api-impldep-8.0.jar'
This is the build.gradle file:
plugins {
id 'java'
}
group = 'org.centoricraft'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven { url = "https://repo.codemc.org/repository/maven-public/" }
maven {
name = "spigotmc-repo"
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
maven {
url = uri("https://repo.opencollab.dev/main")
}
}
dependencies {
compileOnly "dev.jorel:commandapi-bukkit-core:9.0.1"
compileOnly "org.spigotmc:spigot-api:1.19.4-R0.1"
compileOnly("org.geysermc.floodgate:api:2.2.2-SNAPSHOT")
compile 'org.json:json:20210307'
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
(Note: This is a translation of your provided text without additional content.)
英文:
im using gradle and trying to reload my plugin but i cant seem to get it to work.
Here is the gradle file. when i click the reload button on gradle it gives this error:
Failed to process the entry 'org/gradle/internal/impldep/com/amazonaws/services/kms/model/transform/CreateGrantRequestProtocolMarshaller.class' from '/Applications/IntelliJ IDEA CE.app/Contents/plugins/gradle/lib/gradle-api-impldep-8.0.jar'
This is the build.gradle file
plugins {
id 'java'
}
group = 'org.centoricraft'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven { url = "https://repo.codemc.org/repository/maven-public/" }
maven {
name = "spigotmc-repo"
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
maven {
url = uri("https://repo.opencollab.dev/main")
}
}
dependencies {
compileOnly "dev.jorel:commandapi-bukkit-core:9.0.1"
compileOnly "org.spigotmc:spigot-api:1.19.4-R0.1"
compileOnly("org.geysermc.floodgate:api:2.2.2-SNAPSHOT")
compile 'org.json:json:20210307'
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
答案1
得分: 0
"compile"配置在Gradle中不再使用(自Gradle 7.0起)。
尝试替换:
compile 'org.json:json:20210307'
用以下方式:
implementation("org.json:json:20210307")
更多信息请参阅此主题。
英文:
"compile" configuration is no longer used in Gradle (since Gradle 7.0)
Try replacing
compile 'org.json:json:20210307'
with
implementation("org.json:json:20210307")
See this topic for more info.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论