BeP*_*otr 1 spring web-services gradle build.gradle
我是 Java 和 Spring 的新手。我尝试从https://spring.io/guides/gs/having-web-service/开始 ,我将初始和完整解决方案的内容下载到带有 gradle bulidship 2.0 的 STS 3.9.5 IDE 中。但是安装这个项目还没有准备好使用。在包hello中导入似乎很糟糕。
导入 io.spring.guides.gs_having_web_service.GetCountryRequest; 导入 io.spring.guides.gs_having_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[]
Run Code Online (Sandbox Code Playgroud)
当我从这里导入项目时,我遇到了同样的错误:https ://spring.io/guides/gs/having-web-service
在 IntelliJ 上右键单击该项目并向下滚动到 Maven 选项。
单击“生成源并更新文件夹”,这将为项目生成域类。
| 归档时间: |
|
| 查看次数: |
2320 次 |
| 最近记录: |