什么是应用插件:'java' [英] What is apply plugin: 'java'

查看:240
本文介绍了什么是应用插件:'java'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如Gradle 文档 第6.4节:


Gradle的构建脚本为您提供了Groovy的全部功能。


我碰到以下命令:

  apply plugin:'java'

我试图从Groovy的角度去寻找它意味着什么,但我不知道。是否有Groovy等价物?

解决方案

您看到的是Groovy为方法调用提供的语法糖。 [方法调用中没有大括号&隐式映射强制]
$ b

apply plugin:'java' apply([插件:'java'])



apply() 。默认情况下,API和项目实例在Gradle构建脚本中可用。 (在Groovy术语中, build.gradle 中的操作被委托给项目


As said in the Gradle documentation, section 6.4:

Gradle's build scripts give you the full power of Groovy.

I come across the following command:

apply plugin: 'java'

I tried to googling to encquire what it means at the Groovy point of view, but I have no idea. Is there a Groovy equivalent at all?

解决方案

What you see is a syntactic sugar provided by Groovy for a method call. [No braces in method calls & implicit map coercion]

apply plugin: 'java' is same as apply([plugin: 'java'])

apply() is available in Gradle's Project API and project instance is available in Gradle build script by default. (In Groovy terms, operations in build.gradle is delegated to project)

这篇关于什么是应用插件:'java'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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