来自nexus snapshot repo的Gradle更改模块未更新

时间:2016-09-27 12:01:32

标签: gradle nexus

我遇到了未上传快照工件的问题。

我正在使用快照版本。 Atrifact明确标记为changing: truecacheChangingModulesFor设置为0秒。

当我运行--refresh-dependecies时,工件正确地重新加载。

我在使用gradle 2.9时发现了这个问题。但在升级到2.14.1之后,问题仍然存在。

以下是我的build.gradle文件:

buildscript {
    ext {
        springBootVersion = '1.3.5.RELEASE'
    }
    repositories {
        mavenCentral()
        maven { url 'http://repo.spring.io/plugins-release' }
    }
    // dependencies for plugins
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
        classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
    }
}


apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-idea'

configurations.all {
    // Check for updates every build
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}


jar {
    baseName = 'someproject'
    version = '0.0.1-SNAPSHOT'
}

war {
    baseName = "someproject"
    version = '0.0.1-SNAPSHOT'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
    maven { url "https://jitpack.io" }
    maven {
        url 'http://nexus.example.com:8081/nexus/content/repositories/java-libs-snapshots/'
        credentials {
            username "someuser"
            password "somepassword"
        }
    }
}

// enables to run with dev profile: $ gradle local bootRun
task local << {
    bootRun.systemProperty 'spring.profiles.active', 'local'
}

bootRun {
    jvmArgs = ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"]
}

dependencies {
    compile 'mysql:mysql-connector-java'
    compile 'org.springframework.boot:spring-boot-starter-web'
    compile group: "pl.example", name: "name", version: "0.7.6.1-SNAPSHOT", changing: true
    compile 'org.jadira.usertype:usertype.core:5.0.0.GA'
    compile group: 'com.rometools', name: 'rome', version: '1.6.0'
    compile group: 'org.jsoup', name: 'jsoup', version: '1.9.2'
    compile 'org.hibernate:hibernate-search:5.5.3.Final'
    compile 'org.projectlombok:lombok:1.16.6'
}

1 个答案:

答案 0 :(得分:0)

我认为你可能有更改依赖的语法略有错误。

你可以尝试更换:

compile group: "pl.example", name: "name", version: "0.7.6.1-SNAPSHOT", changing: true

使用:

compile ("pl.example:name:0.7.6.1-SNAPSHOT"){ changing = true }

您是否可以尝试为cacheDynamicVersionsFor的resolutionStrategy添加一行:

configurations.all {    
    resolutionStrategy {
        cacheDynamicVersionsFor 0, "seconds"
        cacheChangingModulesFor 0, "seconds"
    }
}
相关问题