“与”的含义是什么?在gradle中 [英] Whats the meaning of "with" in gradle

查看:129
本文介绍了“与”的含义是什么?在gradle中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在答案 https://stackoverflow.com/a/35879150 中有一个,其中在最后一行:

In the answer https://stackoverflow.com/a/35879150 there is a with in the last line:

task gen (type: Jar) {
    description "Generates JAR without version number."
    archiveName = filename + ".jar"
    manifest {attributes 'Main-Class': mainFile}
    with jar
}

确切含义是什么,它在哪里记录?我无法在gradle文档中找到它,而在groovy( _using_with_for_repeated_operations_on_the_same_beanrel =nofollow noreferrer> http://groovy-lang.org/style-guide.html#_using_with_for_repeated_operations_on_the_same_bean )似乎有所不同。

What is the exact meaning, and where is it documented? I couldn't find it in the gradle documentation and the with in groovy (http://groovy-lang.org/style-guide.html#_using_with_for_repeated_operations_on_the_same_bean) seems to be different.

推荐答案

在你的情况下,你用()方法调用 - Jar 课。 (请参阅 Jar DSL文档 Jar API文档

In your case you are calling the with()-method of the Jar class. (see the very bottom of the Jar DSL documentation and the Jar API documentation)


将给定的规格添加为本规范的子代。

Adds the given specs as a child of this spec.

所以, with() - Groovy的方法。

So, it's not the with()-method of Groovy.

这篇关于“与”的含义是什么?在gradle中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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