Gradle无法解析到存储库

时间:2016-06-17 09:02:57

标签: gradle

我在gradle项目中添加了一个依赖项。它无法解析最新版本。

有两个内置版本号: 1 2

Gradle只解析第一个过时的。

这是远程存储库中的maven-metadata.xml

<metadata modelVersion="1.1.0">
  <groupId>org.fountainmc</groupId>
  <artifactId>fountain-api</artifactId>
  <version>1.9.4-alpha1-SNAPSHOT</version>
  <versioning>
    <snapshot>
      <timestamp>20160617.080415</timestamp>
      <buildNumber>2</buildNumber>
    </snapshot>
    <lastUpdated>20160617080415</lastUpdated>
    <snapshotVersions>
      <snapshotVersion>
        <extension>jar</extension>
        <value>1.9.4-alpha1-20160617.080415-2</value>
        <updated>20160617080415</updated>
      </snapshotVersion>
      <snapshotVersion>
        <extension>pom</extension>
        <value>1.9.4-alpha1-20160617.080415-2</value>
        <updated>20160617080415</updated>
      </snapshotVersion>
    </snapshotVersions>
  </versioning>
</metadata>

这是我的build.gradle文件:

buildscript {
    repositories {
        maven {
            name = 'forge'
            url = 'http://files.minecraftforge.net/maven'
        }
        maven {
            name = 'sponge'
            url = 'http://repo.spongepowered.org/maven'
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
        classpath 'org.spongepowered:mixingradle:0.3-SNAPSHOT'
    }
}

plugins {
    id 'java'

    id 'idea'
    id 'eclipse'

    id 'net.minecrell.licenser' version '0.2.1'
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'org.spongepowered.mixin'

defaultTasks 'clean', 'licenseFormat'

sourceCompatibility = 1.8
targetCompatibility = 1.8

group = 'org.fountainmc'
archivesBaseName = project.name.toLowerCase()
version = '1.9.4-alpha1-SNAPSHOT'
ext.url = 'https://fountainmc.org/'

repositories {
    mavenCentral()
    maven {
        url 'https://repo.techcable.net/content/groups/public/'
    }
    maven {
        name = 'sponge'
        url = 'http://repo.spongepowered.org/maven'
    }
}

dependencies {
    compile "org.fountainmc:fountain-api:${project.version}"

    compile('org.spongepowered:mixin:0.5.1-SNAPSHOT') {
        exclude module: 'launchwrapper'
        exclude module: 'guava'
    }
}

minecraft {
    version = '12.17.0.1963'
    mappings = 'snapshot_20160518'

    runDir = 'run'

    coreMod = 'org.fountainmc.forge.FountainCoremod'
}

license {
    header file('HEADER.txt')
    include '**/*.java'
    include '**/*.groovy'
}

sourceSets {
    main {
        refMap = 'mixins.fountain.refmap.json'
    }
}

processResources {
    from('src/main/resources') {
        include 'mcmod.info'

        expand(
                version: project.version,
                url: project.url,
                minecraftVersion: '1.9.4',
                forgeVersion: '12.17.0.1963'
        )
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.13'
}

1 个答案:

答案 0 :(得分:1)

您似乎缺少定义的解决方案策略。请看一下here

以下代码似乎应该完成这项工作:

configurations.all {
    resolutionStrategy {
        cacheChangingModulesFor 0, 'seconds'
    }
}