Gradle 7 and Jitpack.Io Runs into Error During Publish

Gradle 7 and jitpack.io runs into error during publish

The Maven plugin has been eliminated in Gradle 7.0, please use the maven-publish plugin instead.

I made it work with

plugins {
id 'maven-publish'
...
}

task androidSourcesJar(type: Jar) {
classifier 'sources'
from android.sourceSets.main.java.srcDirs
}

project.afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
artifact androidSourcesJar // optional sources
}
}
}
}

and you need an own jitpack.yml

jdk:
- openjdk11
install:
- ./gradlew build :lib:publishToMavenLocal

Here you see complete pull request https://github.com/AppDevNext/Moka/pull/77 now it works https://jitpack.io/#AppDevNext/moka/1.0

Android gradle fails to resolve jitpack snapshot build dependency

Check your repositority on jitpack.io, and verify that the snapshot was actually built. (Enter your repo url, select 'branches', you must see a green icon near your commit sha)
Also if your repository is private, you'd need to add access token in build.gradle (you can find it in ur account setting)

jitpack.io failed to resolve github repo

After a few attempts and thanks to jitpack support now I can import my library hosted in Github as a Android Gradle dependency.

I will provide a a few very useful links:

How setup your java library

https://jitpack.io/docs/BUILDING/#gradle-projects

How check logs of your dependency in jitpack

https://jitpack.io/com/github/USER/REPO/TAG/build.log

In my case

https://jitpack.io/com/github/rchampa/DropboxHttpConector/1.0.3/build.log

Can't publish on jitpack

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



Related Topics



Leave a reply



Submit