14

リソース ディレクトリにあるすべての JavaScript ファイルを含む単純な Zip アーカイブを作成しようとしています。

コードは次のとおりです。

  task zip(type:Zip){
    from ('resources/'){
        include '*.js'
    }
    into 'resources'
}

これは何らかの理由で機能しないようです。from必要なのはとintoアーカイブを作成することだけだと多くの人が言っているのを聞いたことがあります。誰かがここで私を助けることができますか? Gradle v1.0 を使用しています。前もって感謝します。

4

2 に答える 2

22

次のようなものを試してください(docs):

task zip(type:Zip) {
 from ('resources/')
 include '*.js'
 into 'resources' // note that this specifies path *in* the archive
 destinationDir file('dir') // directory that you want your archive to be placed in
}
于 2012-07-15T20:29:45.427 に答える
10
task someTask << {

    // other code...

    task(zipResources, type: Zip) {
        destinationDir new File(projectDir, 'resources')
        archiveName 'resources.zip'
        from 'src/main/webapp'
        include '*.js'
    }.execute()

    task(zipSomethingElse, type: Zip) {
        destinationDir buildDir
        archiveName 'source-code.zip'
        from 'src/main/java'
        include '**/*.java'
    }.execute()

    // some other code...

}
于 2013-06-28T11:49:59.247 に答える