This message was deleted.
# community-support
s
This message was deleted.
n
We do this:
Copy code
publications {
    register<MavenPublication>("gradleDistribution") {
        artifact(zipDistribution)
    }
}
The
zipDistribution
task is a simple
Zip
task.
MavenPublication
is perfectly capable of publishing that with
<packaging>zip</packaging>
thank you 1
l
Hi, I am using an ivy publication together with the artifactory gradle plugin to achieve this:
Copy code
plugins {
    base
    `ivy-publish`
    id("com.jfrog.artifactory") version "4.29.0"
}

val createCustomGradleDistribution by tasks.registering(Zip::class) {
description = "Builds custom Gradle distribution and bundles initialization scripts."
    group = "build"

    // we simply re-package the gradle version this project uses (per its wrapper properties)
    // this is a hack to figure out where the gradle distribution was stored by gradle itself
    val url = this.javaClass.getResource("/org/gradle/api/invocation/Gradle.class").toString()
    val gradleApiJar = project.file(url.removePrefix("jar:file:/").replaceAfter("!/", "").removeSuffix("!/"))
    val gradleDist = gradleApiJar.resolve("../../../gradle-${gradle.gradleVersion}-all.zip")

    from(zipTree(gradleDist))
    from("src/init.d") {
        into("gradle-${gradle.gradleVersion}/init.d")
    }
}


val gradleDistArtifact = project.artifacts.add(Dependency.ARCHIVES_CONFIGURATION, createCustomGradleDistribution)

publishing {
    publications {
        create<IvyPublication>("ivy") {
            artifact(gradleDistArtifact) {
                classifier = "all"
            }
            module = "my-gradle"
            revision = gradle.gradleVersion
        }
    }
}

val publish by tasks.existing {
    dependsOn("artifactoryPublish")
}

artifactory {
    clientConfig.apply {
        proxy.host = project.extra.properties["systemProp.http.proxyHost"] as String?
        proxy.port = (project.extra.properties["systemProp.http.proxyPort"] as String?)?.toInt()
        proxy.username = project.extra.properties["systemProp.http.proxyUser"] as String?
        proxy.password = project.extra.properties["systemProp.http.proxyPassword"] as String?
        publisher.isPublishBuildInfo = false
    }
    publish {
        setContextUrl(url)
        repository {
            setRepoKey("repo")
            setUsername("user")
            setPassword("pass")
            ivy {
                setArtifactLayout("[module]/[revision]/[module]-[revision](-[classifier]).[ext]")
                setMavenCompatible(false)
            }
        }
        defaults {
            publications("ivy")
            setPublishIvy(false)
            setPublishPom(false)
        }
    }
}
thank you 1
g
I used Ivy publication with custom layout and raw repository on the Nexus side. Allows to have much more flat structure than classic maven2 layout.
thank you 1