MiraiForum

    • 注册
    • 登录
    • 搜索
    • 热门
    • 最新
    • 未解决
    • 标签
    • 群组
    • 友情链接
    1. 主页
    2. Duelist-Fiora
    3. 帖子
    D
    • 资料
    • 关注 0
    • 粉丝 0
    • 主题 1
    • 帖子 4
    • 最佳 0
    • 有争议的 0
    • 群组 0

    Duelist-Fiora 发布的帖子

    • RE: 如何将官方文档中的hello world项目打成jar包

      已解决 https://github.com/mamoe/mirai/discussions/746

      发布在 开发交流
      D
      Duelist-Fiora
    • RE: 无法和SpringBoot一起打包,提示选择variants

      我也是这个问题, 你有找到解决办法吗

      发布在 开发交流
      D
      Duelist-Fiora
    • RE: 如何将官方文档中的hello world项目打成jar包

      @RayyyWW 在 如何将官方文档中的hello world项目打成jar包 中说:

      build 而不是jar

      改为使用build之后出现了Could not resolve net.mamoe:mirai-core-api的异常, 还是没有打包成功


      完整的错误日志

      Execution failed for task ':bootJarMainClassName'.
      > Could not resolve all files for configuration ':productionRuntimeClasspath'.
         > Could not resolve net.mamoe:mirai-core-api:2.6.2.
           Required by:
               project :
            > The consumer was configured to find a runtime of a component, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of net.mamoe:mirai-core-api:2.6.2:
                - androidRuntimeElements-published
                - commonRuntimeElements-published
                - jvmRuntimeElements-published
              All of them match the consumer attributes:
                - Variant 'androidRuntimeElements-published' capability net.mamoe:mirai-core-api:2.6.2 declares a runtime of a component, packaged as a jar:
                    - Unmatched attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Provides release status but the consumer didn't ask for it
                        - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
                - Variant 'commonRuntimeElements-published' capability net.mamoe:mirai-core-api:2.6.2 declares a runtime of a component, packaged as a jar:
                    - Unmatched attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Provides release status but the consumer didn't ask for it
                        - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'common' but the consumer didn't ask for it
                - Variant 'jvmRuntimeElements-published' capability net.mamoe:mirai-core-api:2.6.2 declares a runtime of a component, packaged as a jar:
                    - Unmatched attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Provides release status but the consumer didn't ask for it
                        - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but the consumer didn't ask for it
              The following variants were also considered but didn't match the requested attributes:
                - Variant 'androidApiElements-published' capability net.mamoe:mirai-core-api:2.6.2 declares a component, packaged as a jar:
                    - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
                    - Other compatible attribute:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                - Variant 'commonApiElements-published' capability net.mamoe:mirai-core-api:2.6.2 declares a component, packaged as a jar:
                    - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
                    - Other compatible attribute:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                - Variant 'commonMainMetadataElements-published' capability net.mamoe:mirai-core-api:2.6.2:
                    - Incompatible because this component declares a usage of 'kotlin-api' of a component and the consumer needed a runtime of a component
                    - Other compatible attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Doesn't say anything about its elements (required them packaged as a jar)
                - Variant 'jvmApiElements-published' capability net.mamoe:mirai-core-api:2.6.2 declares a component, packaged as a jar:
                    - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
                    - Other compatible attribute:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                - Variant 'metadataApiElements-published' capability net.mamoe:mirai-core-api:2.6.2:
                    - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a runtime of a component
                    - Other compatible attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Doesn't say anything about its elements (required them packaged as a jar)
         > Could not resolve net.mamoe:mirai-core:2.6.2.
           Required by:
               project :
            > The consumer was configured to find a runtime of a component, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of net.mamoe:mirai-core:2.6.2:
                - androidRuntimeElements-published
                - commonRuntimeElements-published
                - jvmRuntimeElements-published
              All of them match the consumer attributes:
                - Variant 'androidRuntimeElements-published' capability net.mamoe:mirai-core:2.6.2 declares a runtime of a component, packaged as a jar:
                    - Unmatched attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Provides release status but the consumer didn't ask for it
                        - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
                - Variant 'commonRuntimeElements-published' capability net.mamoe:mirai-core:2.6.2 declares a runtime of a component, packaged as a jar:
                    - Unmatched attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Provides release status but the consumer didn't ask for it
                        - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'common' but the consumer didn't ask for it
                - Variant 'jvmRuntimeElements-published' capability net.mamoe:mirai-core:2.6.2 declares a runtime of a component, packaged as a jar:
                    - Unmatched attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Provides release status but the consumer didn't ask for it
                        - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but the consumer didn't ask for it
              The following variants were also considered but didn't match the requested attributes:
                - Variant 'androidApiElements-published' capability net.mamoe:mirai-core:2.6.2 declares a component, packaged as a jar:
                    - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
                    - Other compatible attribute:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                - Variant 'commonApiElements-published' capability net.mamoe:mirai-core:2.6.2 declares a component, packaged as a jar:
                    - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
                    - Other compatible attribute:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                - Variant 'commonMainMetadataElements-published' capability net.mamoe:mirai-core:2.6.2:
                    - Incompatible because this component declares a usage of 'kotlin-api' of a component and the consumer needed a runtime of a component
                    - Other compatible attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Doesn't say anything about its elements (required them packaged as a jar)
                - Variant 'jvmApiElements-published' capability net.mamoe:mirai-core:2.6.2 declares a component, packaged as a jar:
                    - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
                    - Other compatible attribute:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                - Variant 'metadataApiElements-published' capability net.mamoe:mirai-core:2.6.2:
                    - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a runtime of a component
                    - Other compatible attributes:
                        - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                        - Doesn't say anything about its elements (required them packaged as a jar)
      
      
      
      发布在 开发交流
      D
      Duelist-Fiora
    • 如何将官方文档中的hello world项目打成jar包

      问题描述

      我在文档中的hello world 项目 (https://github.com/project-mirai/mirai-hello-world ) 的基础上写了一个spring boot 项目, 想要将其打成jar包放到服务器运行

      我没有gradle的使用经验, 初步搜索之后了解到可以直接使用IDEA的gradle功能进行打包, 但是没有成功

      gradle打包日志

      6:25:57 下午: Executing task 'jar'...
      
      > Task :compileKotlin
      > Task :compileJava
      > Task :processResources UP-TO-DATE
      > Task :classes
      > Task :inspectClassesForKotlinIC
      > Task :jar SKIPPED
      
      BUILD SUCCESSFUL in 1s
      4 actionable tasks: 3 executed, 1 up-to-date
      6:25:59 下午: Task execution finished 'jar'.
      

      我使用的IDEA功能入口

      2593f6a4-8075-4ea5-9a53-f6825198fc21-image.png

      我的build.gradle.kts文件内容

      import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
      
      plugins {
          java
          kotlin("jvm") version "1.4.32"
          id("org.springframework.boot") version "2.4.4"
          id("io.spring.dependency-management") version "1.0.11.RELEASE"
      
      }
      
      group = "org.example"
      version = "0.1.0"
      
      repositories {
          mavenCentral()
      }
      
      tasks.withType(KotlinJvmCompile::class.java) {
          kotlinOptions.jvmTarget = "1.8"
      }
      
      
      dependencies {
          api("net.mamoe:mirai-core-api:${properties["version.mirai"]}")
          runtimeOnly("net.mamoe:mirai-core:${properties["version.mirai"]}")
          implementation("org.springframework.boot:spring-boot-starter")
          implementation("org.springframework.boot:spring-boot-starter-web")
          implementation("org.springframework.boot:spring-boot-starter-data-redis")
      
          implementation("mysql:mysql-connector-java:8.0.28")
          implementation("com.baomidou:mybatis-plus-boot-starter:3.5.1")
      
          compileOnly("org.projectlombok:lombok:1.18.24")
          annotationProcessor("org.projectlombok:lombok:1.18.24")
          implementation("cn.hutool:hutool-all:5.7.22")
          implementation("com.github.xiaoymin:knife4j-spring-boot-starter:3.0.3")
      }
      
      发布在 开发交流
      D
      Duelist-Fiora
    • 1 / 1