无法使用Intellij中的Resteasy解决其他项目配置

时间:2017-07-20 13:01:08

标签: java google-app-engine intellij-idea gradle resteasy

Hai我是Resteasy的新手,我正在使用gradle for app engine应用程序,我使用的是Intellij IDE,这里我使用的是依赖项中的最新版本,

compile group: 'org.jboss.resteasy', name: 'resteasy-jaxrs', version: '3.0.23.Final'
compile group: 'org.jboss.resteasy', name: 'resteasy-jackson2-provider', version: '3.0.23.Final'

我遇到了错误,但我使用的是旧版本,

compile group: 'org.jboss.resteasy', name: 'resteasy-jaxrs', version: '3.0.10.Final'
compile group: 'org.jboss.resteasy', name: 'resteasy-jackson2-provider', version: '3.0.10.Final'

该应用程序工作正常,但我需要使用新版本如何解决它?谁能解决这个问题?我的文件夹结构和build.gradle在下面给出

当我在依赖项中提到新版本时,会出现弹出窗口(如图所示)

enter image description here

我收到警告

Warning:<i><b>root project 'Sample': Unable to resolve additional project configuration.</b>
Details: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':compileClasspath'.
Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not download commons-codec.jar (commons-codec:commons-codec:1.9)
Caused by: org.gradle.api.UncheckedIOException: Could not read entry '22da77b0d76ea8df17298218f3ec1f87:commons-codec.jar (commons-codec:commons-codec:1.9)' from cache artifact-at-repository.bin (C:\Users\user\.gradle\caches\modules-2\metadata-2.23\artifact-at-repository.bin).
Caused by: java.io.EOFException: null
Caused by: com.esotericsoftware.kryo.KryoException: Buffer underflow.</i>

当我尝试尝试任务appengineRun时,我得到的错误是,

    05:56:35 PM: Executing external task 'appengineRun'...
:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
> Could not download commons-codec.jar (commons-codec:commons-codec:1.9)
   > Could not read entry '22da77b0d76ea8df17298218f3ec1f87:commons-codec.jar (commons-codec:commons-codec:1.9)' from cache artifact-at-repository.bin (C:\Users\user\.gradle\caches\modules-2\metadata-2.23\artifact-at-repository.bin).

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 0.447 secs
Buffer underflow.
05:56:36 PM: External task execution finished 'appengineRun'.

enter image description here

build.gradle中的

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.cloud.tools:appengine-gradle-plugin:+'
    }
}

repositories {
    jcenter()
    mavenCentral()
}


apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'com.google.cloud.tools.appengine'

dependencies {
    //working--//compile group: 'org.jboss.resteasy', name: 'resteasy-jaxrs', version: '3.0.10.Final'
    compile group: 'org.jboss.resteasy', name: 'resteasy-jaxrs', version: '3.1.3.Final'

    //working--//compile group: 'org.jboss.resteasy', name: 'resteasy-jackson2-provider', version: '3.0.10.Final'
    compile group: 'org.jboss.resteasy', name: 'resteasy-jackson2-provider', version: '3.1.3.Final'
    compile 'com.google.appengine:appengine:+'
}

appengine {
    run {
        port = 8080
    }

    deploy {
        stopPreviousVersion = true
        promote = true
    }
}

sourceCompatibility = 1.7
targetCompatibility = 1.7

1 个答案:

答案 0 :(得分:1)

您是否在代理后面运行构建?在这种情况下,您无法直接访问maven central,您需要根据此doc相应地设置代理设置。在gradle讨论论坛here上讨论了类似的错误和解决方案。