Created
November 21, 2023 10:39
-
-
Save mricciuti/7fa23a91f7abd1b4886e839c1439f008 to your computer and use it in GitHub Desktop.
gradle build script to reproduce artifactory publishing issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
`kotlin-dsl` | |
id("com.jfrog.artifactory") version "5.1.11" | |
java | |
`java-gradle-plugin` | |
`maven-publish` | |
} | |
group = "org.example.gradle.publishing" | |
version = "1.0.0-SNAPSHOT" | |
repositories { | |
mavenCentral() | |
} | |
gradlePlugin { | |
plugins { | |
create("greetingPlugin") { | |
id = "greeting" | |
implementationClass = "org.gradle.sample.plugin.GreetingPlugin" | |
} | |
} | |
} | |
afterEvaluate { | |
artifactory { | |
publish { | |
contextUrl = "$CORPORATE_REPO_URL" | |
repository { | |
setRepoKey("maven-snapshot") | |
setUsername("$PUBLISHING_USER") | |
setPassword("$PUBLISHING_PASSWORD") | |
} | |
defaults { | |
// attach all needed publications: | |
// - one publication for each plugin "marker" ( a single POM artefact) | |
// - one main publication for the plugin library itself (POM + jar artefacts) | |
project.extensions.configure(PublishingExtension::class.java) { | |
this.publications.withType(MavenPublication::class.java).forEach { | |
this@defaults.publications(it.name) | |
} | |
} | |
} | |
} | |
} | |
tasks.named("publish").configure { | |
this.dependsOn(this.project.tasks.getByName("artifactoryPublish")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment