@@ -3,10 +3,10 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
33
44plugins {
55 `java- library`
6- kotlin( " jvm " ) version " 2.3.10 "
6+ alias(libs.plugins.kotlin.jvm)
77 `maven- publish`
88 signing
9- id( " io.github.gradle- nexus.publish-plugin " ) version " 2.0.0 "
9+ alias(libs.plugins. nexus.publish)
1010}
1111
1212description = " Javalin OpenAPI Parent | Parent"
@@ -108,29 +108,39 @@ subprojects {
108108 }
109109 }
110110
111- dependencies {
112- val javalin = " 7.0.0"
113- compileOnly(" io.javalin:javalin:$javalin " )
114- testImplementation(" io.javalin:javalin:$javalin " )
115-
116- val junit = " 5.14.2"
117- testImplementation(" org.junit.jupiter:junit-jupiter-params:$junit " )
118- testImplementation(" org.junit.jupiter:junit-jupiter-api:$junit " )
119- testImplementation(" org.junit.jupiter:junit-jupiter-engine:$junit " )
120- testRuntimeOnly(" org.junit.platform:junit-platform-launcher" )
111+ tasks.withType<Test > {
112+ useJUnitPlatform()
113+ }
114+ }
121115
122- testImplementation(" org.assertj:assertj-core:3.27.6" )
123- testImplementation(" net.javacrumbs.json-unit:json-unit-assertj:4.1.1" )
124- testImplementation(" com.konghq:unirest-java:3.14.5" )
116+ val mavenExamples = listOf (" javalin-maven-java" , " javalin-maven-kotlin" )
125117
126- testImplementation(" ch.qos.logback:logback-classic:1.5.32" )
118+ mavenExamples.forEach { example ->
119+ tasks.register<Exec >(" test-maven-example-$example " ) {
120+ description = " Compile Maven example: $example "
121+ group = " verification"
122+ workingDir = file(" examples/$example " )
123+ commandLine(" ./mvnw" , " compile" , " -B" , " -q" )
124+ environment(" JAVA_HOME" , System .getProperty(" java.home" ))
125+ dependsOn(subprojects.map { it.tasks.named(" publishToMavenLocal" ) })
127126 }
128127
129- tasks.withType<Test > {
130- useJUnitPlatform()
128+ tasks.register<Exec >(" run-maven-example-$example " ) {
129+ description = " Run Maven example: $example "
130+ group = " application"
131+ workingDir = file(" examples/$example " )
132+ commandLine(" ./mvnw" , " compile" , " exec:java" , " -B" , " -q" )
133+ environment(" JAVA_HOME" , System .getProperty(" java.home" ))
134+ dependsOn(subprojects.map { it.tasks.named(" publishToMavenLocal" ) })
131135 }
132136}
133137
138+ tasks.register(" test-maven-examples" ) {
139+ description = " Compile all Maven examples"
140+ group = " verification"
141+ dependsOn(mavenExamples.map { " test-maven-example-$it " })
142+ }
143+
134144nexusPublishing {
135145 repositories {
136146 sonatype {
0 commit comments