1

「コンパイル」構成の依存関係セクションにあるすべての jar を次のようにコピーできます。

task('copyJars') { 
    ext.collection = files { genLibDir.listFiles() }
    delete ext.collection
    copy { from configurations.compile into genLibDir }
}

ソースjarファイルをどこかにコピーするにはどうすればよいですか?

ありがとう、ディーン

4

1 に答える 1

1

As of Gradle 1.0, I don't know of an easy way to deal with third-party sources Jars. You could add them as explicit dependencies (to a separate configuration) or maybe crawl the Gradle cache.

By the way, delete ext.collection is in the wrong spot. It will be executed in the configuration phase, and will delete files no matter which tasks are going to be executed. (Also listFiles() will get invoked for every build.)

Also, a task whose main purpose is copying should alway use the Copy task type rather than the copy method.

于 2012-07-24T13:58:34.460 に答える