How to get publication's full SNAPSHOT filename?

(yeahfaq2) #1

I have a gradle build that we have publishing to a SNAPSHOT repo for non-release versions on multiple projects. The build publishes to an Artifactory SNAPSHOT repo and it generates a timestamp on that repo when I publish.

How do I get the full SNAPSHOT filename at the time of publishing so I can store it elsewhere? E.g. instead of the base name:

version = "1.0.0-SNAPSHOT"
publishing {
	publications {
		maven(MavenPublication) {		
			artifactId 'MyArchive' 
			artifact myArchive

subprojects { 
  version = versionNum + (snapshot == 'RELEASE' ? '.' + buildNum : "-${snapshot}")
	group = "myCompany"
	publishing {         
      repositories {
            maven {
                credentials {
				def releaseType =  snapshot == 'RELEASE' ? releaseurl : snapshoturl
				url releaseType

(Crazyjavahacking) #2


did you found solution?

I am trying to solve the exact problem.

(yeahfaq2) #3

Afraid I could not find a gradle way to it. Kind of hacky, but you could have a task that runs after your publish task then query the generic snapshot url and capture what the redirected url is from that. I entertained this, but didn’t write anything because the need for this became unnecessary.