å ±æã©ã¤ãã©ãªã管çããããã« Sonatype ã® Nexus Repository Manager OSS ã使ç¨ãã ( ãã®ï¼ )( build.gradle ã« 1.0-SNAPSHOT ã®ãã¼ã¸ã§ã³ã§è¨è¿°ãã¦ããæã«ã©ã¤ãã©ãªãæ´æ°ããã¨ããã«åæ ãããã®ãï¼ )
æ¦è¦
- ä»åã®æé ã§ç¢ºèªã§ããã®ã¯ä»¥ä¸ã®å
容ã§ãã
- ååã®è¨äºã§ build.gradle ã« ksbysample-library-simpleutils ã©ã¤ãã©ãªã®ãã¼ã¸ã§ã³çªå·ã 1.0-20160716.025552-1 â 1.0-SNAPSHOT ã«å¤æ´ãã¦ãï¼æ¥åæ ãããªããã¨ããã£ãã¨æ¸ãã¾ããã
- ksbysample-library-simpleutils ã©ã¤ãã©ãªãæ´æ°ãã¦ãããã« ksbysample-webapp-demo ããã¸ã§ã¯ãããå©ç¨ã§ããããã«ãªãã®ãçåã«æã£ãã®ã§ç¢ºèªãã¾ãã
åç §ãããµã¤ãã»æ¸ç±
-
(o1, o2) -> o1 - o2 ãªãã¦åªæã¯ããããã¦ï¼ - Java8ã§ã®Comparatorã®ä½¿ãæ¹
http://qiita.com/tag1216/items/50ecf6a7bc10218ee889- Stream API ã§æååé·ã§ã½ã¼ãããæ¹æ³ãåç §ãã¾ããã
-
use latest snapshot version from the remote repo
http://stackoverflow.com/questions/22372508/use-latest-snapshot-version-from-the-remote-repo How can I force gradle to redownload dependencies?
http://stackoverflow.com/questions/13565082/how-can-i-force-gradle-to-redownload-dependencies51.9.3. ä¾åé¢ä¿ãã£ãã·ã¥å¶å¾¡ã®å¾®èª¿æ´ http://gradle.monochromeroad.com/docs/userguide/dependency_management.html#sec:controlling_caching
- Gradle ã®ããã¥ã¢ã«ã§ãããã£ãã·ã¥ã®å¶å¾¡æ¹æ³ãè¨è¼ããã¦ãã¾ãã
ç®æ¬¡
- ksbysample-library-simpleutils ã©ã¤ãã©ãªã® StringListUtils ã¯ã©ã¹ã«ã¡ã½ããã追å ãã
- ksbysample-webapp-demo ããã¸ã§ã¯ã㧠StringListUtils::maxLengthString ã¡ã½ãããå¼ã³åºããã確èªãã
- ksbysample-library-simpleutils ã©ã¤ãã©ãªã® StringListUtils ã¯ã©ã¹ã«ã¡ã½ããã追å ããï¼ï¼åç®ï¼
- ksbysample-webapp-demo ããã¸ã§ã¯ã㧠StringListUtils::minLengthString ã¡ã½ãããå¼ã³åºããã確èªããï¼ååã®æ´æ°ããï¼æé以å ã«è©¦ãï¼
- åæ ãããªãçç±ã¨ã¯ï¼
- ksbysample-library-simpleutils ã©ã¤ãã©ãªã®ææ°çãåæ ãããããã«ããã«ã¯ï¼
æé
ksbysample-library-simpleutils ã©ã¤ãã©ãªã® StringListUtils ã¯ã©ã¹ã«ã¡ã½ããã追å ãã
StringListUtils ã¯ã©ã¹ã« maxLengthString ã¡ã½ããã追å ãã
ksbysample-library-simpleutils ããã¸ã§ã¯ããéãã¾ãã
ãªã¹ãã®ä¸ã§æãæååé·ãé·ãæååãè¿ã maxLengthString ã¡ã½ããã追å ãã¾ããsrc/main/java/ksbysample/library/simpleutils ã®ä¸ã® StringListUtils.java ã ãªã³ã¯å ã®ãã®ï¼ã®å 容 ã«å¤æ´ãã¾ãã
ãã¹ããä½æãã¦åä½ç¢ºèªãã
src/test/groovy/ksbysample/library/simpleutils ã®ä¸ã® StringListUtilsTest.groovy ã ãªã³ã¯å ã®ãã®ï¼ã®å 容 ã«å¤æ´ãã¾ãã
ãã¹ããå®è¡ãã¾ãã
def "maxLengthString(#stringList) --> #result"()
ã¡ã½ããåã®å·¦å´ã®ç¢å°ã¢ã¤ã³ã³ãã¯ãªãã¯ãã¦ã¡ãã¥ã¼ã表示ããå¾ããRun 'maxLengthString(#s...()'ãã¡ãã¥ã¼ãé¸æãã¾ãããã¹ããå®è¡ãããå ¨ã¦æåãããã¨ã確èªã§ãã¾ããã
Nexus ã«ã¢ãããã¼ããã
Gradle projects View ã® uploadArchives ã¿ã¹ã¯ãããã«ã¯ãªãã¯ãã¦ç»é²ãã¾ãã
ã¢ãããã¼ãå¾ã® Nexus ã®ç»é²ç¶æ³ã確èªãã
Nexus ã®ç®¡çç»é¢ãè¦ãã¨ãmaven-snapshots repository ã®ä¸ã«ä»¥ä¸ã®ç»åã®ç¶æ ã§ç»é²ããã¦ãã¾ããã1.0-20160723.053434-4 ã追å ããã¦ãã¾ãã
ksbysample-webapp-demo ããã¸ã§ã¯ã㧠StringListUtils::maxLengthString ã¡ã½ãããå¼ã³åºããã確èªãã
ksbysample-library-simpleutils ããã¸ã§ã¯ããéã㦠ksbysample-webapp-demo ããã¸ã§ã¯ããéãã¾ãã
Gradle projects View ã®å·¦ä¸ã«ãããRefresh all Gradle projectsããã¿ã³ãã¯ãªãã¯ãã¦æ´æ°ãã¾ãã
Project View ãã ksbysample-library-simpleutils ã©ã¤ãã©ãªã® StringListUtils ã¯ã©ã¹ãããã«ã¯ãªãã¯ãã¦éã㨠maxLengthString ã¡ã½ããã追å ããã¦ãããã¨ã確èªã§ãã¾ããã
ksbysample-library-simpleutils ã©ã¤ãã©ãªã® StringListUtils ã¯ã©ã¹ã«ã¡ã½ããã追å ããï¼ï¼åç®ï¼
StringListUtils ã¯ã©ã¹ã« minLengthString ã¡ã½ããã追å ãã
ksbysample-webapp-demo ããã¸ã§ã¯ããéã㦠ksbysample-library-simpleutils ããã¸ã§ã¯ããéãã¾ãã
ãªã¹ãã®ä¸ã§æãæååé·ãçãæååãè¿ã minLengthString ã¡ã½ããã追å ãã¾ããsrc/main/java/ksbysample/library/simpleutils ã®ä¸ã® StringListUtils.java ã ãªã³ã¯å ã®ãã®ï¼ã®å 容 ã«å¤æ´ãã¾ãã
ãã¹ããä½æãã¦åä½ç¢ºèªãã
src/test/groovy/ksbysample/library/simpleutils ã®ä¸ã® StringListUtilsTest.groovy ã ãªã³ã¯å ã®ãã®ï¼ã®å 容 ã«å¤æ´ãã¾ãã
ãã¹ããå®è¡ãã¾ãã
def "minLengthString(#stringList) --> #result"()
ã¡ã½ããåã®å·¦å´ã®ç¢å°ã¢ã¤ã³ã³ãã¯ãªãã¯ãã¦ã¡ãã¥ã¼ã表示ããå¾ããRun 'minLengthString(#s...()'ãã¡ãã¥ã¼ãé¸æãã¾ãããã¹ããå®è¡ãããå ¨ã¦æåãããã¨ã確èªã§ãã¾ããã
Nexus ã«ã¢ãããã¼ããã
Gradle projects View ã® uploadArchives ã¿ã¹ã¯ãããã«ã¯ãªãã¯ãã¦ç»é²ãã¾ãã
ã¢ãããã¼ãå¾ã® Nexus ã®ç»é²ç¶æ³ã確èªãã
Nexus ã®ç®¡çç»é¢ãè¦ãã¨ãmaven-snapshots repository ã®ä¸ã«ä»¥ä¸ã®ç»åã®ç¶æ ã§ç»é²ããã¦ãã¾ããã1.0-20160723.060157-5 ã追å ããã¦ãã¾ãã
ksbysample-webapp-demo ããã¸ã§ã¯ã㧠StringListUtils::minLengthString ã¡ã½ãããå¼ã³åºããã確èªããï¼ååã®æ´æ°ããï¼æé以å ã«è©¦ãï¼
ksbysample-library-simpleutils ããã¸ã§ã¯ããéã㦠ksbysample-webapp-demo ããã¸ã§ã¯ããéãã¾ãã
Gradle projects View ã®å·¦ä¸ã«ãããRefresh all Gradle projectsããã¿ã³ãã¯ãªãã¯ãã¦æ´æ°ãã¾ããååã®æ´æ°ã 14:40é ãä»åã®æ´æ°ã 15:09 ã§ï¼æé以å ã§ãã
Project View ãã ksbysample-library-simpleutils ã©ã¤ãã©ãªã® StringListUtils ã¯ã©ã¹ãããã«ã¯ãªãã¯ãã¦éã㨠minLengthString ã¡ã½ãããããã¾ããã§ããããã
ãã£ã±ãçæéã§ã®æ´æ°ã¯åæ ãããªãããã§ãã
åæ ãããªãçç±ã¨ã¯ï¼
- use latest snapshot version from the remote repo
http://stackoverflow.com/questions/22372508/use-latest-snapshot-version-from-the-remote-repo
stackoverflow ã®ãã® QA ãè¦ãã¨ãGradle ã§ã¯ã¢ã¸ã¥ã¼ã«ã 24æéãã£ãã·ã¥ãããã¨æ¸ããã¦ãã¾ãããããã§ããã°ã1) ä¿®æ£ãã¦ãå½æ¥ä¸ã«ã¯åæ ãããªãã£ãã2) ç¿æ¥ã«ãªã£ããåæ ããããã¨ããæåãç解ã§ãã¾ãã
ã§ãèªåã§æ§ç¯ãã repository manager ã«å ¥ãã¦ãã SNAPSHOT ãã¼ã¸ã§ã³ã®ã³ã³ãã¼ãã³ãã¯ãããããé »ç¹ã«æ´æ°ãããã¨ãããã®ã§ãã£ãã·ã¥ç¡å¹ã«ãã¦æ¬²ããã¨ããã§ãã
ksbysample-library-simpleutils ã©ã¤ãã©ãªã®ææ°çãåæ ãããããã«ããã«ã¯ï¼
ãããã試ãã¦ã¿ã
- use latest snapshot version from the remote repo
http://stackoverflow.com/questions/22372508/use-latest-snapshot-version-from-the-remote-repo - How can I force gradle to redownload dependencies?
http://stackoverflow.com/questions/13565082/how-can-i-force-gradle-to-redownload-dependencies - 51.9.3. ä¾åé¢ä¿ãã£ãã·ã¥å¶å¾¡ã®å¾®èª¿æ´ http://gradle.monochromeroad.com/docs/userguide/dependency_management.html#sec:controlling_caching
ä¸è¨ã®ãã¼ã¸ã«è¨è¼ããã¦ãããã¨ã試ãã¦ã¿ã¾ãã
configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' } dependencies { compile('org.springframework.boot:spring-boot-starter-web') testCompile('org.springframework.boot:spring-boot-starter-test') compile('ksbysample.library:ksbysample-library-simpleutils:1.0-SNAPSHOT') }
ã¾ã㯠build.gradle ã« configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' }
ã®è¨å®ã ãå
¥ã㦠Gradle projects View ã®å·¦ä¸ã«ãããRefresh all Gradle projectsããã¿ã³ãã¯ãªãã¯ãã¦æ´æ°ãã¾ããããåæ ããã¾ããã§ããã
configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' } dependencies { compile('org.springframework.boot:spring-boot-starter-web') testCompile('org.springframework.boot:spring-boot-starter-test') compile('ksbysample.library:ksbysample-library-simpleutils:latest.integration') }
次㫠sample-library-simpleutils ã©ã¤ãã©ãªã®ãã¼ã¸ã§ã³ã 1.0-SNAPSHOT
â latest.integration
ã«å¤æ´ãã¦æ´æ°ãã¾ããããåæ ããã¾ããã§ããã
configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' } dependencies { compile('org.springframework.boot:spring-boot-starter-web') testCompile('org.springframework.boot:spring-boot-starter-test') compile('ksbysample.library:ksbysample-library-simpleutils:1.0-SNAPSHOT') { changing = true } }
sample-library-simpleutils ã©ã¤ãã©ãªã®ãã¼ã¸ã§ã³ã 1.0-SNAPSHOT
ã«æ»ã㦠{ changing = true }
ã追å ãã¦æ´æ°ãã¾ããããåæ ããã¾ããã§ããã
ã³ãã³ãããã³ãããã gradlew.bat build --refresh-dependencies
ã³ãã³ããå®è¡ãã¦ã¿ã¾ãã
1.0-20160723.060157-5 ã Download ããåºåãåºã¦ããã®ã§ãããIntelliJ IDEA 㧠StringListUtils ã¯ã©ã¹ã Decompile ãã¦ã¿ãã¨ã½ã¼ã¹å ã« minLengthString ã¡ã½ãããããã¾ããã§ããã
ãã®å¾ã§ Gradle projects View ã®å·¦ä¸ã«ãããRefresh all Gradle projectsããã¿ã³ãã¯ãªãã¯ãã¦æ´æ°ããã¨ããã£ã¨åæ ããã¾ãããDecompile ããã½ã¼ã¹ã« minLengthString ã¡ã½ããã表示ããã¦ãã¾ãã
çµè«
ä¸ã§è©¦ããã ãã§ã¯åãããªããã ã£ãã®ã§ä»ã«ããããã試ãã¦ã¿ãçµæã以ä¸ã®çµè«ã§ããã
- sample-library-simpleutils ã©ã¤ãã©ãªã使ãæ¹ã®ããã¸ã§ã¯ã㧠build.gradle ã«ãã¼ã¸ã§ã³çªå·ã
1.0-SNAPSHOT
ã§æå®ãã¦ããå ´åãååæ´æ°æãã 24æé以å ã« Nexus ã«ã¢ãããã¼ããããææ°çãåæ ããæ¹æ³ã¯ä»¥ä¸ã®æ¹æ³ã ãã§ããã- ã¾ãã³ãã³ãããã³ãããã
gradlew.bat build --refresh-dependencies
ã³ãã³ããå®è¡ãã¾ãã - ãã®å¾ã§ Gradle projects View ã®å·¦ä¸ã«ãããRefresh all Gradle projectsããã¿ã³ãã¯ãªãã¯ãã¦æ´æ°ãã¾ãã
- ã¾ãã³ãã³ãããã³ãããã
- 24æéçµéããã°ãGradle projects View ã®å·¦ä¸ã«ãããRefresh all Gradle projectsããã¿ã³ãã¯ãªãã¯ããã ãã§åæ ããã¾ãã
- build.gradle ã«ä»¥ä¸ã®è¨è¿°ã追å ãã¦ã¿ã¾ããããå
¨ãé¢ä¿ããã¾ããã§ãããgradle ã®ããã¥ã¢ã«ã stackoverflow ãè¦ã¦ããã¨ãããã¯æããªãã®ã§ããåä½ã確èªã§ãã¾ããã§ããããã
configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' }
ã追å ããã- ãã¼ã¸ã§ã³ã
1.0-SNAPSHOT
âlatest.integration
ã«å¤æ´ããã { changing = true }
ã追å ããã
ã½ã¼ã¹ã³ã¼ã
StringListUtils.java
â ãã®ï¼
package ksbysample.library.simpleutils; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import static java.util.Collections.reverseOrder; import static java.util.Comparator.comparing; public class StringListUtils { .......... static public Optional<String> maxLengthString(List<String> stringList) { Optional<String> result = Optional.empty(); if (stringList != null) { result = stringList.stream() .filter(s -> s != null) .sorted(comparing(String::length, reverseOrder())) .findFirst(); } return result; } }
- maxLengthString ã¡ã½ããã追å ãã¾ãã
â ãã®ï¼
package ksbysample.library.simpleutils; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import static java.util.Collections.reverseOrder; import static java.util.Comparator.comparing; public class StringListUtils { .......... static public Optional<String> minLengthString(List<String> stringList) { Optional<String> result = Optional.empty(); if (stringList != null) { result = stringList.stream() .filter(s -> s != null) .sorted(comparing(String::length)) .findFirst(); } return result; } }
- minLengthString ã¡ã½ããã追å ãã¾ãã
StringListUtilsTest.groovy
â ãã®ï¼
package ksbysample.library.simpleutils import spock.lang.Specification import spock.lang.Unroll class StringListUtilsTest extends Specification { .......... @Unroll def "maxLengthString(#stringList) --> #result"() { expect: StringListUtils.maxLengthString(stringList) == result where: stringList || result null || Optional.empty() [null] || Optional.empty() ["a"] || Optional.of("a") ["ãã¹ã"] || Optional.of("ãã¹ã") ["a", "ab", "abc"] || Optional.of("abc") ["a", null, "abc"] || Optional.of("abc") } }
def "maxLengthString(#stringList) --> #result"()
ã¡ã½ããã追å ãã¾ããOptional ã®æ»ãå¤ãè©ä¾¡ããæ㯠Optional.of(...) ã使ç¨ãã¾ãã
â ãã®ï¼
package ksbysample.library.simpleutils import spock.lang.Specification import spock.lang.Unroll class StringListUtilsTest extends Specification { .......... @Unroll def "minLengthString(#stringList) --> #result"() { expect: StringListUtils.minLengthString(stringList) == result where: stringList || result null || Optional.empty() [null] || Optional.empty() ["a"] || Optional.of("a") ["ãã¹ã"] || Optional.of("ãã¹ã") ["a", "ab", "abc"] || Optional.of("a") ["abc", null, "a"] || Optional.of("a") } }
def "minLengthString(#stringList) --> #result"()
ã¡ã½ããã追å ãã¾ãã
å±¥æ´
2016/07/24
åççºè¡ã