Custom upload with gradle 7

Hi,

I have a custom task that uploads a custom wrapper to our binary repo (downloads a gradle version, fiddles around with some init.d stuff and then zips the whole thing and uploads it to a custom location in artifactory.

Here is how it looks (and works) in gradle 6.x

task makeGradleDistribution(type: Zip, dependsOn: updateGradleDistroInit) {
    def distroVersion = "gradle-internal-${basedOnGradleVersion}.${wrapperSubVersion}.zip"
    archiveName distroVersion

    from "${buildDir}/$gradleBuildDir/gradle-${basedOnGradleVersion}"
    into "gradle-${basedOnGradleVersion}"

    outputs.file distroVersion
}

artifacts {
    archives makeGradleDistribution
}

task publishWrapper( type: Upload ) {
    configuration = configurations.archives
    repositories {
        ivy {
            url "${artifactory_url}/third-party-apps/gradle"
            credentials {
                username "${artifactory_user}"
                password "${artifactory_password}"
            }

            layout 'pattern' , {
                //hack. i cant figure out why the "artifact" is called as the project...
                artifact 'gradle-drwp-[revision](.[ext])'
            }
        }
    ....

So maybe my qeustion is really “howto give custom names to uploaded artifacts”

Solved my own problem by some reading and lots of trail-and-error :slight_smile:

publishing {
    repositories {
        ivy {
            url "${artifactory_url}/third-party-apps/gradle"
            credentials {
                username "${artifactory_user}"
                password "${artifactory_password}"
            }
            patternLayout {
                artifact "[artifact]-[revision](-[classifier]).[ext]"
            }
        }
    }
    publications {
        ivy(IvyPublication) {
            artifact makeGradleDistribution
        }
     }
}

First thin I did was renaming the folder the thing resides in to be in line with project-artifact naming