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
Sagar
  • 23,903
  • 4
  • 62
  • 62
Mykhailo Yuzheka
  • 713
  • 1
  • 7
  • 24
  • Seems like the build can't find any artifacts (_No build artifacts found_). Can you share your Gradle configuration? – wasyl May 12 '18 at 17:22
  • @wasyl You can find github repo in link above – Mykhailo Yuzheka May 13 '18 at 14:43
  • ``` :clean :app:clean UP-TO-DATE :busybox:clean UP-TO-DATE :busybox:install ``` looks like there is no `assemble` triggered – Quentin Klein May 15 '18 at 09:01
  • @quentin-klein Do you know how to make jitpack to trigger assemble process? – Mykhailo Yuzheka May 15 '18 at 11:43
  • @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 hurt – wasyl May 19 '18 at 17:02
  • @wasyl 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 https://jitpack.io/com/github/yzheka/Busybox/1.28.1/build.log – Mykhailo Yuzheka May 21 '18 at 07:53
  • @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'` – Mykhailo Yuzheka May 22 '18 at 08:00
  • Not what I was stating: First apply `com.android.library` and after `com.github.dcendents.android-maven`. – tynn May 22 '18 at 08:05
  • @tynn Still the same. – Mykhailo Yuzheka May 22 '18 at 09:46
  • 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. – tynn May 22 '18 at 18:46

2 Answers2

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.

I just made it for you as an example see the repository which I forked from you here https://github.com/markizdeviler/Busybox

Muhammadakbar Rafikov
  • 775
  • 1
  • 11
  • 19
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
Mori
  • 2,653
  • 18
  • 24