Skip to content

Instantly share code, notes, and snippets.

@LethalMaus
Created April 15, 2024 15:27
Show Gist options
  • Select an option

  • Save LethalMaus/ff83a129032b9d4b2ccc98b857d6179b to your computer and use it in GitHub Desktop.

Select an option

Save LethalMaus/ff83a129032b9d4b2ccc98b857d6179b to your computer and use it in GitHub Desktop.
artifactory2.build.gradle.kts
plugins {
apply(plugin = "com.jfrog.artifactory")
apply(plugin = "maven-publish")
}
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from("src/main/java")
}
configure<PublishingExtension> {
publications {
register<MavenPublication>("aar") {
groupId = "<modules_group_id>" // dev.jamescullimore
artifactId = project.name // elchem
version = "<version>" // 3.0.0
artifact("${layout.buildDirectory.get()}/outputs/aar/${project.name}-release.aar")
artifact(sourcesJar)
withXml {
asNode().appendNode("dependencies").let {
// swap "implementation" with "api" if needed
for (dependency in configurations["implementation"].dependencies) {
it.appendNode("dependency").apply {
appendNode("groupId", dependency.group)
appendNode("artifactId", dependency.name)
appendNode("version", dependency.version)
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment