当我尝试使用其清理项目时,./gradlew clean
该项目./gradlew build
将无法正常工作。我尝试了一些存储库,但无法解决Spring依赖项。
这是build.gradle
:
apply plugin: 'war'
war {
baseName = 'hello'
}
configurations {
providedRuntime
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.json:json:20141113')
compile('com.jayway.jsonpath:json-path:0.8.1')
compile('org.jsoup:jsoup:1.8.2')
compile('org.springframework.social:spring-social-twitter')
compile('org.springframework.social:spring-social-twitter:1.1.0.RELEASE')
compile('org.springframework.social:spring-social-core')
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
repositories {
mavenCentral()
}
这里是例外:
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Cannot resolve external dependency org.springframework.boot:spring-boot-starter-web: because no repositories are defined.
Required by:
:hello:unspecified
> Cannot resolve external dependency org.json:json:20141113 because no repositories are defined.
Required by:
:hello:unspecified
> Cannot resolve external dependency com.jayway.jsonpath:json-path:0.8.1 because no repositories are defined.
Required by:
:hello:unspecified
> Cannot resolve external dependency org.jsoup:jsoup:1.8.2 because no repositories are defined.
Required by:
:hello:unspecified
> Cannot resolve external dependency org.springframework.social:spring-social-twitter:1.1.0.RELEASE because no repositories are defined.
Required by:
:hello:unspecified
> Cannot resolve external dependency org.springframework.social:spring-social-twitter:1.1.0.RELEASE because no repositories are defined.
Required by:
:hello:unspecified
> Cannot resolve external dependency org.springframework.social:spring-social-core: because no repositories are defined.
Required by:
:hello:unspecified
我认为行家回购是足够的,但它一直失败,我也尝试过jcenter()
。我正在使用Ubuntu 14.04 VM。
解决了:
正如Michael在评论中所说,我必须为依赖项添加一个版本:
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-web:1.3.3.RELEASE')
首先,在依赖项之前声明存储库。其次,更换
compile('org.springframework.boot:spring-boot-starter-web')
和
compile('org.springframework.boot:spring-boot-starter-web:1.3.3.RELEASE')
因为前者不包含版本。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句