Я новичок в Java и Spring.Я попытался начать с https://spring.io/guides/gs/producing-web-service/ Я загрузил контент для начального и полного решения в STS 3.9.5 IDE с Gradle Bulidship 2.0.Но настройка этого проекта не готова к использованию.В пакете привет импорт кажется плохим.
import io.spring.guides.gs_proroduction_web_service.GetCountryRequest;import io.spring.guides.gs_proroduction_web_service.GetCountryResponse;
Я получаю сообщение «Импорт io не может быть разрешен»
Какя могу это исправить?
Я ничего не изменил в bulid.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.5.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
repositories {
mavenCentral()
}
// tag::xsd[]
task genJaxb {
ext.sourcesDir = "${buildDir}/generated-sources/jaxb"
ext.classesDir = "${buildDir}/classes/jaxb"
ext.schema = "src/main/resources/countries.xsd"
outputs.dir classesDir
doLast() {
project.ant {
taskdef name: "xjc", classname: "com.sun.tools.xjc.XJCTask",
classpath: configurations.jaxb.asPath
mkdir(dir: sourcesDir)
mkdir(dir: classesDir)
xjc(destdir: sourcesDir, schema: schema) {
arg(value: "-wsdl")
produces(dir: sourcesDir, includes: "**/*.java")
}
javac(destdir: classesDir, source: 1.6, target: 1.6, debug: true,
debugLevel: "lines,vars,source",
classpath: configurations.jaxb.asPath) {
src(path: sourcesDir)
include(name: "**/*.java")
include(name: "*.java")
}
copy(todir: classesDir) {
fileset(dir: sourcesDir, erroronmissingdir: false) {
exclude(name: "**/*.java")
}
}
}
}
}
// end::xsd[]
task afterEclipseImport {
dependsOn "genJaxb"
}
// tag::jaxb[]
configurations {
jaxb
}
bootJar {
baseName = 'gs-producing-web-service'
version = '0.1.0'
from genJaxb.classesDir
}
// tag::dependencies[]
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web-services")
testCompile("org.springframework.boot:spring-boot-starter-test")
compile("wsdl4j:wsdl4j:1.6.1")
jaxb("org.glassfish.jaxb:jaxb-xjc:2.2.11")
compile(files(genJaxb.classesDir).builtBy(genJaxb))
}
// end::dependencies[]
// end::jaxb[]