I can't publish an android library using maven-publish plugin

Viewed 912

I have an android project inside the project I have an android module. I try to publish an maven artifact but I got the next message Publications(s) specified but no publications exist in project :.

My project build.gradle is the next:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.3.72"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

plugins {
    id "com.jfrog.bintray" version "1.8.5"
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

My gradle module is the next:

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'maven-publish'

android {
    compileSdkVersion 29
    buildToolsVersion "30.0.0"

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.3.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7'
}

afterEvaluate {
    publishing {
        publications {
            // Creates a Maven publication called "release".
            release(MavenPublication) {
                // Applies the component for the release build variant.
                from components.release

                // You can then customize attributes of the publication as shown below.
                groupId = 'io.github.rockbass2560'
                artifactId = 'imageprogress'
                version = '1.0.0'
            }
        }
    }
}

def localProperties = new Properties()
localProperties.load(new FileInputStream(rootProject.file("local.properties")))

bintray {
    user = localProperties.getProperty("bintray.user")
    key = localProperties.getProperty("bintray.apikey")
    publications = ['release']
    pkg {
        repo = 'imageprogress'
        name = 'imageprogress'
        userOrg = user
        licenses = ['Apache-2.0']
        vcsUrl = 'https://github.com/rockbass2560/ImageProgress.git'
        version {
            name = '1.0-Final'
            desc = 'First version for ImageProgress plugin'
            released  = new Date()
            vcsTag = '1.0.0'
            attributes = ['version': '1','released':true]
        }
    }
}

I have made tutorials on android page and other pages but I can't get fix the issue.

0 Answers
Related