Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何从 Gradle 插件中以编程方式检索 Gradle 本身的版本?
刚刚发现可以使用任何一种
getProject().getGradle().getGradleVersion()
或者
Plugin.class.getPackage().getImplementationVersion()
当我搜索它时,这个问题作为第一个结果出现。
有一个类 - GradleVersion 也可以完成这项工作。所以
GradleVersion.current();
将返回与