Can't publish on jitpack
Asked Answered
J

2

11

I have a problem with publishing multi-flavor library to jitpack. The log says that build success but the status is error

enter image description here

I've followed instructions on jitpack site but their sample uses old gradle version and it did not work with gradle 4.4

Here is the log:

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
Jenevajeni answered 20/4, 2018 at 7:46 Comment(10)
Seems like the build can't find any artifacts (No build artifacts found). Can you share your Gradle configuration?Eventempered
@Eventempered You can find github repo in link aboveJenevajeni
``` :clean :app:clean UP-TO-DATE :busybox:clean UP-TO-DATE :busybox:install ``` looks like there is no assemble triggeredPalp
@quentin-klein Do you know how to make jitpack to trigger assemble process?Jenevajeni
@MykhailoYuzheka you would add in your busybox/build.gradle: afterEvaluate { project.tasks.findByName('install').dependsOn('assemble') }. afterEvaluate might not be needed in fact, but it probably won't hurtEventempered
@Eventempered This is not helped. Now I can see that all assemble tasks executed build successfull but it still marked as error in kitpack and still no artifacts found jitpack.io/com/github/yzheka/Busybox/1.28.1/build.logJenevajeni
@tynn Yes, I've added apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'de.undercouch.download'Jenevajeni
Not what I was stating: First apply com.android.library and after com.github.dcendents.android-maven.Audiometer
@Audiometer Still the same.Jenevajeni
The assemble task is not used for libraries, it's the bundle task instead. So you can remove project.tasks.findByName('install').dependsOn('assemble') and trust the plugins to setup the graph properly.Audiometer
H
4

In jitpack log you can see why jitpack can't publish your library. Just delete some part of your code because of jitpack error.

Cannot get the value of write-only property 'publishNonDefault' for object of type com.android.build.gradle.LibraryExtension.

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

Then jitpack do not show the error when publishing your library. Works like a charm. To publish your library just realese once again then publish your libary.

Heshvan answered 23/5, 2018 at 19:17 Comment(0)
B
0

This way is worked for me:

Add these line in the Module gradle after dependencies part :

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
            }
        }
    }
}

after that you can see:

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
Brigade answered 22/1, 2022 at 9:50 Comment(1)

© 2022 - 2024 — McMap. All rights reserved.