From 76c662ed4911d08f45ddff515e76bc874c6ba7c8 Mon Sep 17 00:00:00 2001 From: Gerd Aschemann Date: Wed, 24 Jan 2024 15:35:39 +0100 Subject: [PATCH] WIP Refactor Maven publishing --- build.gradle | 25 +--------------------- htmlSanityCheck-core/build.gradle | 12 ++++++++++- htmlSanityCheck-gradle-plugin/build.gradle | 17 ++++++++++++++- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index 9e81e332..8a3fba36 100644 --- a/build.gradle +++ b/build.gradle @@ -51,29 +51,6 @@ allprojects { } } -subprojects { - test { - useJUnitPlatform() - } - - ext { - publishVariant = { String variant -> - publishing { - publications { - maven(MavenPublication) { - from components[variant] - - // We have to perform some fancy renaming to make the plugin GAV coordinates match with docToolchain - groupId = group - artifactId = "org.aim42.${project.name.replaceAll('-', '.')}" - version = version - } - } - } - } - } -} - configure(subprojects) { apply plugin: 'java' apply plugin: 'groovy' @@ -106,7 +83,7 @@ configure(subprojects) { // Groovy source files using CodeNarc and generates reports from these checks. // apply plugin: 'codenarc' - project.ext.publishVariant('java') +// project.ext.publishVariant('java') } /* diff --git a/htmlSanityCheck-core/build.gradle b/htmlSanityCheck-core/build.gradle index 183ea9b1..12d24364 100644 --- a/htmlSanityCheck-core/build.gradle +++ b/htmlSanityCheck-core/build.gradle @@ -1,3 +1,7 @@ +plugins { + id 'java-library' +} + dependencies { implementation libs.slf4j.api testImplementation libs.slf4j.nop @@ -8,7 +12,13 @@ dependencies { implementation 'org.codehaus.groovy:groovy-dateutil' } -//apply plugin: 'groovy' +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } +} tasks.register('copyResourceImages', Copy) { from('src/main/resources') { diff --git a/htmlSanityCheck-gradle-plugin/build.gradle b/htmlSanityCheck-gradle-plugin/build.gradle index 2d229dd7..9cc203ff 100755 --- a/htmlSanityCheck-gradle-plugin/build.gradle +++ b/htmlSanityCheck-gradle-plugin/build.gradle @@ -1,4 +1,19 @@ -apply plugin: 'java-gradle-plugin' +//apply plugin: 'java-gradle-plugin' +plugins { + id 'java-gradle-plugin' +} + +publishing { + publications { + maven(MavenPublication) { + from components.java + // We have to perform some fancy renaming to make the plugin GAV coordinates match with gradle plugin naming conventions + groupId = group + artifactId = "org.aim42.${project.name.replaceAll('-', '.')}" + version = version + } + } +} dependencies { testImplementation(