从构建脚本配置 gradle 插件
Configuring gradle plugin from build script
我有一个 gradle 构建脚本,它使用第二个插件使用的 binary plugin, and this plugin in turn uses another plugin. I need to change one of the configuration values - 我不能简单地手动编辑这个插件的配置,因为它是在构建时下载的。我正在寻找一种方法来从我的顶级构建脚本中指定配置值,这可能吗?
在karma-gradle
插件中,应用了node
插件like that:
private static void setupNode(Project project) {
project.plugins.apply NodePlugin
NodeExtension nodeConfig = project.extensions.findByName('node') as NodeExtension
nodeConfig.download = true
nodeConfig.version = DEFAULT_NODE_VERSION
}
因此您可以简单地在构建脚本的 node
块中设置所有需要的属性,因为它是从 project
.
中读取的
node {
// Version of node to use.
version = '0.11.10'
// Version of npm to use.
npmVersion = '2.1.5'
// ...
}
我有一个 gradle 构建脚本,它使用第二个插件使用的 binary plugin, and this plugin in turn uses another plugin. I need to change one of the configuration values - 我不能简单地手动编辑这个插件的配置,因为它是在构建时下载的。我正在寻找一种方法来从我的顶级构建脚本中指定配置值,这可能吗?
在karma-gradle
插件中,应用了node
插件like that:
private static void setupNode(Project project) {
project.plugins.apply NodePlugin
NodeExtension nodeConfig = project.extensions.findByName('node') as NodeExtension
nodeConfig.download = true
nodeConfig.version = DEFAULT_NODE_VERSION
}
因此您可以简单地在构建脚本的 node
块中设置所有需要的属性,因为它是从 project
.
node {
// Version of node to use.
version = '0.11.10'
// Version of npm to use.
npmVersion = '2.1.5'
// ...
}