找不到 ID 为 'org.wisepersist.gradle' 的插件

Plugin with id 'org.wisepersist.gradle' not found

我一直在关注 libGDX 文档,我是 Gradle 的新手,我几乎对此一无所知,我 运行 遇到了一个问题,我无法修复。我尝试通过应用插件并向其添加类路径来修复未找到的问题,但它没有用。有什么办法可以解决吗? (注:问题在html/build.gradle)

OS: Win64
IDE: Android 工作室

错误:原因:org.gradle.api.plugins.UnknownPluginException:未找到 ID 为 'org.wisepersist.gradle.plugins.get.GwtSuperDev' 的插件。 (这是我添加插件的时候) 未找到 ID 为 'org.wisepersist.gradle.plugins.get.GwtSuperDev' 的插件。

build.gradle:

buildscript {
    

    repositories {
        mavenLocal()
        mavenCentral()
        gradlePluginPortal()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        google()
    }
    dependencies {
        classpath 'org.wisepersist:gwt-gradle-plugin:1.1.15'
        classpath 'org.gretty:gretty:4.0.0'
        classpath 'com.android.tools.build:gradle:7.0.2'
        classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.12'
        

    }
}

allprojects {
    apply plugin: "eclipse"

    version = '1.0'
    ext {
        appName = "drop"
        gdxVersion = '1.10.0'
        roboVMVersion = '2.3.12'
        box2DLightsVersion = '1.5'
        ashleyVersion = '1.7.3'
        aiVersion = '1.8.2'
        gdxControllersVersion = '2.1.0'
    }

    repositories {
        mavenLocal()
        mavenCentral()
        google()
        gradlePluginPortal()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://oss.sonatype.org/content/repositories/releases/" }
    }
}

project(":desktop") {
    apply plugin: "java-library"


    dependencies {
        implementation project(":core")
        api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
        api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
        api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
        
    }
}

project(":android") {
    apply plugin: "com.android.application"

    configurations { natives }

    dependencies {
        implementation project(":core")
        api "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
        api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
        
    }
}

project(":ios") {
    apply plugin: "java-library"
    apply plugin: "robovm"


    dependencies {
        implementation project(":core")
        api "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
        api "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
        api "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
        api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
        api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios"
        
    }
}

project(":html") {
    apply plugin: "java-library"
    apply plugin: "gwt"
    apply plugin: "war"
    apply plugin: "org.gretty"
    apply plugin: "org.wisepersist.gradle.plugins.get.GwtSuperDev"
    apply plugin: "org.akhikhl.gretty.AppBeforeIntegrationTestTask"


    dependencies {
        implementation project(":core")
        api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
        api "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
        api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
        api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion:sources"
        api "com.badlogicgames.gdx:gdx-box2d-gwt:$gdxVersion:sources"
        
    }
}

project(":core") {
    apply plugin: "java-library"


    dependencies {
        api "com.badlogicgames.gdx:gdx:$gdxVersion"
        api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        
    }
}
</pre>

html/build.gradle:
<pre>
import org.wisepersist.gradle.plugins.get.GwtSuperDev
import org.akhikhl.gretty.AppBeforeIntegrationTestTask

gwt {
    gwtVersion='2.8.2' // Should match the gwt version used for building the gwt backend
    maxHeapSize="1G" // Default 256m is not enough for gwt compiler. GWT is HUNGRY
    minHeapSize="1G"

    src = files(file("src/")) // Needs to be in front of "modules" below.
    modules 'com.badlogic.drop.GdxDefinition'
    devModules 'com.badlogic.drop.GdxDefinitionSuperdev'
    project.webAppDirName = 'webapp'


    compiler {
        strict = true;
        disableCastChecking = true;
    }
}

gretty.httpPort = 8080
gretty.resourceBase = project.buildDir.path + "/gwt/draftOut"
gretty.contextPath = "/"
gretty.portPropertiesFileName = "TEMP_PORTS.properties"

task startHttpServer () {
    dependsOn draftCompileGwt

    doFirst {
        copy {
            from "webapp"
            into gretty.resourceBase
        }

        copy {
            from "war"
            into gretty.resourceBase
        }
    }
}

task beforeRun(type: AppBeforeIntegrationTestTask, dependsOn: startHttpServer) {
    // The next line allows ports to be reused instead of
    // needing a process to be manually terminated.
    file("build/TEMP_PORTS.properties").delete()
    // Somewhat of a hack; uses Gretty's support for wrapping a task in
    // a start and then stop of a Jetty server that serves files while
    // also running the SuperDev code server.
    integrationTestTask 'superDev'

    interactive false
}

task superDev (type: GwtSuperDev) {
    dependsOn startHttpServer
    doFirst {
        gwt.modules = gwt.devModules
    }
}

task dist(dependsOn: [clean, compileGwt]) {
    doLast {
        file("build/dist").mkdirs()
        copy {
            from "build/gwt/out"
            into "build/dist"
        }
        copy {
            from "webapp"
            into "build/dist"
            }
        copy {
            from "war"
            into "build/dist"
        }
    }
}

task addSource {
    doLast {
        sourceSets.main.compileClasspath += files(project(':core').sourceSets.main.allJava.srcDirs)
    }
}

tasks.compileGwt.dependsOn(addSource)
tasks.draftCompileGwt.dependsOn(addSource)

sourceCompatibility = 1.7
sourceSets.main.java.srcDirs = [ "src/" ]

eclipse.project.name = appName + "-html"

如何解决这个问题?我是 Gradle 的新手,如果答案很明显,我很抱歉。任何建议表示赞赏!

我认为您正在使用提到的插件 here

所以你必须确保像这样复制正确部分下的所有内容

请注意,包括 apply plugin 在内的所有块都应被复制

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "org.wisepersist:gwt-gradle-plugin:1.1.15"
  }
}

apply plugin: "org.wisepersist.gwt"