Plugin repository
build.gradle.kts
plugins {
kotlin("jvm") version "1.9.22"
id("me.qoomon.git-versioning") version "6.4.3"
`maven-publish`
`kotlin-dsl`
id("java-gradle-plugin")
id("com.gradle.plugin-publish") version "1.2.1"
}
group = "io.github.benkeil"
gradlePlugin {
website = "https://github.com/benkeil/openapi-dsl-gradle"
vcsUrl = "https://github.com/benkeil/openapi-dsl-gradle.git"
plugins {
create("openapiDsl") {
id = "io.github.benkeil.openapi-dsl-gradle"
displayName = "OpenAPI Kotlin DSL Gradle Plugin"
description =
"Generates special kotlin classes from OpenAPI schemas, that can be used to build custom DSLs"
tags = listOf("openapi", "dsl", "kotlin")
implementationClass = "pub.keil.openapi.dsl.plugin.OpenapiDslPlugin"
}
}
}
publishing {
repositories {
mavenLocal()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/benkeil/${rootProject.name}")
credentials {
username = "not_required"
password = System.getenv("GITHUB_PACKAGES_WRITE_TOKEN")
}
}
}
publications { register<MavenPublication>("gpr") { from(components["java"]) } }
}
I publish to GitHub (or mavenLocal) and not publishPlugin
.
Dependant repository
settings.gradle
rootProject.name = "cdktf-lib"
pluginManagement {
repositories {
gradlePluginPortal()
google()
maven { url = uri("https://plugins.gradle.org/m2/") }
mavenLocal()
mavenCentral()
}
resolutionStrategy {
eachPlugin {
if (requested.id.namespace == "io.github.benkeil") {
useModule("${requested.id.namespace}:${requested.id.name}:${requested.version}")
}
}
}
}
build.gradle.kts
repositories {
mavenLocal()
mavenCentral()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/benkeil/*")
credentials {
username = "not_required"
password = System.getenv("GITHUB_PACKAGES_READ_TOKEN")
}
content {
includeGroupByRegex("de\.benkeil.*")
includeGroupByRegex("pub\.keil.*")
includeGroupByRegex("io\.github\.benkeil.*")
}
}
}
dependencies {
implementation(kotlin("reflect"))
implementation(libs.bundles.implementation)
testImplementation(libs.bundles.testImplementation)
}
When trying to build I get:
> Could not resolve all files for configuration ':classpath'.
> Could not find org.gradle:gradle-tooling-api:8.9.
Searched in the following locations:
- https://plugins.gradle.org/m2/org/gradle/gradle-tooling-api/8.9/gradle-tooling-api-8.9.pom
- https://dl.google.com/dl/android/maven2/org/gradle/gradle-tooling-api/8.9/gradle-tooling-api-8.9.pom
- file:/Users/ben/.m2/repository/org/gradle/gradle-tooling-api/8.9/gradle-tooling-api-8.9.pom
- https://repo.maven.apache.org/maven2/org/gradle/gradle-tooling-api/8.9/gradle-tooling-api-8.9.pom
Required by:
project : > io.github.benkeil:openapi-dsl-gradle:main
How to configure gradle to use GitHub for plugins?