国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

Gradle指定一組輸入文件

2020-07-24 16:01 更新

在 Gradle 中有一些對象的某些屬性可以接收一組輸入文件.例如,JavaComplile 任務有一個 source 屬性,它定義了編譯的源文件,你可以設置這個屬性的值,只要 files() 方法支持. 這意味著你可以使用 File ,String , collection , FileCollection 甚至是使用一個閉合去設置屬性的值.

例 15.8 指定文件

build.gradle

//使用一個 File 對象設置源目錄
compile {
    source = file('src/main/java')
}

//使用一個字符路徑設置源目錄
compile {
    source = 'src/main/java'
}

// 使用一個集合設置多個源目錄
compile {
    source = ['src/main/java', '../shared/java']
}

// 使用 FileCollection 或者 FileTree 設置源目錄
compile {
    source = fileTree(dir: 'src/main/java').matching { include 'org/gradle/api/**' }
}

// 使用一個閉合設置源目錄
compile {
    source = {
        // Use the contents of each zip file in the src dir
        file('src').listFiles().findAll {it.name.endsWith('.zip')}.collect { zipTree(it) }
    }
}

Usually, there is a method with the same name as the property, which appends to the set of files. Again, this method accepts any of the types supported by the files() method.

通常情況下,會有一個方法名和屬性名相同的方法能夠附加一組文件,這個方法接收 files() 方法支持的任何類型的值.

例 15.9 指定文件

build.gradle

compile {
    // 使用字符路徑添加源目錄
    source 'src/main/java', 'src/main/groovy'

    // 使用 File 對象添加源目錄
    source file('../shared/java')

    // 使用閉合添加源目錄
    source { file('src/test/').listFiles() }
}


以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號