我有以下代码:
public class Application {
public static void main(String[] args){
SpringApplication.run(Application.class, args);
}
}但是Eclipse不能识别SpringApplication,也不能为它导入库。
build.gradle包含:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.7.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'spring-boot'
dependencies {
compile 'org.slf4j:slf4j-api:1.7.5'
compile 'net.sourceforge.jexcelapi:jxl:2.6.12'
compile 'com.qas:proweb:1.0.0'
compile "org.springframework:spring-beans:$springVersion"
compile "org.springframework:spring-jdbc:$springVersion"
compile "org.springframework:spring-web:$springVersion"
compile "org.springframework.boot:spring-boot-gradle-plugin:1.2.7.RELEASE"
testCompile 'junit:junit:4.11'
}我遗漏了什么吗?
发布于 2015-10-26 15:03:22
你的依赖是错误的。尝试删除这个(不是从构建脚本依赖项中删除,而是从项目的依赖项中删除):
compile "org.springframework.boot:spring-boot-gradle-plugin:1.2.7.RELEASE"并添加
compile("org.springframework.boot:spring-boot-starter-web:1.2.7.RELEASE")然后向你汇报最新情况
发布于 2015-10-26 15:11:51
对build.gradle文件进行了如下修改,以使其工作:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.7.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'spring-boot'
dependencies {
compile 'org.slf4j:slf4j-api:1.7.5'
compile 'net.sourceforge.jexcelapi:jxl:2.6.12'
compile 'com.qas:proweb:1.0.0'
compile "org.springframework:spring-beans:$springVersion"
compile "org.springframework:spring-jdbc:$springVersion"
compile "org.springframework:spring-web:$springVersion"
compile "org.springframework.boot:spring-boot-starter-web:1.2.5.RELEASE"
testCompile 'junit:junit:4.11'
}https://stackoverflow.com/questions/33348645
复制相似问题