MiraiForum

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

    插件打包时如何带上依赖的 jar

    开发交流
    6
    22
    2060
    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.
    • S
      ShaoLongFei last edited by

      我依赖了一些第三方的 jar ,但是发现打出来的 jar 中没有它们,我该怎么做?

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

        gradlew buildPlugin

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

          如果是 Gradle, 使用 shadowJar

          1 Reply Last reply Reply Quote 1
          • S
            ShaoLongFei last edited by

            我试了 shadowJar ,不管用啊。
            gradlew buildPlugin 也不管用啊

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

              Your build.gradle(.kts)?

              1 Reply Last reply Reply Quote 0
              • S
                ShaoLongFei last edited by

                不是,用的 Groovy

                1 Reply Last reply Reply Quote 0
                • S
                  ShaoLongFei last edited by

                  plugins {
                  id 'org.jetbrains.kotlin.jvm' version '1.4.30'
                  id 'org.jetbrains.kotlin.plugin.serialization' version '1.4.30'
                  id 'net.mamoe.mirai-console' version '2.6.5'
                  }

                  group = 'com.liuyue'
                  version = '1.0'

                  repositories {
                  maven { url 'https://maven.aliyun.com/repository/public' }
                  mavenCentral()
                  }

                  dependencies {
                  compile files('libs/sqlite-jdbc-3.7.2.jar')
                  }

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

                    你真的确定使用 buildPlugin 打包出来的 jar 没有依赖吗

                    1 Reply Last reply Reply Quote 0
                    • S
                      ShaoLongFei last edited by

                      是的

                      1 Reply Last reply Reply Quote 0
                      • S
                        ShaoLongFei last edited by

                        亲眼所见,打出来只有5KB

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

                          老哥把你打包后目录结构和内容发出来给大家看看吧

                          S 1 Reply Last reply Reply Quote 0
                          • S
                            ShaoLongFei @yoonching last edited by

                            @yoonching 在 插件打包时如何带上依赖的 jar 中说:

                            老哥把你打包后目录结构和内容发出来给大家看看吧

                            2aa212ae-ef31-4ccf-87da-3cd68245511e-image.png

                            c01e4e5d-f368-4561-a238-cc3c08e26317-image.png

                            1 Reply Last reply Reply Quote 0
                            • S
                              ShaoLongFei last edited by

                              这个不在引用里不能粘图吗?
                              这个问题我解决了好久,依旧无法解决,是不是必须得使用 build.gradle(.kts) 才行,必须用 kotlin 开发才行?

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

                                build/mirai 那个就是

                                S 1 Reply Last reply Reply Quote 0
                                • S
                                  ShaoLongFei @Karlatemp last edited by

                                  @karlatemp 在 插件打包时如何带上依赖的 jar 中说:

                                  build/mirai 那个就是

                                  但是它只有 5 KB,它没有包含 jar

                                  cssxsh 1 Reply Last reply Reply Quote 0
                                  • cssxsh
                                    cssxsh @ShaoLongFei last edited by

                                    @shaolongfei

                                    dependencies {
                                        implementation files('libs/sqlite-jdbc-3.7.2.jar')
                                    }
                                    

                                    话说你都用gradle了,直接引用maven库不好吗

                                    dependencies {
                                        implementation 'org.xerial:sqlite-jdbc:3.34.0'
                                    }
                                    
                                    S 1 Reply Last reply Reply Quote 0
                                    • S
                                      ShaoLongFei @cssxsh last edited by

                                      @cssxsh 在 插件打包时如何带上依赖的 jar 中说:

                                      @shaolongfei

                                      dependencies {
                                          implementation files('libs/sqlite-jdbc-3.7.2.jar')
                                      }
                                      

                                      话说你都用gradle了,直接引用maven库不好吗

                                      dependencies {
                                          implementation 'org.xerial:sqlite-jdbc:3.34.0'
                                      }
                                      

                                      没有用,这么写打出来还是没有,我现在是自己打包然后修改 jar ,暂时的解决了问题

                                      cssxsh 1 Reply Last reply Reply Quote 0
                                      • cssxsh
                                        cssxsh @ShaoLongFei last edited by

                                        @shaolongfei
                                        没包含有可能是引用的库没有被标记为打包的内容,你是用 implementation 的吗

                                        1 Reply Last reply Reply Quote 0
                                        • S
                                          ShaoLongFei last edited by

                                          用的 api,implementation没有用

                                          1 Reply Last reply Reply Quote 0
                                          • S
                                            SCX-snow last edited by

                                            你可以试一下直接带着依赖包一起放到插件目录里,应该就能够运行了

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