MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    在编译插件的时候出现这个报错

    开发交流
    3
    6
    503
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      N70_ last edited by

      Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
      
      > Task :compileJava FAILED
      警告: 未知的枚举常量 Kind.PLUGIN_ID
        原因: 找不到net.mamoe.mirai.console.compiler.common.ResolveContext$Kind的类文件
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.PLUGIN_NAME
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.VERSION_REQUIREMENT
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.COMMAND_REGISTER
        原因: 找不到net.mamoe.mirai.console.compiler.common.RestrictedScope$Kind的类文件
      警告: 未知的枚举常量 Kind.PERMISSION_REGISTER
      警告: 未知的枚举常量 Kind.PERMISSION_NAME
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.VERSION_REQUIREMENT
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.VERSION_REQUIREMENT
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.RESTRICTED_ABSTRACT_MESSAGE_KEYS
      警告: 未知的枚举常量 Kind.RESTRICTED_ABSTRACT_MESSAGE_KEYS
      19 个警告
      
      FAILURE: Build failed with an exception.
      
      * What went wrong:
      Execution failed for task ':compileJava'.
      > java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x45c89b36) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x45c89b36
      
      * Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
      
      * Get more help at https://help.gradle.org
      
      BUILD FAILED in 12s
      2 actionable tasks: 2 executed
      PS E:\mirai bot\研究用文件夹\Records> .\gradlew buildPlugin
      
      > Task :compileJava FAILED
      警告: 未知的枚举常量 Kind.PLUGIN_ID
        原因: 找不到net.mamoe.mirai.console.compiler.common.ResolveContext$Kind的类文件
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.PLUGIN_NAME
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.VERSION_REQUIREMENT
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.COMMAND_REGISTER
        原因: 找不到net.mamoe.mirai.console.compiler.common.RestrictedScope$Kind的类文件
      警告: 未知的枚举常量 Kind.PERMISSION_REGISTER
      警告: 未知的枚举常量 Kind.PERMISSION_NAME
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.VERSION_REQUIREMENT
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.VERSION_REQUIREMENT
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.RESTRICTED_ABSTRACT_MESSAGE_KEYS
      警告: 未知的枚举常量 Kind.RESTRICTED_ABSTRACT_MESSAGE_KEYS
      19 个警告
      
      FAILURE: Build failed with an exception.
      
      * What went wrong:
      Execution failed for task ':compileJava'.
      > java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x45c89b36) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x45c89b36
      
      * Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
      
      * Get more help at https://help.gradle.org
      
      BUILD FAILED in 3s
      2 actionable tasks: 2 executed
      PS E:\mirai bot\研究用文件夹\Records> .\gradlew buildPlugin
      Starting a Gradle Daemon, 1 incompatible and 4 stopped Daemons could not be reused, use --status for details
      
      > Task :compileJava FAILED
      警告: 未知的枚举常量 Kind.PLUGIN_ID
        原因: 找不到net.mamoe.mirai.console.compiler.common.ResolveContext$Kind的类文件
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.PLUGIN_NAME
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.VERSION_REQUIREMENT
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.COMMAND_REGISTER
        原因: 找不到net.mamoe.mirai.console.compiler.common.RestrictedScope$Kind的类文件
      警告: 未知的枚举常量 Kind.PERMISSION_REGISTER
      警告: 未知的枚举常量 Kind.PERMISSION_NAME
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.VERSION_REQUIREMENT
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.VERSION_REQUIREMENT
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.RESTRICTED_ABSTRACT_MESSAGE_KEYS
      警告: 未知的枚举常量 Kind.RESTRICTED_ABSTRACT_MESSAGE_KEYS
      19 个警告
      
      FAILURE: Build failed with an exception.
      
      * What went wrong:
      Execution failed for task ':compileJava'.
      > java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x66349c1d) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x66349c1d
      
      * Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
      
      * Get more help at https://help.gradle.org
      
      BUILD FAILED in 10s
      2 actionable tasks: 2 executed
      PS E:\mirai bot\研究用文件夹\Records> .\gradlew buildPlugin
      Starting a Gradle Daemon, 1 incompatible and 5 stopped Daemons could not be reused, use --status for details
      
      > Task :compileJava FAILED
      警告: 未知的枚举常量 Kind.PLUGIN_ID
        原因: 找不到net.mamoe.mirai.console.compiler.common.ResolveContext$Kind的类文件
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.PLUGIN_NAME
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.VERSION_REQUIREMENT
      警告: 未知的枚举常量 Kind.PLUGIN_ID
      警告: 未知的枚举常量 Kind.COMMAND_REGISTER
        原因: 找不到net.mamoe.mirai.console.compiler.common.RestrictedScope$Kind的类文件
      警告: 未知的枚举常量 Kind.PERMISSION_REGISTER
      警告: 未知的枚举常量 Kind.PERMISSION_NAME
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.VERSION_REQUIREMENT
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.VERSION_REQUIREMENT
      警告: 未知的枚举常量 Kind.SEMANTIC_VERSION
      警告: 未知的枚举常量 Kind.RESTRICTED_ABSTRACT_MESSAGE_KEYS
      警告: 未知的枚举常量 Kind.RESTRICTED_ABSTRACT_MESSAGE_KEYS
      19 个警告
      
      FAILURE: Build failed with an exception.
      
      * What went wrong:
      Execution failed for task ':compileJava'.
      > java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x526cf4b1) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x526cf4b1
      
      * Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
      
      * Get more help at https://help.gradle.org
      
      BUILD FAILED in 12s
      2 actionable tasks: 2 executed
      

      很简单的一个记录表插件,直接从Github拉取模板写的,编译成jar包时会有这个错误,但是可以在RunMirai.kt里运行。
      在这个插件之前另外一个类似的记录表插件也报了这个错误,在build.gradle.kt里的dependence底下删除了两个没见过的依赖之后问题消失

      N 1 Reply Last reply Reply Quote 0
      • N
        N70_ @N70_ last edited by

        /*
         * Copyright 2019-2021 Mamoe Technologies and contributors.
         *
         *  此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
         *  Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
         *
         *  https://github.com/mamoe/mirai/blob/master/LICENSE
         */
        
        @file:Suppress("unused")
        
        package net.mamoe.mirai.console.compiler.common
        
        import kotlin.annotation.AnnotationTarget.*
        
        /**
         * 标记一个参数的语境类型, 用于帮助编译器和 IntelliJ 插件进行语境推断.
         */
        @Target(VALUE_PARAMETER, PROPERTY, FIELD, FUNCTION, TYPE, TYPE_PARAMETER)
        @Retention(AnnotationRetention.BINARY)
        public annotation class ResolveContext(
            vararg val kinds: Kind,
        ) {
            /**
             * 元素数量可能在任意时间被改动
             */
            public enum class Kind {
                ///////////////////////////////////////////////////////////////////////////
                // ConstantKind
                ///////////////////////////////////////////////////////////////////////////
        
                /*
                 * WARNING: IF YOU CHANGE NAMES HERE,
                 * YOU SHOULD ALSO CHANGE THEIR COUNTERPARTS AT net.mamoe.mirai.console.compiler.common.resolve.ResolveContextKind
                 */
        
                /**
                 * PluginDescription.id
                 */
                PLUGIN_ID, // ILLEGAL_PLUGIN_DESCRIPTION
        
                /**
                 * PluginDescription.name
                 */
                PLUGIN_NAME, // ILLEGAL_PLUGIN_DESCRIPTION
        
                /**
                 * PluginDescription.version
                 * SemVersion.Companion.invoke
                 */
                SEMANTIC_VERSION, // ILLEGAL_PLUGIN_DESCRIPTION
        
                /**
                 * SemVersion.Companion.parseRangeRequirement
                 */
                VERSION_REQUIREMENT, // ILLEGAL_VERSION_REQUIREMENT
        
                /**
                 * Command.allNames
                 */
                COMMAND_NAME, // ILLEGAL_COMMAND_NAME
        
                /**
                 * PermissionId.name
                 */
                PERMISSION_NAMESPACE, // ILLEGAL_PERMISSION_NAMESPACE
        
                /**
                 * PermissionId.name
                 */
                PERMISSION_NAME, // ILLEGAL_PERMISSION_NAME
        
                /**
                 * PermissionId.parseFromString
                 */
                PERMISSION_ID, // ILLEGAL_PERMISSION_ID
        
                /**
                 * 标注一个泛型, 要求这个泛型必须拥有一个公开无参 (或所有参数都可选) 构造器.
                 *
                 * PluginData.value
                 */
                RESTRICTED_NO_ARG_CONSTRUCTOR, // NOT_CONSTRUCTABLE_TYPE
        
                RESTRICTED_CONSOLE_COMMAND_OWNER,
        
                RESTRICTED_ABSTRACT_MESSAGE_KEYS;
        
                public companion object
            }
        
            public companion object
        }
        

        这部分是net.mamoe.mirai.console.compiler.common.ResolveContext的代码,我应该没有修改过这部分

        /*
         * Copyright 2019-2021 Mamoe Technologies and contributors.
         *
         *  此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
         *  Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
         *
         *  https://github.com/mamoe/mirai/blob/master/LICENSE
         */
        
        package net.mamoe.mirai.console.compiler.common
        
        import kotlin.annotation.AnnotationTarget.FUNCTION
        
        /**
         * 标记一个函数, 在其函数体内限制特定一些函数的使用.
         *
         * @suppress 这是实验性 API, 可能会在未来有不兼容变更
         */
        @Target(FUNCTION)
        @Retention(AnnotationRetention.BINARY)
        public annotation class RestrictedScope(
            vararg val kinds: Kind,
        ) {
            public enum class Kind {
                PERMISSION_REGISTER, // ILLEGAL_PERMISSION_REGISTER_USE
                COMMAND_REGISTER, // ILLEGAL_COMMAND_REGISTER_USE
            }
        }
        

        这部分是net.mamoe.mirai.console.compiler.common.RestrictedScope的代码,应该也没有修改动过

        1 Reply Last reply Reply Quote 0
        • N
          N70_ last edited by

          build.gradle.kt文件内容如下

          plugins {
              val kotlinVersion = "1.6.10"
              kotlin("jvm") version kotlinVersion
              kotlin("plugin.serialization") version kotlinVersion
          
              id("net.mamoe.mirai-console") version "2.12.0"
          }
          
          group = "org.YeXiaoU"
          version = "0.1.0"
          
          repositories {
              maven("https://maven.aliyun.com/repository/public") // 阿里云国内代理仓库
              mavenCentral()
          }
          
          1 Reply Last reply Reply Quote 0
          • cssxsh
            cssxsh last edited by

            java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector

            检查一下 gradle 版本 和 jdk 版本

            1 Reply Last reply Reply Quote 0
            • abc408880155
              abc408880155 last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • abc408880155
                abc408880155 last edited by

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact