本文介绍了在gradle中,如何为插件版本使用变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个构建脚本导入了nebula插件:

 插件{
id'nebula.ospackage'版本'3.5.0'
}

我将所有版本信息一个单独的文件,所有项目都可以访问并且想知道什么是正确的语法转换为类似:

  plugins {
id'nebula.ospackage'version$ versions.nebula_gradle_ospackage_plugin
}

当我尝试使用gradle clean build运行上面的代码时,出现以下错误:





One of my build scripts imports that nebula plugin:

plugins {
  id 'nebula.ospackage' version '3.5.0'
}

I've been moving all of my version info into a separate file that all projects have access to and am wondering what is the correct syntax to convert to something like:

plugins {
  id 'nebula.ospackage' version "$versions.nebula_gradle_ospackage_plugin"
}

When I try running the above with "gradle clean build", I get the following error:

The linked article shows how I could use the "buildscript" block, which works, but it seems like there must be a way to make this work in a single line?

解决方案

You cannot use variable here:

这篇关于在gradle中,如何为插件版本使用变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 08:18