å ±æã©ã¤ãã©ãªã管çããããã« Sonatype ã® Nexus Repository Manager OSS ã使ç¨ãã ( ãã®ï¼ï¼ )( Spring Framework ã«ä¾åããã©ã¤ãã©ãªãä½æããï¼ )
æ¦è¦
- ä»åã®æé ã§ç¢ºèªã§ããã®ã¯ä»¥ä¸ã®å
容ã§ãã
- 1.4 ç³»ã®ããã¸ã§ã¯ãã« 1.3.8 ãã¼ã¹ã® ksbysample-library-depend-spring ã©ã¤ãã©ãªãå°å ¥ãã㨠Spring Boot ã¯ã©ã®ãã¼ã¸ã§ã³ã使ç¨ãããã®ã確èªãã¾ãã
åç §ãããµã¤ãã»æ¸ç±
ç®æ¬¡
- 1.4 ç³»ã®ããã¸ã§ã¯ã ksbysample-webapp-demo14 ãä½æãã
- ksbysample-library-depend-spring ã©ã¤ãã©ãªå°å ¥æã®ãã°ãåºããã¨ã確èªãã
- gradlew dependencies ã³ãã³ãã§ä¾åé¢ä¿ã確èªãã
æé
1.4 ç³»ã®ããã¸ã§ã¯ã ksbysample-webapp-demo14 ãä½æãã
ä»å㯠IntelliJ IDEA ãã Spring Initializr ãå©ç¨ãã¦ããã¸ã§ã¯ããä½æããå¾ãbuild.gradle ã« Spring IO Platform ã® bom çã追å ãã¾ãã
-
IntelliJ IDEA ã®ãWelcome to IntelliJ IDEAããã¤ã¢ãã°ãããCreate New Projectãã¡ãã¥ã¼ãã¯ãªãã¯ãã¾ãã
ãNew Projectããã¤ã¢ãã°ã表示ããã¾ããç»é¢å·¦å´ã®ä¸è¦§ãããSpring Initializrããé¸æãã¦ãã以ä¸ã®ç»åã®å 容ãå ¥åå¾ããNextããã¿ã³ãã¯ãªãã¯ãã¾ãã
GroupãArtifact çãå ¥åããç»é¢ã表示ããã¾ãã以ä¸ã®ç»åã®å 容ãå ¥åå¾ããNextããã¿ã³ãã¯ãªãã¯ãã¾ãã
Spring ã®ãããã¯ããé¸æããç»é¢ã表示ããã¾ãã以ä¸ã®ç»åã®ãããã¯ãããã§ãã¯ããå¾ããNextããã¿ã³ãã¯ãªãã¯ãã¾ãã
Project name 㨠Project location ãå ¥åããç»é¢ã表示ããã¾ãã以ä¸ã®ç»åã®å 容ã«ãªã£ã¦ãããã¨ã確èªããå¾ããFinishããã¿ã³ãã¯ãªãã¯ãã¾ãã
ãImport Module from Gradleããã¤ã¢ãã°ã表示ããã¾ãããCreate directories for empty roots automaticallyãããã§ãã¯ããå¾ããOKããã¿ã³ãã¯ãªãã¯ãã¾ãã
IntelliJ IDEA ã® 2016.3 ã§ã¯ããã¸ã§ã¯ãä½æç´å¾ã«ç»é¢å³å´ã«ãGradleãã¢ã¤ã³ã³ï¼æåã表示ãããªãã®ã§ãä¸æ¦ IntelliJ IDEA ãåèµ·åãã¾ãã
build.gradle ã ãªã³ã¯å ã®å 容 ã«å¤æ´ãã¾ããå¤æ´å¾ãGradle projects View ã®å·¦ä¸ã«ãããRefresh all Gradle projectsããã¿ã³ãã¯ãªãã¯ãã¦åæ ãã¾ãã
src/main/java/ksbysample/webapp/demo14 ã®ä¸ã« TestController.java ãä½æãããªã³ã¯å ã®å 容 ãè¨è¿°ãã¾ãã
ksbysample-library-depend-spring ã©ã¤ãã©ãªå°å ¥æã®ãã°ãåºããã¨ã確èªãã
Gradle projects View ãã bootRun ã¿ã¹ã¯ãå®è¡ããTomcat ãèµ·åãã¾ãã
ãã©ã¦ã¶ãèµ·åã http://localhost:8080/test ã«ã¢ã¯ã»ã¹ããã¨ãrequest, response ã®ãã°ãåºåããããã¨ã確èªã§ãã¾ããã1.4 ç³»ã®ããã¸ã§ã¯ãã§ãåä½ãã¾ããã
gradlew dependencies ã³ãã³ãã§ä¾åé¢ä¿ã確èªãã
ã³ãã³ãããã³ãããèµ·åãã«ã¬ã³ããã£ã¬ã¯ããªã c:\project-springboot\ksbysample-nexus-repomng\ksbysample-webapp-demo14 ã¸ç§»åããå¾ãgradlew dependencies ã³ãã³ããå®è¡ãã¦ã¿ã¾ãã
ä»å㯠org.springframework.boot:spring-boot-starter-web:1.3.8.RELEASE -> 1.4.2.RELEASE (*)
ã¨åºåããã¦ããã1.4.2 ã使ç¨ããã¦ãã¾ãããã©ã¤ãã©ãªå´ã®ãã¼ã¸ã§ã³ã§ã¯ãªããã¡ã¤ã³ããã¸ã§ã¯ãå´ã®ãã¼ã¸ã§ã³ã使ç¨ãããããã§ãã
compile - Dependencies for source set 'main'. +--- org.springframework.boot:spring-boot-starter-web: -> 1.4.2.RELEASE | +--- org.springframework.boot:spring-boot-starter:1.4.2.RELEASE | | +--- org.springframework.boot:spring-boot:1.4.2.RELEASE | | | +--- org.springframework:spring-core:4.3.4.RELEASE | | | \--- org.springframework:spring-context:4.3.4.RELEASE | | | +--- org.springframework:spring-aop:4.3.4.RELEASE | | | | +--- org.springframework:spring-beans:4.3.4.RELEASE | | | | | \--- org.springframework:spring-core:4.3.4.RELEASE | | | | \--- org.springframework:spring-core:4.3.4.RELEASE | | | +--- org.springframework:spring-beans:4.3.4.RELEASE (*) | | | +--- org.springframework:spring-core:4.3.4.RELEASE | | | \--- org.springframework:spring-expression:4.3.4.RELEASE | | | \--- org.springframework:spring-core:4.3.4.RELEASE | | +--- org.springframework.boot:spring-boot-autoconfigure:1.4.2.RELEASE | | | \--- org.springframework.boot:spring-boot:1.4.2.RELEASE (*) | | +--- org.springframework.boot:spring-boot-starter-logging:1.4.2.RELEASE | | | +--- ch.qos.logback:logback-classic:1.1.7 | | | | +--- ch.qos.logback:logback-core:1.1.7 | | | | \--- org.slf4j:slf4j-api:1.7.20 -> 1.7.21 | | | +--- org.slf4j:jcl-over-slf4j:1.7.21 | | | | \--- org.slf4j:slf4j-api:1.7.21 | | | +--- org.slf4j:jul-to-slf4j:1.7.21 | | | | \--- org.slf4j:slf4j-api:1.7.21 | | | \--- org.slf4j:log4j-over-slf4j:1.7.21 | | | \--- org.slf4j:slf4j-api:1.7.21 | | +--- org.springframework:spring-core:4.3.4.RELEASE | | \--- org.yaml:snakeyaml:1.17 | +--- org.springframework.boot:spring-boot-starter-tomcat:1.4.2.RELEASE | | +--- org.apache.tomcat.embed:tomcat-embed-core:8.5.6 | | +--- org.apache.tomcat.embed:tomcat-embed-el:8.5.6 | | \--- org.apache.tomcat.embed:tomcat-embed-websocket:8.5.6 | | \--- org.apache.tomcat.embed:tomcat-embed-core:8.5.6 | +--- org.hibernate:hibernate-validator:5.2.4.Final | | +--- javax.validation:validation-api:1.1.0.Final | | +--- org.jboss.logging:jboss-logging:3.2.1.Final -> 3.3.0.Final | | \--- com.fasterxml:classmate:1.1.0 -> 1.3.3 | +--- com.fasterxml.jackson.core:jackson-databind:2.8.4 | | +--- com.fasterxml.jackson.core:jackson-annotations:2.8.0 -> 2.8.4 | | \--- com.fasterxml.jackson.core:jackson-core:2.8.4 | +--- org.springframework:spring-web:4.3.4.RELEASE | | +--- org.springframework:spring-aop:4.3.4.RELEASE (*) | | +--- org.springframework:spring-beans:4.3.4.RELEASE (*) | | +--- org.springframework:spring-context:4.3.4.RELEASE (*) | | \--- org.springframework:spring-core:4.3.4.RELEASE | \--- org.springframework:spring-webmvc:4.3.4.RELEASE | +--- org.springframework:spring-aop:4.3.4.RELEASE (*) | +--- org.springframework:spring-beans:4.3.4.RELEASE (*) | +--- org.springframework:spring-context:4.3.4.RELEASE (*) | +--- org.springframework:spring-core:4.3.4.RELEASE | +--- org.springframework:spring-expression:4.3.4.RELEASE (*) | \--- org.springframework:spring-web:4.3.4.RELEASE (*) \--- ksbysample.library:ksbysample-library-depend-spring:1.0.0-RELEASE +--- org.springframework.boot:spring-boot-autoconfigure:1.3.8.RELEASE -> 1.4.2.RELEASE (*) +--- org.springframework.boot:spring-boot-starter-web:1.3.8.RELEASE -> 1.4.2.RELEASE (*) +--- org.aspectj:aspectjweaver:1.8.9 +--- org.apache.commons:commons-lang3:3.5 -> 3.4 \--- com.google.guava:guava:20.0 -> 17.0
ã½ã¼ã¹ã³ã¼ã
ksbysample-webapp-demo14/build.gradle
buildscript { ext { springBootVersion = '1.4.2.RELEASE' } repositories { mavenCentral() maven { url "http://repo.spring.io/repo/" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") classpath("io.spring.gradle:dependency-management-plugin:0.6.1.RELEASE") } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' jar { baseName = 'ksbysample-webapp-demo14' version = '0.0.1-SNAPSHOT' } sourceCompatibility = 1.8 targetCompatibility = 1.8 repositories { maven { url "http://localhost:8081/repository/maven-public" } } dependencyManagement { imports { mavenBom 'io.spring.platform:platform-bom:Athens-SR1' } } dependencies { compile('org.springframework.boot:spring-boot-starter-web') runtime('org.springframework.boot:spring-boot-devtools') testCompile('org.springframework.boot:spring-boot-starter-test') compile('ksbysample.library:ksbysample-library-depend-spring:1.0.0-RELEASE') }
- buildscript ã®ä»¥ä¸ã®ç¹ãå¤æ´ãã¾ãã
- Spring Boot 㯠1.4.3 ããªãªã¼ã¹ããã¦ãã¾ãã Spring IO Platform ã®ææ°çã§å¯¾å¿ãã¦ããã®ã¯ 1.4.2 ãªã®ã§ãspringBootVersion ã®å¤ã
1.4.3.RELEASE
â1.4.2.RELEASE
ã«å¤æ´ãã¾ãã - repositories ã«
maven { url "http://repo.spring.io/repo/" }
ã追å ãã¾ãã - dependencies ã«
classpath("io.spring.gradle:dependency-management-plugin:0.6.1.RELEASE")
ã追å ãã¾ãã
- Spring Boot 㯠1.4.3 ããªãªã¼ã¹ããã¦ãã¾ãã Spring IO Platform ã®ææ°çã§å¯¾å¿ãã¦ããã®ã¯ 1.4.2 ãªã®ã§ãspringBootVersion ã®å¤ã
apply plugin: 'io.spring.dependency-management'
ã追å ãã¾ãããã¨ä»¥åã¯apply plugin: 'spring-boot'
ã§ãããapply plugin: 'org.springframework.boot'
ã«å¤ãã£ã¦ãã¾ããã- repositories å
ã«æ¸ãã¬ãã¸ããªã
mavenCentral()
âmaven { url "http://localhost:8081/repository/maven-public" }
ã¸å¤æ´ãã¾ãã dependencyManagement { imports { mavenBom 'io.spring.platform:platform-bom:Athens-SR1' } }
ã追å ãã¾ãã- dependencies ã«
compile('ksbysample.library:ksbysample-library-depend-spring:1.0.0-RELEASE')
ã追å ãã¾ãã
TestController.java
package ksbysample.webapp.demo14; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller @RequestMapping("/test") public class TestController { @RequestMapping @ResponseBody public String index() { return "test"; } }
å±¥æ´
2016/12/28
åççºè¡ã