简体   繁体   English

如何在index.html或javascript中获取Gradle构建版本

[英]How to get Gradle build version in index.html or in javascript

I have gradle build for my project, some of the details defined in project.ext section of build.gradle file. 我已经为我的项目构建了gradle build,在build.gradle文件的project.ext部分定义了一些细节。

project.ext {
  myVar1 = "Var1";
  myVar2 = "Var2";
  .....
}

Is there any way I can access those variables using grunt or anything to use in html file or in javascript? 有什么办法可以使用grunt或在html文件或javascript中使用的任何东西来访问这些变量?

Any help is much appreciated. 任何帮助深表感谢。

Yes you can do it but only through filtering - not directly - see this part of gradle docs. 是的,您可以做到,但只能通过过滤-不能直接进行-请参阅gradle文档的这一部分。 Basically filtering is done while copying artifacts to other destination. 基本上,在将工件复制到其他目标时进行过滤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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