将android库上传到JitPack.io

时间:2018-10-06 15:05:51

标签: android jitpack

我制作了一个Android库,并上传到了Github。 (https://github.com/ABPSoft/ABPUiHelper

现在,我想添加到jitpack.io。 但是我得到一个错误!

如何上传到jitpack.io?

https://jitpack.io/#ABPSoft/ABPUiHelper

这是我的错误日志:

Build starting...
Start: Sat Oct 6 15:28:13 UTC 2018 d3
Git:
1.2.7-0-gbcf82d4
commit bcf82d4747110e8763af9d2d6abfb649a0e9cea7
Merge: 0a31b6e 8627f85
Author: Amin Bahrami 
Date:   Sat Oct 6 18:57:09 2018 +0330

    Merge branch 'master' of https://github.com/ABPSoft/ABPUiHelper

Run gradle build
Gradle build script

ERROR: Gradle wrapper not found. Please add. Using default gradle to build.

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all -Dhttps.protocols=TLSv1.2

Welcome to Gradle 4.8.1!

Here are the highlights of this release:
 - Dependency locking
 - Maven Publish and Ivy Publish plugins improved and marked stable
 - Incremental annotation processing enhancements
 - APIs to configure tasks at creation time

For more details see https://docs.gradle.org/4.8.1/release-notes.html


------------------------------------------------------------
Gradle 4.8.1
------------------------------------------------------------

Build time:   2018-06-21 07:53:06 UTC
Revision:     0abdea078047b12df42e7750ccba34d69b516a22

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM:          1.8.0_181 (Oracle Corporation 25.181-b13)
OS:           Linux 4.14.15-xxxx-std-ipv6-64 amd64

0m0.743s
Getting tasks: gradle tasks --all
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all -Dhttps.protocols=TLSv1.2

FAILURE: Build failed with an exception.

* Where:
Build file '/home/jitpack/build/build.gradle' line: 1

* What went wrong:
A problem occurred evaluating root project 'build'.
> Plugin with id 'com.github.dcendents.android-maven' not found.

* 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 1s

WARNING:
Gradle 'install' task not found. Please add the 'maven' or 'android-maven' plugin.
See the documentation and examples: https://jitpack.io/docs/

Looking for android-library
Looking for com.android.application
Adding maven plugin
Running: gradle clean -Pgroup=com.github.ABPSoft -Pversion=1.2.7 install
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all -Dhttps.protocols=TLSv1.2

FAILURE: Build failed with an exception.

* Where:
Build file '/home/jitpack/build/build.gradle' line: 1

* What went wrong:
A problem occurred evaluating root project 'build'.
> Plugin with id 'com.github.dcendents.android-maven' not found.

* 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 0s
EXIT_CODE=1
2018-10-06T15:28:16.88044162Z
Exit code: 1
No build artifacts found

谢谢

1 个答案:

答案 0 :(得分:0)

发生此错误是因为您的项目结构不正确。您当前的项目仅包含库部分。它还应包含如下结构的根项目文件:

ABPUiHelper
   - gradle  
   - YourLibraryModule  
   - build.gradle  
   - gradle.properties  
   - gradlew  
   - local.properties
   - settings.gradle

然后,从错误日志中,您可以看到jitpack.io找不到所需的插件:

* What went wrong:
A problem occurred evaluating root project 'build'.
> Plugin with id 'com.github.dcendents.android-maven' not found.

因此,请确保您在 root build.gradle中具有该插件,如下所示:

buildscript {
  repositories {
    jcenter()
    google()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.2.0'

    // This should be exist
    classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
  }
}

...