When I upgrade in an Android project to Gradle 7.0 and want to publish aar library in jitpack.io I run into
Script '/script/maven-plugin.gradle' line: 2
* What went wrong:
A problem occurred evaluating script.
> Failed to apply plugin 'com.github.dcendents.android-maven'.
> Could not create plugin of type 'AndroidMavenPlugin'.
> Could not generate a decorated class for type AndroidMavenPlugin.
> org/gradle/api/publication/maven/internal/MavenPomMetaInfoProvider
See full log https://jitpack.io/com/github/appdevnext/moka/0.7.1/build.log
Edit the build.gradle.kts file to allow this library to be published to GitHub Packages . Here are the high level steps. Add some plugins so that we can publish this project to GitHub Packages. Configure the maven publishing plugin. More info. To publish, you have to run the gradle task named publish.
The Maven plugin has been eliminated in Gradle 7.0, please use the maven-publish plugin instead.
Before you can publish this library, make sure that you can run the following commands, that ensure that JitPack can build this repo using gradle. In order to publish this repo to JitPack you have to do the following things. Make the changes that you want the repo, and commit and push it.
Because the JitPack is not a "standard" Maven repository, you have tell plugins DSL about it. To do this, add following block to your project's settings.gradle.kt file.
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
DSL version
publishing {
publications {
val mavenJava by creating(MavenPublication::class) {
from(components["java"])
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With