ã¤ã³ã¹ãã¼ã«ã¬ã¹ã§ Gradle ãã¦ã¿ã
ã¨ã£ã¦ã便å©ãª Gradle ã§ããã å®ã¯ããããã¤ã³ã¹ãã¼ã«ããªãã¦ã 誰ã§ãç°¡åã« Gradle ã§ããã¨ãããã¨ãçãããåç¥ã§ããï¼
ãã㯠Gradle Wrapper ã¨ããæ©è½ã§ ã¦ã¼ã¶ã¼ã¬ã¤ã ï¼こちらï¼ ã«ãã¡ããã¨è¨è¼ããã¦ãã¾ãã
ã¡ãªã¿ã«ããã®æ©è½ã¯ Gradle èªèº«ã®ãã«ãã«ã使ããã¦ããã®ã§ãã
ãã ãã¤ã³ã¹ãã¼ã«ããªãã¦ã...ãã¨ããã®ã¯ ã¡ãã£ã¨èªå¼ãããããããã¾ããã
ã¨è¨ãã®ã...
ãã® Gradle Wrapper ã®æ©è½ãå©ç¨ã«ããã«ã¯ ã¾ãåãã« build.gradle ã«
task wrapper(type: Wrapper) { gradleVersion = '1.0-milestone-1' }ã追å ã㦠Gradle ãã¤ã³ã¹ãã¼ã«ãããç°å¢ã§
$GRADLE_HOME/bin/gradle wrapperã®ããã« wrapper ã¿ã¹ã¯ãå®è¡ããå¿ è¦ãããããã§ãã
ã¨è¨ããã¨ã§...
ãã«ãæ
å½è
㯠ä»ã®ã¡ã³ãã¼ã®ããã«ããã°ã£ã¦ Gradle ãã¤ã³ã¹ãã¼ã«ã㦠ä¸è¨ã®ã¿ã¹ã¯ãå®è¡ãã¾ãããã
ãã£ãä¸åº¦å®è¡ããã ãã§è¯ãã®ã§ããã...
ä¸è¨ã®ã¿ã¹ã¯ãå®è¡ããã¨
my_project/ +- gradlew +- gradlew.bat +- gradle/ +- wrapper/ +- gradle-wrapper.jar +- gradle-wrapper.propertiesã®ãããªãã¡ã¤ã«ãããã¸ã§ã¯ãé ä¸ã«ä½æããã¾ãã
ãã®ãã¡ã¤ã«ã¯è¿·ããã¨ãªã ããã¸ã§ã¯ãã® ãã¼ã¸ã§ã³ç®¡çã·ã¹ãã ã« ã³ããããã¦ãã¾ãã¾ãããã (å ¨é¨ åããã¦ã ãã£ãã® 32KB!!)
ããããã°ãä»ã®ã¡ã³ãã¼ã¯ ã½ã¼ã¹ããã§ãã¯ã¢ã¦ãã㦠ããã¸ã§ã¯ãé ä¸ã® gradlew ã
./gradlew buildã®ããã«å®è¡ããã ã㧠Gradle ãã¤ã³ã¹ãã¼ã«ãã¦ããªãã¦ã ã¡ããã¨ãã«ãã§ãã¦ãã¾ãã®ã§ãã
ãã¡ãããJava ãã¤ã³ã¹ãã¼ã«ããã¦ãã¦ãã¤ã³ã¿ã¼ãããã«ã¤ãªãã£ã¦ãªãã¨ãã¡ã§ãã...
èå³ã®ããæ¹ã¯
git clone https://github.com/bluepapa32/gradle-wrapper-sample.git cd gradle-wrapper-sample ./gradlew -qã®ããã«å®è¡ãã¦ã¿ã¾ãããã
ãã¤ãã®ããã« "Hello, world!" ãåºåãããã¯ãã§ãã
ç§ä¸äººãä¸è¨ã®ä½æ¥ãããã ã㧠çããã¯ä½ãã¤ã³ã¹ãã¼ã«ããªãã¦ã Gradle ã§ãã«ãã§ãã¦ãã¾ãã®ã§ãã
ãã¡ãã Gradle ãã¤ã³ã¹ãã¼ã«ããã¦ããç°å¢ã§ããã°
gradle -qã§ãå ¨ãåæ§ã«ãã«ãã§ãã¾ãã
ãã®æ©è½ãããã° Maven ã Ant ãã Gradle ã¸ã®ç§»è¡ãããªã楽ã«ãªãã®ã§ã¯ãªããã¨æãã¾ãã
æ¢ã« Maven ã Ant ãæ®åãã¦ãããããªãã¼ã ã®å ´å ã¡ã³ãã¼å
¨å¡ã®ç«¯æ«ãçµ±åç°å¢çã«ãããã æ°ãã Gradle ãã¤ã³ã¹ãã¼ã«ãã¦ã¾ã§
移è¡ãããã¨ã¯é£ããã¨æãã¾ãããåæã« Gradle åã㦠ãã¼ã¸ã§ã³ç®¡çã·ã¹ãã ã«ã³ããããã¦ããã ããªãã誰ãæå¥ã¯è¨ããªãã¯ãã§ãã
æ«ãããã° ãã£ã¨ ã¿ã㪠Gradle ã¸ç§»è¡ãå§ããã®ã§ã¯ãªãã§ããããã