Gradle Wrapper ãã«ã¹ã¿ã ãã¦ã¿ã
ä»å¹´ãæ®ããããã¨ãªãã¾ããããä»å¹´æåã¨ãªãã¨ã³ããªã¼ã¯ã G*アドベントカレンダー 2014ãã®ç¬¬24æ¥ç®ã®è¨äºã§ãã
æ©ããã®ã§ Gradle ãã¯ããã¦ãããã¾ããªãï¼å¹´ãçµã¨ãã¨ãã¦ãã¾ãã ä»å¹´ã¯é·å¹´ã®æ²é¡ã§ãã£ãæ¥åã¸ã®å°å ¥ã«ãæåããé常ã«å å®ããä¸å¹´ã«ãªãã¾ããã
ããã§ä»åã¯æ¥åã§å®éã«ä½¿ã£ã¦ã¿ã¦ãã¨ã£ã¦ã便å©ã ã£ãæ©è½ã®ä¸ã¤ ãã«ã¹ã¿ã Gradle Wrapperã ï¼å®ã¯æ£å¼åã¯ä¸æ...ï¼ ãç´¹ä»ãããã¨æãã¾ãã
ããã¤ãã®ããã¸ã§ã¯ã㧠Gradle ã使ã£ã¦ããã¨ããã¤ãã決ã¾ãã® Gradle ã¹ã¯ãªãããæ¸ãã¦ãããã¨ã«æ°ã¥ããããã Ant ã Maven ãããè¨è¿°éãå°ãªãã¦æ¸ãã¨ã¯ãããã¡ãã£ã¨æ°ãæ» å ¥ãï¼ãã¨ãããã¾ããã...
ä¾ãã°ãJava ã®ã¨ã³ã³ã¼ãã£ã³ã°ã UTF-8 ã«ããå ´å
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }ã®ãããªã¹ã¯ãªãããããã¸ã§ã¯ããç«ã¡ä¸ãã度㫠build.gradle ã«æ¸ããªãã¨ãããªããã§ãã ããã ããªãã¾ã ããããããªã®ãããããããã¨...
ã¨è¨ããã¨ã§â¦
ãããªã¨ãã¯ãGradle Wrapper ãã£ã¹ããªãã¥ã¼ã·ã§ã³ï¼gradlew ãå®è¡ããã¨åæã«ãã¦ã³ãã¼ãããã Gradleï¼ã«ãinit ã¹ã¯ãªããããçµã¿åãããã«ã¹ã¿ã ãã£ã¹ããªãã¥ã¼ã·ã§ã³ãä½ã£ã¦ãã¾ãã¾ãããã
ã¡ãªã¿ã«ãinit ã¹ã¯ãªããã㯠build.gradle ãå®è¡ããåã«ãäºãæå®ã®ãã£ã¬ã¯ããªã«é
ç½®ãã¦ããã Gradle ã¹ã¯ãªãããå®è¡ãã¦ãããã¨ãã便å©ãªæ©è½ã§ããï¼è©³ç´°ã¯こちらï¼
ãGradle Wrapperãã¨çµã¿åããã¦ä½¿ãå ´å㯠Gradle Wrapper ãã£ã¹ããªãã¥ã¼ã·ã§ã³ã® init.d é
ä¸ã«å®è¡ããããinit ã¹ã¯ãªããããé
ç½®ãã¦ããã ã㧠OK ã§ãã
ã§ã¯ãæ©éãJavaã®ã¨ã³ã³ã¼ãã£ã³ã°ã UTF-8 ã«å¤æ´ããã«ã¹ã¿ã ãã£ã¹ããªãã¥ã¼ã·ã§ã³ãä½æãã¦ã¿ã¾ãããã
ã¾ãã以ä¸ã® URL ãã Gradle Wrapper ãã£ã¹ããªãã¥ã¼ã·ã§ã³ã®ãZIP ãã¡ã¤ã«ããã¦ã³ãã¼ããã¦ãé©å½ãªå ´æã«è§£åãã¾ãã
http://services.gradle.org/distributions/gradle-2.2.1-bin.zip
ãã¼ã¸ã§ã³çªå·ã¯ 使ç¨ãããã¢ãã«åããã¦å¤æ´ãã¦ãã ããã
ä»å使ç¨ãããã¼ã¸ã§ã³ã¯ ææ°çã® 2.2.1 ã§ãã
ZIP ãã¡ã¤ã«ã解åããã¨
gradle-2.2.1 |-- bin/ |-- init.d/ |-- lib/ |-- media/ |-- LICENSE |-- NOTICE |-- changelog.txt `-- getting-started.htmlã®ãããªæ§æã«ãªã£ã¦ã¾ãã
次ã«ã解åãããã£ã¬ã¯ããªç´ä¸ã® init.d é ä¸ã«
allprojects { tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } }ã®ããã«è¨è¿°ãã Gradle ãã¡ã¤ã«ï¼ãã¼ã¹åã¯ä»»æï¼ãä½æãã¾ãã
ä»å㯠ã³ã³ãã¤ã«ã«ã¤ãã¦ã®è¨å®ãè¨è¿°ãã Gradle ãã¡ã¤ã«ãªã®ã§ compile.gradle ã¨ãã¦ããã¾ãã
ã¡ãªã¿ã« init.d é ä¸ã«é ç½®ãã Gradle ãã¡ã¤ã«ã¯è¾æ¸é ã§å®è¡ããããããªã®ã§ãè¤æ°ãã¡ã¤ã«ãä½æããå ´åã¯å®è¡ãããé çªã«ãªãããã«ããæãã§ãã¡ã¤ã«åãä»ãã¾ãããã
æå¾ã«ãããä¸åº¦ ZIP ãã¡ã¤ã«ã«ã¢ã¼ã«ã¤ãããªããã°ãã«ã¹ã¿ã ãã£ã¹ããªãã¥ã¼ã·ã§ã³ã®åºæ¥ä¸ããã§ãã
ä½æãã ZIP ãã¡ã¤ã«ã¯ ã©ãããã¦ã³ãã¼ãå¯è½ãªå ´æã«ç½®ãã¦ããã¾ãããã
ãã¨ã¯ ã«ã¹ã¿ã ãã£ã¹ããªãã¥ã¼ã·ã§ã³ã使ãããããã¸ã§ã¯ãã® build.gradle ã«
wrapper { distributionUrl = 'http://xxx.xxx.xxx/xxxx/gradle-2.2.1-xx.zip' }ã®ããã« ZIPãã¡ã¤ã«ã®ãã¦ã³ãã¼ãURLãæå®ãã¦ããã¤ãã®ããã«
gradle wrapperãå®è¡ããã ãã§ãã ãã¡ãããä½æããããã¡ã¤ã«ã¯ VCS ã«ã³ããããã¦ããã¾ãããã ãã㧠åããã¸ã§ã¯ãã® build.gradle ã«
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }ã®ãããªã決ã¾ãã®ã¹ã¯ãªãããè¨è¿°ããªãã¦ãã
./gradlew build㧠UTF-8 ã§æ¸ããã Java ãã¡ã¤ã«ãã³ã³ãã¤ã«ã§ããããã«ãªããã§ãã
ã©ãã§ããï¼
ãã£ãããã ã㧠ãã¤ãä½ãèããã«æ¸ãã¦ãã ã決ã¾ãã® Gradle ã¹ã¯ãªãããã解æ¾ããããªãã¦ä¾¿å©ãããªãã§ããï¼
ãããã¿ãªãããæ¥é åããããªæ©ã¿ããããã¦ããããã§ãããããã²ã試ããã ããã
ææ¥ã¯ãããã大ããªã® touchez_du_bois ããã§ãã
ããã§ã¯ãã¿ãªããè¯ãã¯ãªã¹ãã¹ã!!