首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何为某些依赖项禁用`org.jetbrains.intellij`的缓存重定向器?

如何为某些依赖项禁用`org.jetbrains.intellij`的缓存重定向器?
EN

Stack Overflow用户
提问于 2019-06-08 08:16:05
回答 1查看 638关注 0票数 1

我想在我的插件项目中引入com.alibaba:fastjson:1.2.58,但是当gradle解析依赖项时,org.jetbrains.intellij插件会将下载请求重定向到不存在的https://cache-redirector.jetbrains.com/www.jetbrains.com/intellij-repository/releases/com/alibaba/fastjson/1.2.58/fastjson-1.2.58.pom

如何强制gradle从mavenCentral下载此依赖项?

这是我的build.gradle

代码语言:javascript
复制
buildscript {
    repositories {
        mavenCentral()

        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots/"
        }
        maven {
            url 'https://dl.bintray.com/jetbrains/intellij-plugin-service'
        }
    }
}

plugins {
    id "org.jetbrains.intellij" version "0.4.4"
}

dependencies {
   implementation 'com.alibaba:fastjson:1.2.58'
}

apply plugin: 'idea'
apply plugin: 'org.jetbrains.intellij'
apply plugin: 'java'

sourceCompatibility = 1.8
targetCompatibility = 1.8

intellij {
    version ideaVersion
    updateSinceUntilBuild false
    plugins = [
            "com.jetbrains.php:${phpPluginVersion}",
            "com.jetbrains.php.blade:${bladePluginVersion}",
            'CSS',
            'java-i18n',
            'properties',
            'git4idea'
    ]
    pluginName 'tw tools'
}

patchPluginXml {
    sinceBuild '173'
}

group 'com.baiguiren'

version '1.2'

wrapper {
    gradleVersion '5.4.1'
}

./gradlew clean && ./gradlew build的输出

代码语言:javascript
复制
BUILD SUCCESSFUL in 0s
1 actionable task: 1 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':prepareSandbox'.
> Could not resolve all files for configuration ':runtimeClasspath'.
   > Could not find com.alibaba:fastjson:1.2.58.
     Searched in the following locations:
         https://cache-redirector.jetbrains.com/www.jetbrains.com/intellij-repository/releases/com/alibaba/fastjson/1.2.58/fastjson-1.2.58.pom
         https://cache-redirector.jetbrains.com/www.jetbrains.com/intellij-repository/releases/com/alibaba/fastjson/1.2.58/fastjson-1.2.58.jar
         file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIU/2018.3.5/3abea719ce307bc4f573cba4e3d86f4e35cab07/ideaIU-2018.3.5/com.alibaba/fastjson/1.2.58/ivy-1.2.58.xml
         file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIU/2018.3.5/3abea719ce307bc4f573cba4e3d86f4e35cab07/ideaIU-2018.3.5/fastjson-1.2.58-withKotlin-withSources.xml
         file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIU/2018.3.5/3abea719ce307bc4f573cba4e3d86f4e35cab07/ideaIU-2018.3.5/com.alibaba/fastjson/1.2.58/fastjson-1.2.58.jar
         file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIU/2018.3.5/3abea719ce307bc4f573cba4e3d86f4e35cab07/ideaIU-2018.3.5/fastjson.jar
         file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2018.3.5/78cbcd517ec112fbb0c7b45b00b464c1aa6371f3/fastjson-1.2.58-[classifier].jar
         https://cache-redirector.jetbrains.com/plugins.jetbrains.com/maven/com/alibaba/fastjson/1.2.58/fastjson-1.2.58.pom
         https://cache-redirector.jetbrains.com/plugins.jetbrains.com/maven/com/alibaba/fastjson/1.2.58/fastjson-1.2.58.jar
         file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/com.alibaba/fastjson-1.2.58.xml
         file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIU/2018.3.5/3abea719ce307bc4f573cba4e3d86f4e35cab07/ideaIU-2018.3.5/plugins/fastjson/fastjson.jar
         file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/fastjson-1.2.58/fastjson.jar
         file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2018.3.5/78cbcd517ec112fbb0c7b45b00b464c1aa6371f3/fastjson-2018.3.5.jar
     Required by:
         project :

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

* Get more help at https://help.gradle.org

我尝试过Invalid caches and restart,但不能工作。

我甚至试图删除org.jetbrains.intellij插件,但它是项目所必需的。

EN

回答 1

Stack Overflow用户

发布于 2019-06-13 15:38:39

缓存重定向器没有任何问题,它只是项目中注册的存储库之一,Gradle会检查所有存储库。

尝试将mavenCentral代码库添加到您的build.gradle中(目前它仅为buildscript定义):

代码语言:javascript
复制
repositories {
        mavenCentral()
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56502434

复制
相关文章

相似问题

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