本文介绍了Gradle 7和jitpack.io在发布期间出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在Android项目中升级到Gradle 7.0并想在jitpack.io中发布AAR库时,我遇到了
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
查看完整日志https://jitpack.io/com/github/appdevnext/moka/0.7.1/build.log
推荐答案
Gradle7.0中已取消maven插件,请改用maven-Publish插件。
我让它与
一起工作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
}
}
}
}
并且您需要自己的jitpack.yml
jdk:
- openjdk11
install:
- ./gradlew build :lib:publishToMavenLocal
这里您可以看到完整的拉取请求https://github.com/AppDevNext/Moka/pull/77现在可以工作https://jitpack.io/#AppDevNext/moka/1.0
这篇关于Gradle 7和jitpack.io在发布期间出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!