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

问题描述

在答案中有一个,其中在最后一行:

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()似乎有所不同。

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 课。 (请参阅和)

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)

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

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

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

07-17 06:09
查看更多