-
-
Notifications
You must be signed in to change notification settings - Fork 202
Closed
Description
When upgrading from 4.0.5 to 4.0.6 a new exception appears during the build with Gradle:
Caused by: java.lang.NullPointerException: Cannot invoke "String.hashCode()" because "<local2>" is null
at io.jooby.openapi.OpenAPIGenerator.setSpecVersion(OpenAPIGenerator.java:447)
at io.jooby.gradle.OpenAPITask.generate(OpenAPITask.java:72)
In addition, when trying to specify specVersion in openAPI Gradle task using:
openAPI {
specVersion = '3.1.0' // Or via setSpecVersion('3.1.0')
}, the exception is:
Caused by: java.lang.IllegalArgumentException: Invalid spec version: 3.1.0. Supported version: [3.0.1, 3.1.0]
at io.jooby.openapi.OpenAPIGenerator.setSpecVersion(OpenAPIGenerator.java:453)
at io.jooby.gradle.OpenAPITask.generate(OpenAPITask.java:72)
My build.gradle:
import java.nio.charset.StandardCharsets
plugins {
id 'idea'
id 'java'
id 'application'
id 'io.jooby.openAPI' version "${joobyVersion}"
id 'io.jooby.run' version "${joobyVersion}"
id 'com.google.osdetector' version '1.7.3'
id 'com.gradleup.shadow' version '8.3.7'
}
group = 'test'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
implementation enforcedPlatform("io.jooby:jooby-bom:${joobyVersion}")
implementation 'io.jooby:jooby-netty'
implementation 'io.jooby:jooby-logback'
implementation 'io.jooby:jooby-swagger-ui'
implementation 'io.swagger.core.v3:swagger-annotations:2.2.35'
testImplementation 'io.jooby:jooby-test'
testImplementation enforcedPlatform('org.junit:junit-bom:5.13.4')
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'com.squareup.okhttp3:okhttp-jvm:5.1.0'
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
toolchain {
languageVersion = JavaLanguageVersion.of(JavaVersion.VERSION_21.toString())
}
}
test {
useJUnitPlatform()
}
tasks.withType(Copy).configureEach {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
tasks.withType(JavaCompile).configureEach {
options.encoding = StandardCharsets.UTF_8.name()
options.compilerArgs += ['-parameters']
options.debug = true
}
jar {
dependsOn openAPI
}
joobyRun {
dependsOn openAPI
mainClass = "jooby.test.Main"
restartExtensions = ["conf", "properties", "class"]
compileExtensions = ["java"]
port = 8080
}
shadowJar {
mainClassName = joobyRun.mainClass
mergeServiceFiles()
}My gradle.properties:
joobyVersion=4.0.6
My jooby.test.Main:
package jooby.test;
import io.jooby.Context;
import io.jooby.Jooby;
import io.jooby.OpenAPIModule;
import io.jooby.netty.NettyServer;
public class Main extends Jooby {
{
install(new OpenAPIModule());
get("/", this::hello);
}
public static void main(final String[] args) {
runApp(args, new NettyServer(), Main::new);
}
public String hello(Context ctx) {
return "Welcome to Jooby!";
}
}