Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

Gradle | ファイルをコピーする

概要

ファイルをコピーする

詳細

ファイルをコピーします。

サンプル

仕様

%project_root%hoge/hoge.txt

%project_root%hage/hage.txt
としてコピーします。
ディレクトリは作成済みを想定。

コード
task copyHogeToHage(type: Copy) {
  from 'hoge/hoge.txt'
  into 'hage'
  rename("hoge.txt", 'hage.txt')
}

実行

[sts] -----------------------------------------------------
[sts] Starting Gradle build for the following tasks: 
[sts]      :copyHogeToHage
[sts] -----------------------------------------------------
:copyHogeToHage

BUILD SUCCESSFUL

Total time: 0.276 secs
[sts] -----------------------------------------------------
[sts] Build finished succesfully!
[sts] Time taken: 0 min, 0 sec
[sts] -----------------------------------------------------