Can not get newest dependency

Hallo,

we use gradle for our build inside our company. But sometimes we realized that we and right now I can not get the newest dependency when we or I build a project. I also used gradle --refresh-dependencies but that did not solve the problem. So I also deleted the gradle dependency cache and started a rebuild, but it still downloads an older dependency version from our repository ( we use Artifactory ). I looked through in our Artifactory inside the directory of the dependency that I want to have as newest one. But I see that I only the dependency which is from 1 day and 3 hours. We have since that time 2 newer dependencies in our artifactory - last one is uploaded 5 h 30 minutes ago.

Any ideas where the problem is? We have because of this case a very big problem in our development team because many people can not build with the newest source code / dependency.

Should it not working when I make a refresh-dependencies? Should then gradle not check the newest version inside the repository / artifactory and download it if it is newer? Or when I delete the gradle cache of that dependency, should it not download the newest one and not always the same older one? These are very important facts that must work.

Where is the problem?

Thanks for your help / answer.

Can you show the dependency declaration(s)? Are you talking about Maven snapshots? Who is publishing the module(s)?

Hi Peter,

we upload these snapshots by the gradle upload Archives task. What is confusing is, after few hours, when I build my project, I have the newest dependency! Now I have it inside my cache but yesterday I could not get it! These behaviour I saw many times!! It is blocking our development process! That is the dependency declaration when I look in hour artifactory for gradle:

compile(group: ‘com.xyz.a’, name: ‘a-repository’, version: ‘2.0.0-20130518.174819-1331’, ext: ‘amp’)

And that is the path in our artifactory to the dependency: com/xyz/a/a-repository/2.0.0-SNAPSHOT/a-repository-2.0.0-20130518.174819-1331.amp

But we use in hour Projects following dependency:

compile(group: ‘com.xyz.a’, name: ‘a-repository’, version: ‘2.0.0-SNAPSHOT’, ext: ‘amp’)

Thanks for helping!

I guess I know the problem: When I have deleted the dependency inside the cache I had not only deleted the content of the “jar” directory where the dependencies are in it (there are folders with hash names). But I have not deleted the “pom” directory. If doing this gradle had downloaded only an older hash (=>dependency).

But still there is a problem :

Gradle is not always downloading the newest dependencies ! Why is that so (apart from above issue). I can use task gradle with argument refresh dependencies, but does not help.

Any ideas why that is so?

We have still the same problem:

=> Now I have deleted all my cache folder of the dependency, but I still get an older one. In other words, the previous post where I started so “I guess I know the problem:” was not the reason. Because I have deleted everything but gradle is downloading an older JAR dependency although we have in our Artifactory newer one. I am sure that when I make tomorrow a new build of my local system it downloads the newer one.

Any idea why that is so?

Which “cache folder” are you deleting?

-SNAPSHOT versions are considered “changing” dependencies. And are cached for 24 hours by default.

When you launch Gradle, specify the ‘–refresh-dependencies’ flag to force checking for new versions.

1 Like

I delete the complete dependency folder: ~/.gradle/caches/artifacts-23/filestore/de.wps.search

Before I have deleted this folder I have executed the so called “–refresh-dependencies” but no newer dependency is downloaded!!! Although in Artifactory a newer one exists. I often have this problem! Right now again with a new dependency, I can not get its SNAPSHOT version - even after I execute the “–refresh-dependencies” and even after I deleted the cache folder of the dependency.

I am sure that in few hours or tomorrow I can get the newer dependency! The only way how I can fix this bug is to switch to an other gradle version, then the other version of gradle is able to download the newer version.

Strange behaviour, right?

Run with the ‘-i’ and ‘–refresh-dependencies’ arguments. It will show you the network requests being made.

Make sure the requests being made are what you expect.

Have executed the refresh dependency task with option -i. But i see not in the output that the dependency that I want to be updated which should be modified is listed or anything is written about it. I can not see/find the name of this dependency.

Please provide the output via https://gist.github.com/.

Ok, I have added the output here: https://gist.github.com/anonymous/5706398. Thanks a lot for helping us!

Can you also post your ‘dependencies’ block and which dependency in particular is not updating?

This dependency is will not be updated:

runtime(group: ‘de.wps.search’, name: ‘searchUI’, version: ‘0.1.0-SNAPSHOT’);

Dependency block of subproject 1:

