古越剑箫

学习是一种习惯

  :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: :: 管理 ::

Could not find org.restlet.jee:org.restlet:2.1.1.

我是用gradle构建solr的时候出现的这个错误,通过google查询到这么一段解释

For the record:

The configurations default, gwtRuntime, modulesRuntime, runtime, setupRuntime are (implicitly) declared as transitive. All of them declare the dependency org.apache.solr:solr-core:4.3.0. This depends on org.restlet.jee:org.restlet:2.1.1 and org.apache.solr:solr-parent:4.3.0, and this last one in turn declares in its pom the "Public online Restlet repository" http://maven.restlet.org.

But Gradle doesn't honor repositories declared in POMs, so gradle -q dependencies warns about failing to fetch org.restlet.jee:org.restlet:2.1.1

I'm not sure how relevant all of this is, as it seems I still can compile and build a working webapp, but my IDE complains and throws and exception upon opening the project.

 

解决办法是在build.gradle配置文件中,新增maven库

 

repositories {
    mavenLocal()
    if (project.hasProperty('additional_repositories')){
        additional_repositories.split(';').each{ repo ->
            maven { url repo }
        }
    }
    mavenCentral()

    // Workaround for org.netbeans.gradle.model.util.TransferableExceptionWrapper:
    // org.gradle.internal.resolve.ModuleVersionNotFoundException: 
    // Could not find org.restlet.jee:org.restlet:2.1.1.
    maven {
        url "http://maven.restlet.org/" 
    }
}

 

 

这个错误在maven项目中很好解决,但是国内关注使用gradle的人并不多,所以网上没找到合适的解决方案,也没有能讲清楚原理的,关键时候还是得看google!

原文如下:

 https://github.com/alkacon/opencms-core/issues/337

 

posted on 2016-10-27 14:17  古越剑箫  阅读(1385)  评论(0编辑  收藏  举报