自定义插件摇篮ID未找到 [英] Custom Gradle Plugin ID not found

查看:1276
本文介绍了自定义插件摇篮ID未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个摇篮插件,我没能获得应用插件:命令在使用该插件的摇篮脚本工作。我使用的摇篮1.1。

我已经建立与干净构建插件,我试图通过扁平回购,将其添加到摇篮建立了。这似乎是工作,但摇篮不捡,有ID为插件测试插件。在项目名称插件的 settings.gradle 测试插件和性质文件META-INF / gradle这个-插件 test-plugin.properties 。我不知道还有什么地方我可以指定插件ID。

在项目中的 gradle.build 文件正在使用测试插件

  {库
  flatDir名称:'库',迪尔斯:../build/libs
}依赖{
  编译测试:测试插件:0.1
}应用插件:测试插件

从摇篮错误:

 出了什么问题:
发生问题的根源评估项目TMP。
插件ID为测试插件找不到。


解决方案

该插件已罐被添加为的构建脚本依赖的:

  buildscript {
    库{flatDir名称:'库',迪尔斯:../build/libs}
    依赖{classpath中'测试:测试插件:0.1'}
}应用插件:测试插件

I'm writing a Gradle plugin and I'm failing to get the apply plugin: command to work in the Gradle script that uses the plugin. I'm using Gradle 1.1.

I've build the plugin with clean build and I'm attempting to add it to the Gradle build via a flat repo for now. That seems to be working but Gradle isn't picking up that there is a plugin with the ID test-plugin. The project name in the plugin's settings.gradle is test-plugin and the properties file in META-INF/gradle-plugins is also test-plugin.properties. I'm not sure where else I can specify the plugin ID.

The gradle.build file in the project that is using the test-plugin:

repositories {
  flatDir name: 'libs', dirs: "../build/libs"
}

dependencies {
  compile 'test:test-plugin:0.1'
}

apply plugin: 'test-plugin'

Error from Gradle:

What went wrong:
A problem occurred evaluating root project 'tmp'.
Plugin with id 'test-plugin' not found.

解决方案

The plugin Jar has to be added as a build script dependency:

buildscript {
    repositories { flatDir name: 'libs', dirs: "../build/libs" }
    dependencies { classpath 'test:test-plugin:0.1' }
}

apply plugin: "test-plugin"

这篇关于自定义插件摇篮ID未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