dependencies {
                  runtime ('extensions:javascript-console-share-4.0.x:0.5')
        if( !project.hasProperty("noDeployOfRMCoreRuntimeDependency")){
            runtime('com.westernacher.recordmanagement:recordmanagement-share:' + rmCoreQualifier + '@amp')
        }
        runtime('com.westernacher.mailintegration:alfrescomailintegration-share:' + wpsOutlookPluginVersion + '@amp')
        runtime('com.westernacher.bnotk-internal-section:bnotkinternalsection-share:' + bnotkInternalSectionVersion + '@amp')
        runtime( 'com.westernacher.mediaPlayers.westernacherEasyAnnotationFlashViewer:westernachereasyannotationflashviewer-share:'+westernacherEasyAnnotationFlashViewerVersion+'@amp')
        runtime ("com.westernacher.mediaPlayers.recordviewer:recordviewer-share:"+recordViewerVersion+"@amp")
        runtime('com.westernacher.bnotk:bnotk-theme-share:' + bnotkThemeVersion + '@amp')
        runtime(group: 'de.wps.search', name: 'searchUI', version: '0.1.0-SNAPSHOT');
        runtime(group: 'de.wps.xnui', name: 'xnui-min', version: '1.0.0-SNAPSHOT');
        runtime(group: 'de.wps.xnui', name: 'xnui', version: '1.0.0-SNAPSHOT');
        runtime 'com.sencha:extjs:4.1.3'
        runtime 'com.sencha:extjs-min:4.1.3'
        runtime 'de.wps.persondictionary:persondictionary-ui:'+mddVersion;
        runtime('de.wps.persondictionary:persondictionary-ui-min:'+mddVersionMin)
        providedCompile( 'org.alfresco.enterprise-sdk:share:'+alfrescoTargetVersion )
        providedCompile( 'org.alfresco.enterprise:share:'+alfrescoTargetVersion+'@war' )
        providedCompile( 'javax.servlet:servlet-api:2.5' )
        runtime ('org.apache.httpcomponents:httpclient:4.2.5')
        compile ('org.apache.httpcomponents:httpclient:4.2.5')
        runtime('com.westernacher.wpsinfo:wpsinfo-share:'+wpsInfoVersion+'@amp')
        compile('com.westernacher.bnotk-internal-section:bnotkinternalsection-share-api:'+bnotkInternalSectionVersion+'@jar')
    }

Dependency block of subproject 2 (here the dependency is not used):

dependencies {
        providedCompile(group: 'com.westernacher.recordmanagement', name: 'recordmanagement-repository-api', version: rmCoreQualifier, ext: 'jar')
        runtime('org.alfresco.enterprise:alfresco-spp:'+alfrescoTargetVersion+'@amp')
        runtime ('extensions:javascript-console-repo-4.0.x:0.5')
        if( !project.hasProperty("noDeployOfRMCoreRuntimeDependency")){
            runtime('com.westernacher.recordmanagement:recordmanagement-repository:' + rmCoreQualifier + '@amp')
        }
        runtime('com.westernacher.wps-alfresco-utils:wpsalfrescoutils-repository:' + wpsUtilsVersion + '@amp')
        providedCompile('com.westernacher.wps-alfresco-utils:wpsalfrescoutils-repository-lib:' + wpsUtilsVersion + '@jar')
        providedCompile('com.westernacher.mailintegration:alfrescomailintegration-repository-api:' + wpsOutlookPluginVersion + '@jar')
        runtime('com.westernacher.mailintegration:alfrescomailintegration-repository:' + wpsOutlookPluginVersion + '@amp')
        runtime('com.westernacher.mailtransformer:alfrescomailtransformer-repository:'+ wpsMailTransformerVersion +'@amp')
        runtime('com.westernacher.bnotk-internal-section:bnotkinternalsection-repository:' + bnotkInternalSectionVersion + '@amp')
        runtime( 'com.westernacher.mediaPlayers.westernacherEasyAnnotationFlashViewer:westernachereasyannotationflashviewer-repository:'+westernacherEasyAnnotationFlashViewerVersion+'@amp')
        providedCompile( 'org.alfresco.enterprise-sdk:alfresco:'+alfrescoTargetVersion ) { exclude group:'com.sun.jdmk', module: 'jmxtools' }
        providedCompile( 'javax.servlet:servlet-api:2.5' )
        providedCompile( 'javax.servlet:jsp-api:2.1' )
        providedCompile( 'org.alfresco.enterprise:alfresco:'+alfrescoTargetVersion+'@war' )
        runtime ("com.westernacher.alfresco.transformationserver:alfresco-transformationserver-repo:" + alfrescoTransformationServerVersion + "@amp")
        runtime('com.westernacher.wpsinfo:wpsinfo-repository:'+wpsInfoVersion+'@amp')
        compile('com.westernacher.bnotk-internal-section:bnotkinternalsection-repository-api:'+bnotkInternalSectionVersion+'@jar')
    }

Thanks for helping!

The command you ran didn’t exercise runtime dependencie

Please run:

./gradlew «project1»:dependencies --refresh-dependencies -i

Where «project1» is the name of the project with the dependency on searchUI.

I guess you mean gradle and not gradlew

