简体   繁体   English

Gradle DSL的含义。名称

[英]Gradle DSL meaning for it.name

What does it.name mean? 是什么it.name意思? Is it generated, or can the values be specified? 是生成还是可以指定值? Is it like this , refers to the current object ? itthis ,是指当前对象

 jar.doFirst
 {
     // aggregate all the jars needed at runtime into a local variable (array)
     def manifestClasspath = configurations.runtime.collect { it.name }

     // remove duplicate jar names, and join the array into a single string
     manifestClasspath = manifestClasspath.unique().join(" ")

     // set manifest attributes - mainClassName must be set before it is used here
     manifest.attributes.put("Main-Class", mainClassName)
     manifest.attributes.put("Class-Path", manifestClasspath)
 }

This method will execute before the jar task? 这个方法会在执行jar任务之前执行吗?

see: 看到:

https://stackoverflow.com/a/22736602/262852 https://stackoverflow.com/a/22736602/262852

1. 1。

it is the implicit parameter for Groovy's closures. it是Groovy闭包的隐式参数。

configurations.runtime.collect { it.name }

is equivalent to 相当于

configurations.runtime.collect { it -> it.name }

name is simply a property. name只是一个属性。 For more information about it look here . 有关更多信息it请参见此处

2. 2。

Yes, it will be executed before jar task. 是的,它将在执行jar任务之前执行。 It's a part of the API, look here in section 14.7 for example 这是API的一部分,看看这里的部分14.7例如

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM