0

I'm running Nexus and I have a snapshots Maven repository. When I publish artifacts to that repository I also run a "Rebuild Maven Metadata Files" type task that runs for about 5 minutes and updates "LATEST" to actually point to the newest artifacts. Can I update that LATEST reference some other way? I publish with Gradle. Can Gradle just update that specific groups metadata?

Thanks

techgnosis
  • 1,879
  • 2
  • 17
  • 19
  • I don't fully understand your question. Nexus automatically updates the artefact metadata when you deploy it (maybe gradle calls publish to deploy?). This is a basic functionality of any maven-compatible repository. I'm not sure if you also mean something related to this question: http://stackoverflow.com/questions/10370422/gradle-getting-the-latest-release-version-of-a-dependency – Augusto Apr 09 '15 at 21:13
  • Yeah we do gradle publish to publish to Nexus. All of my experience seems to show me that LATEST does not get updated. I'm doing a very careful test right now to see if I'm just crazy.. – techgnosis Apr 09 '15 at 21:18
  • Maven has a setting to set how often to check for snapshots (the default is **once per day**). for what I can read from Gradle's documentation, gradle checks every 10 minutes by default (cacheDynamicVersionsFor at http://gradle.org/docs/current/javadoc/org/gradle/api/artifacts/ResolutionStrategy.html). Why don't you try to set this to 1 or 2 minutes? (We have this set up to be 2 minutes at work with Maven) – Augusto Apr 09 '15 at 21:25
  • Yeah I'm quite positive it doesn't. I disabled the metadata update job and published a build with a higher builder number and LATEST points to the last highest build when the task ran. It is not updating the LATEST metadata automatically. – techgnosis Apr 09 '15 at 21:25
  • I just realised that we're talking about different things... Sorry to muddy up the waters! (what I mentioned is related to SNAPSHOTS, but it looks like you create a new version per commit/build) – Augusto Apr 09 '15 at 21:27
  • I think I understand now. We aren't actually using the snapshots workflow as intended. We push a new build number every time and label it with -SNAPSHOT. – techgnosis Apr 09 '15 at 21:52

1 Answers1

1

The maven metadata file is NOT managed by Nexus but by the client side tool. By default that is Maven and it downloads the metadata file as part of the deployment, updates it with the new snapshot data and uploads it again.

Potentially Gradle does not do that correctly and that is the reason you have to use the workaround of using the Nexus scheduled task. I don't think Gradle has any further tools to fix it up better. The only thing I can think of you could do is to kick off the scheduled task from Gradle automatically. But you would still have the timing problem.

Best would be to file a bug against Gradle and get it fixed.

Manfred Moser
  • 29,539
  • 13
  • 92
  • 123