If you use the Gradle Wrapper, it’s ‘gradlew’. Otherwise it’s ‘gradle’.

I always use in my build.gradle script following settings:

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

WIth above settings I always should get the newest dependencies, or not? Why is it not so? I mean I do not need to refresh dependencies when above setting is used, or not?

Hallo,

Problem is still not fixed with the refresh dependency command you told me.

Inside the dependency part you find the dependency called “runtime(group: ‘de.wps.xnui’, name: ‘xnui-min’, version: xnuiMinVersion);”. For example this dependency is not updated, although we have uploaded a never version in our artifactory 30 mins ago. This is my dependency part in build script:

dependencies {
                   if( !project.hasProperty("noDeployOfRMCoreRuntimeDependency")){
            runtime('com.westernacher.recordmanagement:recordmanagement-share:' + rmCoreQualifier + '@amp')
        }
      runtime "com.westernacher.bnotk.e-akte:e-akte-share:2.0.0-SNAPSHOT@amp"
        runtime('com.westernacher.mailintegration:alfrescomailintegration-share:' + wpsOutlookPluginVersion + '@amp')
        runtime('com.westernacher.bnotk-internal-section:bnotkinternalsection-share:' + bnotkInternalSectionVersion + '@amp')
                  runtime( 'com.westernacher.mediaPlayers.westernacherEasyAnnotationFlashViewer:westernachereasyannotationflashviewer-share:'+westernacherEasyAnnotationFlashViewerVersion+'@amp')
        runtime ("com.westernacher.mediaPlayers.recordviewer:recordviewer-share:"+recordViewerVersion+"@amp")
        runtime('com.westernacher.bnotk:bnotk-theme-share:' + bnotkThemeVersion + '@amp')
                  runtime(group: 'de.wps.search', name: 'searchUI', version: searchUIVersion);
                  runtime(group: 'de.wps.xnui', name: 'xnui-min', version: xnuiMinVersion);
        runtime(group: 'de.wps.xnui', name: 'xnui', version: xnuiVersion);
                            runtime 'com.sencha:extjs:4.1.3'
        runtime 'com.sencha:extjs-min:4.1.3'
          runtime 'de.wps.persondictionary:persondictionary-ui:'+mddVersion;
        runtime('de.wps.persondictionary:persondictionary-ui-min:'+mddVersionMin)
                  providedCompile( 'org.alfresco.enterprise-sdk:share:'+alfrescoTargetVersion )
        providedCompile( 'org.alfresco.enterprise:share:'+alfrescoTargetVersion+'@war' )
        providedCompile( 'javax.servlet:servlet-api:2.5' )
                  runtime('com.westernacher.wpsinfo:wpsinfo-share:'+wpsInfoVersion+'@amp')
                  compile('com.westernacher.bnotk-internal-section:bnotkinternalsection-share-api:'+bnotkInternalSectionVersion+'@jar')
    }

This the refresh dependency task shows about the xnui dependency - any ideas? (By the wayI have disabled caching - see last post - or not?) :

Resource missing. [HTTP GET: https://notInteresting/artifactory/aggregated-releases/de/wps/xnui/xnui-min/1.1.0-SNAPSHOT/maven-metadata.xml]

[exec] Resource missing. [HTTP HEAD: https://notInteresting/artifactory/aggregated-releases/de/wps/xnui/xnui-min/1.1.0-SNAPSHOT/xnui-min-1.1.0-SNAPSHOT.pom]

[exec] Resource missing. [HTTP HEAD: https://notInteresting/artifactory/aggregated-releases/de/wps/xnui/xnui-min/1.1.0-SNAPSHOT/xnui-min-1.1.0-SNAPSHOT.jar]

[exec] Cached resource is up-to-date (lastModified: Wed Jun 12 13:17:55 CEST 2013). [HTTP: https://notInteresting/artifactory/aggregated-snapshots/de/wps/xnui/xnui-min/1.1.0-SNAPSHOT/xnui-min-1.1.0-20130612.105945-15.pom]

[exec] Resource missing. [HTTP GET: https://notInteresting/artifactory/aggregated-releases/de/wps/xnui/xnui/1.1.0-SNAPSHOT/maven-metadata.xml]

[exec] Resource missing. [HTTP HEAD: https://notInteresting/artifactory/aggregated-releases/de/wps/xnui/xnui/1.1.0-SNAPSHOT/xnui-1.1.0-SNAPSHOT.pom]

[exec] Resource missing. [HTTP HEAD: https://notInteresting/artifactory/aggregated-releases/de/wps/xnui/xnui/1.1.0-SNAPSHOT/xnui-1.1.0-SNAPSHOT.jar]

=> Thanks for your help!

Seems afterward, when I start a new build the updated runtime dependency will be downloaded but not at once when I start the refresh dependencies task.

But why must this be done when I have deactivated cache?