Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 23 additions & 21 deletions src/main/groovy/no/nils/wsdl2java/Wsdl2JavaPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,39 @@ class Wsdl2JavaPlugin implements Plugin<Project> {
// 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
}
Expand Down