“与”的含义是什么?在gradle中 [英] Whats the meaning of "with" in 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屋!