From a80f2ba19c11b7b76afd786b904dbc20ed1c40a7 Mon Sep 17 00:00:00 2001 From: Manfred Bergmann Date: Fri, 8 Jan 2021 16:33:33 +0100 Subject: [PATCH] fix for #121. Just rearranged the requence of things in 'apply'. --- .../no/nils/wsdl2java/Wsdl2JavaPlugin.groovy | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/main/groovy/no/nils/wsdl2java/Wsdl2JavaPlugin.groovy b/src/main/groovy/no/nils/wsdl2java/Wsdl2JavaPlugin.groovy index c0d705d..45d98d8 100644 --- a/src/main/groovy/no/nils/wsdl2java/Wsdl2JavaPlugin.groovy +++ b/src/main/groovy/no/nils/wsdl2java/Wsdl2JavaPlugin.groovy @@ -26,37 +26,39 @@ class Wsdl2JavaPlugin implements Plugin { // Add new configuration for our plugin and add required dependencies to it later. def wsdl2javaConfiguration = project.configurations.maybeCreate(WSDL2JAVA) - // Get compile configuration and add Java 9+ dependencies if required. - project.configurations.named("compile").configure { - it.withDependencies { - if (JavaVersion.current().isJava9Compatible()) { - JAVA_9_DEPENDENCIES.each { dep -> it.add(project.dependencies.create(dep)) } - } + def wsdl2JavaTask = project.tasks.register(WSDL2JAVA, Wsdl2JavaTask.class) {task -> + task.group = "Wsdl2Java" + task.description = "Generate java source code from WSDL files." + task.classpath = wsdl2javaConfiguration + task.extension = extension + } + + wsdl2javaConfiguration = wsdl2javaConfiguration.withDependencies { + it.add(project.dependencies.create("org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:${cxfVersion.get()}")) + it.add(project.dependencies.create("org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws:${cxfVersion.get()}")) + if (project.wsdl2java.wsdlsToGenerate.any { it.contains('-xjc-Xts') }) { + it.add(project.dependencies.create("org.apache.cxf.xjcplugins:cxf-xjc-ts:${cxfPluginVersion.get()}")) + } + if (project.wsdl2java.wsdlsToGenerate.any { it.contains('-xjc-Xbg') }) { + it.add(project.dependencies.create("org.apache.cxf.xjcplugins:cxf-xjc-boolean:${cxfPluginVersion.get()}")) + } + + if (JavaVersion.current().isJava9Compatible()) { + JAVA_9_DEPENDENCIES.each { dep -> it.add(project.dependencies.create(dep)) } } } - def wsdl2JavaTask = project.tasks.register(WSDL2JAVA, Wsdl2JavaTask.class) { task -> - wsdl2javaConfiguration.withDependencies { - it.add(project.dependencies.create("org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:${cxfVersion.get()}")) - it.add(project.dependencies.create("org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws:${cxfVersion.get()}")) - if (project.wsdl2java.wsdlsToGenerate.any { it.contains('-xjc-Xts') }) { - it.add(project.dependencies.create("org.apache.cxf.xjcplugins:cxf-xjc-ts:${cxfPluginVersion.get()}")) - } - if (project.wsdl2java.wsdlsToGenerate.any { it.contains('-xjc-Xbg') }) { - it.add(project.dependencies.create("org.apache.cxf.xjcplugins:cxf-xjc-boolean:${cxfPluginVersion.get()}")) - } + // Get compile configuration and add Java 9+ dependencies if required. + project.configurations.named("compile").configure { + it.withDependencies { if (JavaVersion.current().isJava9Compatible()) { JAVA_9_DEPENDENCIES.each { dep -> it.add(project.dependencies.create(dep)) } } } - - task.group = "Wsdl2Java" - task.description = "Generate java source code from WSDL files." - task.classpath = wsdl2javaConfiguration - task.extension = extension } + project.tasks.named("compileJava").configure { it.dependsOn wsdl2JavaTask }