Почему получаю ошибку ERROR: No build artifacts found?
Создаю библиотеку для android, при попытке опубликовать библиотеку на jitpack, получаю ошибку ERROR: No build artifacts found $HOME/.m2/repository/com/github/buratinoapps/WSettings/1.0. Вот логи https://jitpack.io/com/github/buratinoapps/WSettings/1.0/build.log
Не находит артефакты в папке HOME но у меня артефакты лежат в папке C:\Users\USER\.m2\repository\com\github\buratinoapps\WSettings\1.0
Вот build.gradle библиотеки
plugins {
id 'com.android.library'
id 'maven-publish'
}
android {
compileSdk 32
defaultConfig {
minSdk 21
targetSdk 32
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
versionCode 1
versionName '1.0'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
afterEvaluate {
publishing {
publications {
release(MavenPublication){
from components.release
groupId = 'com.github.buratinoapps' //your git id
artifactId = 'WSettings' //your-repository
version = '1.0' // As same as the Tag
artifact("$buildDir/outputs/aar/${artifactId}-release.aar") // here is difference, I used `from components...` before
// use this if you're using third party in your lib
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.implementation.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
Ответы (1 шт):
Автор решения: woesss
→ Ссылка
В логе написано что вы накосячили с POM-файлом. Попробуйте убрать блок pom.withXml {}, думаю этот финт не требуется.
Вот с таким конфигом у меня спокойно публикуются несколько библиотек:
anroid {
...
publishing {
singleVariant('release')
}
}
...
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
groupId = 'com.example'
artifactId = 'mylibrary'
version = '1.0'
}
}
}
}