首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gradlew建筑不起作用

Gradlew建筑不起作用
EN

Stack Overflow用户
提问于 2016-04-14 09:16:20
回答 1查看 1.7K关注 0票数 0

当我试图用./gradlew clean清理我的项目时,它可以工作,但是./gradlew build不能工作。我尝试了一些存储库,但它无法解决Spring依赖关系。

这是build.gradle

代码语言:javascript
复制
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()
}

这里的例外是:

代码语言:javascript
复制
* 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

我认为maven回购已经足够了,但它一直失败,我也在jcenter()上尝试过。我正在开发一个ubuntu14.04VM。

解决:

正如Michael在评论中所说的那样,我不得不为依赖项添加一个版本:

代码语言:javascript
复制
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-web:1.3.3.RELEASE')
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-04-14 14:10:53

首先,在依赖项之前声明存储库。第二,替换

代码语言:javascript
复制
compile('org.springframework.boot:spring-boot-starter-web')

使用

代码语言:javascript
复制
compile('org.springframework.boot:spring-boot-starter-web:1.3.3.RELEASE')

因为前者不包含版本。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36618654

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档