Как я могу отключить кеш-редиректор `org.jetbrains.intellij` для некоторых зависимостей? - PullRequest
0 голосов
/ 08 июня 2019

Я хочу ввести com.alibaba:fastjson:1.2.58 в моем проекте плагина, но когда Gradle разрешает зависимости, плагин org.jetbrains.intellij перенаправляет запрос на загрузку на https://cache -redirector.jetbrains.com / www.jetbrains.com / intellij-репозиторий / release / com / alibaba / fastjson / 1.2.58 / fastjson-1.2.58.pom , которого не существует.

Как я могу заставить gradle загрузить эту зависимость с mavenCentral?

Вот мой build.gradle:

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:

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, но это требуется проектом.

1 Ответ

0 голосов
/ 13 июня 2019

Нет ничего плохого в перенаправлении кэша, это всего лишь один из репозиториев, зарегистрированных в проекте, Gradle проверяет их все.

Попробуйте добавить репозиторий mavenCentral в свой build.gradle (на данный момент он определен только для buildscript):

repositories {
        mavenCentral()
}
...