Configuration and runtime for gradle

I set the path to my jar link in jar. ('classpath:' wee.jar), but apparently I also need to enter the following in my jar task

from {
    configurations.compile.collect {
        it.isDirectory() ? it : zipTree(it)
    }
    configurations.runtime.collect {
        it.isDirectory() ? it : zipTree(it)
    }

Can someone explain to me what is going on from config.compile.collect, runtime and isDirectory and zipTree? I am looking for google but could not find an answer. I'm really new to gradle

+4
source share
1 answer

configurations.compile, configurations.runtime. gradle , . , , . , :

configurations.compile.collect {
    it.isDirectory() ? it : zipTree(it)
}

. compile runtime , java. collect - groovy : . , - , configurations.compile, .

it - groovy - .

if `it` is a directory
    include it as is, 
else
    unpack the file and then include it

(. zipTree )

, , .

+6

Source: https://habr.com/ru/post/1626777/


All Articles