Skip to content
Merged
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
31 changes: 15 additions & 16 deletions src/main/groovy/com/yupzip/wsdl2java/Wsdl2JavaPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,22 @@ class Wsdl2JavaPlugin implements Plugin<Project> {
def cxfVersion = project.provider { extension.cxfVersion }
def cxfPluginVersion = project.provider { extension.cxfPluginVersion }

// Add new configuration for our plugin and add required dependencies to it later.
// Add new configuration for our plugin and add required dependencies to it.
def wsdl2javaConfiguration = project.configurations.maybeCreate(WSDL2JAVA)
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() && extension.includeJava8XmlDependencies) {
JAVA_9_DEPENDENCIES.each { dep -> it.add(project.dependencies.create(dep)) }
}
}

// Get implementation configuration and add Java 9+ dependencies if required.
project.configurations.named("implementation").configure {
Expand All @@ -37,21 +51,6 @@ class Wsdl2JavaPlugin implements Plugin<Project> {
}

def wsdl2JavaTask = project.tasks.register(WSDL2JAVA_TASK, 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()}"))
}

if (JavaVersion.current().isJava9Compatible() && extension.includeJava8XmlDependencies) {
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
Expand Down