Gradle과 IntelliJ를 사용하여 Spring Framework Restful Web Service 작성 자습서 (https://spring.io/guides/gs/rest-service/#scratch)를 사용해 보려고합니다. 나는 편지에 모든 것을 따라 갔지만 Spring, IntelliJ 및 Java에 대해 상당히 새로운 것이므로 일반적으로 내 문제를 디버깅하는 방법을 알지 못합니다.IntelliJ에서 Spring RestService 자습서를 만들 수 없습니다.
프로젝트를 빌드 할 때 "Java : package org.springframework.web.bind.annotation이 없습니다."라는 오류 메시지가 나타납니다. 라이브러리 참조가 누락 된 것 같지만 확인하고 포함하는 방법을 잘 모르겠습니다.
buildscript {
ext {
springBootVersion = '1.3.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.springframework:spring-web:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'hello_springtest'
version = '0.0.1-SNAPSHOT'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}
방금 추가 정보를 추가한다고 생각했습니다. 나는 여전히 오류를보고 있는데 왜 확신 할 수 없지만 프로젝트에서 빌드가 성공적이라고보고합니다. 그러나 프로젝트를 만들려고 할 때 주석을받지 못하면 오류가 발생합니다.
또한 IntelliJ 및 Gradle https://spring.io/guides/gs/intellij-idea/에 대한 IDE 단계를 따라 했습니까? – judoole
@judoole 그래서 스프링에서 IntelliJ로 자습서를 가져 오기위한 연습과 같이 보입니다. 나는 처음부터 끝까지 걷고 그것을 만들려고 시도 했으므로 그 중 아무 것도 실제로 적용되지 않는 것 같습니다. –
링크의 연습은이 튜토리얼의 정확한 참조입니다. https://spring.io/guides/gs/rest-service/#use-sts 제가 물었던 이유는 IntelliJ가 오류를 가져 오지 못했기 때문입니다. – judoole