Publishing without rebuilding


(Arnaud Esteve) #1

Hi there, I’m looking for a proper, clean way to publish an artifact to a Nexus repository without rebuilding the whole project.

I’m not sure this is under the scope of the actual gradle-release plugin.

Let’s imagine the following scenario :

  • Every push triggers a new build : group:artifact:version-SNAPSHOT-${-> new Date().time}
  • The SNAPSHOT is uploaded to Nexus
  • The SNAPSHOT is deployed (on an integration server), integration testing follows
  • The version seems OK, maybe manual testing, timing is OK for a proper release
  • Without rebuilding from the source, upload the exact same artifact with another version number (no more SNAPSHOT) to Nexus (and then deploy this artifact version).

The artifact can either be taken from a Jenkins archive (archiveArtifacts post action) or from Nexus directly, it doesn’t matter, I’d just like to avoid at all cost doing a new SCM pull/clone/… and preferably not triggering a new build, by safety (even though the build should be 100% deterministic).

Has anyone ever faced the same issue ? Which solutions are you guys using ? Is this out of Gradle scope ?


(René Groeschke) #2

Gradle does not yet offer a wholistic solution for this usecase. I’ve seen people solving this usecase by using the staging mechanisms within the repository manager.

If you just want to shortcircuit the gradle build to upload artifacts built before you could declare a cusotm configuration (e.g. releaseArchives) and append prior built files artifacts to it. Then you just need to run uploadReleaseArchives. The gradle userguide has more information about publishing file artifacts at https://docs.gradle.org/current/userguide/userguide_single.html#artifact_management


(Arnaud Esteve) #3

Thanks a lot for your answer René, I found a workaround for the specific use case but I’ll definitely look at the custom configuration solution at some point.

Once again, thanks for your help, really much appreciated.