【问题标题】:Can't publish on jitpack无法在 jitpack 上发布
【发布时间】:2018-09-30 20:59:15
【问题描述】:

我在将多风味 library 发布到 jitpack 时遇到问题。 日志说构建成功但状态为错误

我已按照 jitpack 网站上的说明进行操作,但他们的示例使用旧的 gradle 版本,并且不适用于 gradle 4.4

这是日志:

Build starting...
Start: Fri Apr 20 07:35:56 UTC 2018
Git:
1.28.1-1-g932f4d8
commit 932f4d88e13b1c8c52b4dbae8c203e7d52a0eadf
Author: yzheka 
Date:   Fri Apr 20 10:34:49 2018 +0300

    jitpack config


Run gradle build
Gradle build script
Found gradle version: 4.4.
Using gradle wrapper
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all
Downloading https://services.gradle.org/distributions/gradle-4.4-all.zip
..............................................................................................
Unzipping /home/jitpack/.gradle/wrapper/dists/gradle-4.4-all/9br9xq1tocpiv8o6njlyu5op1/gradle-4.4-all.zip to /home/jitpack/.gradle/wrapper/dists/gradle-4.4-all/9br9xq1tocpiv8o6njlyu5op1
Set executable permissions for: /home/jitpack/.gradle/wrapper/dists/gradle-4.4-all/9br9xq1tocpiv8o6njlyu5op1/gradle-4.4/bin/gradle

------------------------------------------------------------
Gradle 4.4
------------------------------------------------------------

Build time:   2017-12-06 09:05:06 UTC
Revision:     cf7821a6f79f8e2a598df21780e3ff7ce8db2b82

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          1.8.0_131 (Oracle Corporation 25.131-b11)
OS:           Linux 4.14.15-xxxx-std-ipv6-64 amd64

0m4.923s
Getting a list of gradle tasks
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all
Running: ./gradlew clean -Pgroup=com.github.yzheka -Pversion=-1.28.1-g932f4d8-1 -xtest -xlint install
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all
:clean
:app:clean UP-TO-DATE
:busybox:clean UP-TO-DATE
:busybox:install

BUILD SUCCESSFUL in 0s
4 actionable tasks: 2 executed, 2 up-to-date
Looking for artifacts...
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all
EXIT_CODE=0
2018-04-20T07:36:32.030445377Z
Exit code: 0
No build artifacts found

【问题讨论】:

  • 似乎构建找不到任何工件(未找到构建工件)。你能分享一下你的 Gradle 配置吗?
  • @wasyl 你可以在上面的链接中找到 github repo
  • ``` :clean :app:clean UP-TO-DATE :busybox:clean UP-TO-DATE :busybox:install ``` 看起来没有assemble 触发
  • @quentin-klein 你知道如何制作 jitpack 来触发 assemble 过程吗?
  • @MykhailoYuzheka 你可以添加到你的busybox/build.gradle:afterEvaluate { project.tasks.findByName('install').dependsOn('assemble') }afterEvaluate 实际上可能不需要,但它可能不会受到伤害

标签: android gradle jitpack


【解决方案1】:

在 jitpack 日志中您可以看到 jitpack 无法发布您的库的原因。由于 jitpack 错误,只需删除部分代码即可。

无法为 com.android.build.gradle.LibraryExtension 类型的对象获取只写属性“publishNonDefault”的值。

if( android.publishNonDefault && variant.name == android.defaultPublishConfig ) {
                def bundleTask = tasks["bundle${name.capitalize()}"]
                artifacts {
                    archives(bundleTask.archivePath) {
                        classifier null
                        builtBy bundleTask
                    }
                }
            }
        }
    }

那么 jitpack 在发布你的库时不会显示错误。奇迹般有效。要发布您的库,只需再次发布您的库。

我只是为你做了一个例子,看看我从你这里分叉的存储库https://github.com/markizdeviler/Busybox

【讨论】:

    【解决方案2】:

    这种方式对我有用:

    Module gradle 之后的dependencies 部分添加这些行:

    afterEvaluate {
        publishing {
            publications {
                release(MavenPublication) {
                    from components.release
                    groupId = 'com.github.yourgitid' //your git id
                    artifactId = 'Myket-Intent' //your-repository
                    version = '0.1.15' // same as Tag
                }
            }
        }
    }
    

    之后你可以看到:

    BUILD SUCCESSFUL in 41s
    123 actionable tasks: 120 executed, 3 up-to-date
    Build tool exit code: 0
    Looking for artifacts...
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
    Looking for pom.xml in build directory and ~/.m2
    Found artifact: com.github.Mori-hub:Myket-Intent:0.1.15
    2022-01-22T09:38:10.889110195Z
    Exit code: 0
    
    Build artifacts:
    com.github.Mori-hub:Myket-Intent:0.1.15
    

    【讨论】:

    猜你喜欢
    • 2017-08-15
    • 2021-02-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-28
    • 2023-04-02
    • 2022-01-21
    • 2021-11-14
    相关资源
    最近更新 更多