1

I have a problem with a snapshot artifact not being uploaded.

I'm using snapshot version. Atrifact is marked explicitly as changing: true and cacheChangingModulesFor is set to 0 seconds.

When i run --refresh-dependecies the artifact is redownloaded properly.

I found the problem while using gradle 2.9. But after upgrading to 2.14.1 the issue remains.

Below is my build.gradle file:

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'
}
Tuan Pham
  • 1,171
  • 2
  • 15
  • 27
  • what gradle tasks are you running when you try to upload to the nexus? Are you able to upload any other artifacts to the nexus? – robjwilkins Oct 05 '16 at 13:03
  • @robjwilkins It's not a problem with uploading, uploading works fine. The problem is with downloading newer version of snapshot dependency. – Tuan Pham Oct 05 '16 at 13:21

1 Answers1

0

I think you maybe have the syntax for the changing dependency slightly wrong.

Can you try replacing:

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

with:

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

Can you also try adding a line to the resolutionStrategy for cacheDynamicVersionsFor as follows:

configurations.all {    
    resolutionStrategy {
        cacheDynamicVersionsFor 0, "seconds"
        cacheChangingModulesFor 0, "seconds"
    }
}
robjwilkins
  • 5,462
  • 5
  • 43
  • 59
  • can you try adding cacheDynamicVersionsFor 0, "seconds" too? – robjwilkins Oct 05 '16 at 13:38
  • I didn't because of 2 reasons. 1. Snapshot is changing not dynamic so it shouldn't matter. 2. "changing" property is afaik optional for snapshot version, as they are by default changing. And also both syntaxes should be equivalent. – Tuan Pham Oct 05 '16 at 13:55