我正在开发一个基于Android项目的自定义gradle插件。我想通过另一个插件发布我的插件(https://plugins.gradle.org/docs/publish-plugin)这是我的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'
}
}
}
当我运行时:
./gradlew uploadArchives
我收到此错误:
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
答案 0 :(得分:1)
对不起,我真正想做的是这里描述的:
http://code.tutsplus.com/tutorials/creating-and-publishing-an-android-library--cms-24582
发布我的Android库,以便任何人都可以通过gradle
访问它