赞
踩
写了个 demo ,引了个 okhttp 的依赖,但 ide 里面老是红色报错说找不到,但 gradle build 却可以通过。
好烦啊 o(>< )o 什么提示都没有还不如记事本,不知道该怎么解决。
项目有两个子项目
root
|— backend
|— front
root 的 builde.gradle
buildscript {
ext {
springBootVersion = '1.4.0.RELEASE'
}
repositories {
jcenter()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
subprojects {
apply plugin: 'spring-boot'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
repositories {
jcenter()
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
mavenCentral()
}
dependencies {
testCompile 'junit:junit:4.12'
compile('org.springframework.boot:spring-boot-starter')
compile("org.springframework.boot:spring-boot-starter-web")
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'org.mousio:etcd4j:2.12.0'
testCompile('org.springframework.boot:spring-boot-starter-test')
}
version = '1.0'
jar {
manifest.attributes provider: 'gradle'
}
}
子项目的 build.gradle
sourceCompatibility = 1.8
targetCompatibility = 1.8
jar {
baseName = 'front'
version = '0.0.1-SNAPSHOT'
}
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'
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。