I try to publish a gradle plugin to my artifactory it does publish the .jar, .pom and .module but not the com.company.build.ktlint.gradle.plugin here is the code i tried it like in the example of gradle but somehow it is missing something :( also the other question asked about this did not helped.
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm")
id("java-gradle-plugin")
alias(libs.plugins.com.jfrog.artifactory)
alias(libs.plugins.org.gradle.kotlin.kotlin.dsl)
id("maven-publish")
}
val latestTag: String? by project
val versionName = latestTag ?: "SNAPSHOT"
val publishGroupId = "com.company.build"
val publishArtifactId = "ktlint"
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
}
dependencies {
implementation(kotlin("stdlib"))
implementation(gradleApi())
}
gradlePlugin {
plugins {
create("ktlintPlugin") {
id = "com.company.build.ktlint"
implementationClass = "com.company.build.ktlint.KtlintPlugin"
}
}
}
publishing {
publications {
create<MavenPublication>("ktlint") {
groupId = publishGroupId
artifactId = publishArtifactId
version = versionName
from(components["java"])
pom {
name.set("Ktlint plugin")
description.set("This plugin provides an easy way to use ktlint for code style deviations")
scm {
connection.set("scm:git:ssh://git@bitbucket/and/ktlint.git")
developerConnection.set("scm:git:ssh://git@bitbucket/and/ktlint.git")
tag.set(versionName)
}
}
}
}
}
artifactory {
if (!hasProperty("artifactory_user") && !hasProperty("artifactory_password")) return@artifactory
setContextUrl("https://artifactory01")
publish {
repository {
repoKey = "gradle-local"
username = project.findProperty("artifactory_user") as String
password = project.findProperty("artifactory_password") as String
}
defaults {
publications("mavenJava")
}
}
}
job output is this here:
> Task :ktlint:extractModuleInfo
[pool-1-thread-1] Deploying artifact: https://artifactory01/artifactory/gradle-local/com/company/build/ktlint/1.0.1_2/ktlint-1.0.1_2.jar
[pool-1-thread-1] Deploying artifact: https://artifactory01/artifactory/gradle-local/com/company/build/ktlint/1.0.1_2/ktlint-1.0.1_2.module
[pool-1-thread-1] Deploying artifact: https://artifactory01/artifactory/gradle-local/com/company/build/ktlint/1.0.1_2/ktlint-1.0.1_2.pom
> Task :artifactoryDeploy
and i find them in artifactory
i tried to Put it inside afterEvaluate
did nothing also using ALL_PUBLICATIONS
I tried also this solution here: https://stackoverflow.com/questions/54757070/how-do-i-publish-gradle-plugins-to-artifactory but did not work i get this here as an error:
Type mismatch.
Required: Action<PublisherConfig!>!
Found: Closure<Unit>