简体   繁体   中英

Gradle Plugin Publishing Plugin with android

I am developing a custom gradle plugin based on a Android project. And I want to publish my plugin via another plugin ( https://plugins.gradle.org/docs/publish-plugin ) This is my build.gradle:

apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: "com.gradle.plugin-publish"

buildscript {
    repositories {
        mavenCentral()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        classpath "com.gradle.publish:plugin-publish-plugin:0.9.3"
    }
}

repositories {
    jcenter()
}

group = 'com.myplugin'
version = '1.0-SNAPSHOT'

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: uri('../repo'))
        }
    }
}

android {
    compileSdkVersion 21
    buildToolsVersion "22.0.1"

    defaultConfig {
        minSdkVersion 18
        targetSdkVersion 19
    }

    lintOptions {
        abortOnError false
    }
}

dependencies {
    compile gradleApi()
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.3'
}

pluginBundle {
    website = 'http://www.example.com/'
    description = 'Welcome to bla bla'
    tags = ['test', 'test']
    plugins {
        PluginName {
            id = 'com.something'
            displayName = 'My Plugin'
        }
    }
}

When I run this:

./gradlew uploadArchives

I get this error:

Parallel execution with configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'mylib'.
> The 'java' plugin has been applied, but it is not compatible with the Android plugins.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.543 secs

I am sorry, what I really wanted to do is described here:

http://code.tutsplus.com/tutorials/creating-and-publishing-an-android-library--cms-24582

Publish my android library so anyone could access it via gradle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM