Open jbonet opened 5 years ago
Sure!
PRs are welcome :)
Can't make it work with kotlin DSL. Trying to use it like this:
tasks.getByName<no.nils.wsdl2java.Wsdl2JavaTask>("wsdl2java") {
wsdlDir = file("$projectDir/src/main/wsdl") // wslds location
generatedWsdlDir = file("$projectDir/src/main/generated-sources/")
wsdlsToGenerate = listOf( listOf(
"-autoNameResolution",
"-validate",
"filename.wsdl"
))
}
and get an error:
Execution failed for task ':wsdl2java'.
> Exception evaluating property 'size' for java.util.Arrays$ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: size for class: java.lang.String
Any ideas ?
@asatarov change listOf to arrayListOf
It helps, thank you @jbonet !
Working example
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.util.Locale;
plugins {
id("org.springframework.boot") version "2.4.2"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
kotlin("jvm") version "1.4.21"
kotlin("plugin.spring") version "1.4.21"
java
jacoco
id("no.nils.wsdl2java") version "0.10"
}
group = "com.example"
version = "1.1.0"
java.sourceCompatibility = JavaVersion.VERSION_11
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.apache.cxf:cxf-spring-boot-starter-jaxws:3.4.2")
implementation("org.apache.cxf:cxf-rt-frontend-jaxws:3.4.2")
implementation("org.apache.cxf:cxf-rt-ws-policy:3.4.2")
implementation("org.apache.cxf:cxf-rt-transports-http:3.4.2")
implementation("org.apache.cxf:cxf-rt-bindings-soap:3.4.2")
implementation("org.apache.cxf:cxf-rt-features-logging:3.4.2")
implementation("javax.jws:javax.jws-api:1.1")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
runtimeOnly("mysql:mysql-connector-java")
compileOnly("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")
developmentOnly("org.springframework.boot:spring-boot-devtools")
testImplementation("org.springframework.boot:spring-boot-starter-test")
wsdl2java("com.sun.xml.bind:jaxb-xjc:2.3.3")
wsdl2java("com.sun.xml.bind:jaxb-core:2.3.0.1")
wsdl2java("com.sun.xml.bind:jaxb-impl:2.3.2")
wsdl2java("javax.xml.bind:jaxb-api:2.3.1")
wsdl2java("javax.xml.ws:jaxws-api:2.3.1")
wsdl2java("javax.jws:javax.jws-api:1.1")
wsdl2java("org.apache.cxf:cxf-rt-wsdl:3.4.2")
}
jacoco {
toolVersion = "0.8.6"
}
tasks.test {
finalizedBy(tasks.jacocoTestReport)
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
}
tasks.withType<no.nils.wsdl2java.Wsdl2JavaTask> {
wsdlDir = file("$projectDir/src/main/resources/wsdl")
wsdlsToGenerate = listOf(
ArrayList(listOf("-impl", "-p", "my.package", "$projectDir/src/main/resources/wsdl/wsstandard.wsdl"))
)
generatedWsdlDir = file("$buildDir/generated/wsdl")
locale = Locale.ENGLISH
}
extra["cxfVersion"] = "3.4.2"
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
dependsOn(tasks.wsdl2java)
}
}
sourceSets.getByName("main") {
java.srcDir("$buildDir/generated/wsdl")
java.srcDir("src/main/kotlin")
java.srcDir("src/main/java")
}
I think it would be nice if the docs had some examples on how to configure the plugin when using Kotlin instead of Groovy