简体   繁体   English

如何从 github 库构建 gradle jar

[英]How to build a gradle jar from a github library

I have attempted to rebuild the jar for https://github.com/square/okhttp library.我试图为https://github.com/square/okhttp库重建 jar。 However, this is the error I get after first cloning it and then calling "gradle assemble".然而,这是我在第一次克隆它然后调用“gradle assemble”后得到的错误。 Is there something incorrect about my method?我的方法有什么不正确的地方吗?

FAILURE: Build failed with an exception.失败:构建失败,出现异常。

  • Where: Build file '/Users/test/okhttptest/okhttp/build.gradle' line: 75其中:构建文件“/Users/test/okhttptest/okhttp/build.gradle”行:75

  • What went wrong: Plugin [id: 'ru.vyarus.animalsniffer', version: '1.5.1'] was not found in any of the following sources:出了什么问题:在以下任何来源中都找不到插件 [id: 'ru.vyarus.animalsniffer', version: '1.5.1']:

  • Gradle Core Plugins (plugin is not in 'org.gradle' namespace) Gradle 核心插件(插件不在“org.gradle”命名空间中)
  • Plugin Repositories (could not resolve plugin artifact 'ru.vyarus.animalsniffer:ru.vyarus.animalsniffer.gradle.plugin:1.5.1') Searched in the following repositories: Gradle Central Plugin Repository插件存储库(无法解析插件工件“ru.vyarus.animalsniffer:ru.vyarus.animalsniffer.gradle.plugin:1.5.1”)在以下存储库中搜索:Gradle 中央插件存储库
  • Try: Run with --stacktrace option to get the stack trace.尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output. Run with --scan to get full insights.使用 --info 或 --debug 选项运行以获取更多日志 output。使用 --scan 运行以获取完整的见解。

  • Get more help at https://help.gradle.orghttps://help.gradle.org获得更多帮助

BUILD FAILED in 617ms在 617 毫秒内构建失败

You problem is that you are using a locally installed gradle version since your call is "gradle assemble".您的问题是您使用的是本地安装的 gradle 版本,因为您的调用是“gradle assemble”。 your gradle version is propably too old so you it can't handle the plugin.您的 gradle 版本可能太旧,因此您无法处理该插件。

This repository has a gradle-wrapper (gradlew) checked in.这个存储库有一个 gradle-wrapper (gradlew) 签入。

https://docs.gradle.org/current/userguide/gradle_wrapper.html https://docs.gradle.org/current/userguide/gradle_wrapper.html

change your call into./gradlew assemble and the wrapper will handle the download of the required gradle version and will handle all the dependencies for you.将您的调用更改为 ./gradlew assemble ,包装器将处理所需 gradle 版本的下载,并将为您处理所有依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM