Giter Site home page Giter Site logo

wsdl2java's Introduction

Deprecation notice

This plugin is no longer maintained by its creator since I dont have any interest in using this plugin anymore and find no pleasure in maintaining it for free/fun. Please fork it and use it as you like. The plugin is not published to any relevant plugin-portals.

wsdl2java gradle plugin

Known Vulnerabilities Build Status Download

Gradle plugin for generating java from wsdl, using cxf under the hood and the same options as the maven wsdl-2-java plugin from apache-cxf.

The plugin binaries are downloadable from bintray: https://bintray.com/nilsmagnus/maven/wsdl2java/

Issues

If you have any issues with the plugin, please file an issue at github, https://github.com/nilsmagnus/wsdl2java/issues

Contribution

Contributions are welcome as long as they are sane.

Contributors

CXF

This plugin uses the apache-cxf tools to do the actual work.

Tasks

Name Description Dependecy
wsdl2java Generate java source from wsdl-files CompileJava/CompileKotlin depends on wsdl2java
xsd2java Generate java source from xsd-files Removed in version 0.8 CompileJava depends on xsd2java

Usage

To use this plugin, you must

  • modify your buildscript to have dependencies to the plugin
  • apply the plugin
  • set the properties of the plugin

Applying the plugin

Groovy:

buildscript{
    repositories{
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'no.nils:wsdl2java:0.12'
    }
}

apply plugin: 'no.nils.wsdl2java'

Kotlin:

plugins {
    id("java")
    id("no.nils.wsdl2java") version "0.12"
}

Plugin options

Option Default value Description
wsdlDir src/main/resources Define the wsdl files directory to support incremental build. This means that the task will be up-to-date if nothing in this directory has changed.
wsdlsToGenerate empty This is the main input to the plugin that defines the wsdls to process. It is a list of arguments where each argument is a list of arguments to process a wsdl-file. The Wsdl-file with full path is the last argument. The array can be supplied with the same options as described for the maven-cxf plugin(http://cxf.apache.org/docs/wsdl-to-java.html).
locale Locale.getDefault() The locale for the generated sources – especially the JavaDoc. This might be necessary to prevent differing sources due to several development environments.
encoding platform default encoding Set the encoding name for generated sources, such as EUC-JP or UTF-8.
stabilizeAndMergeObjectFactory false If multiple WSDLs target the same package, merge their ObjectFactory classes.
cxfVersion "+" Controls the CXF version used to generate code.
cxfPluginVersion "+" Controls the CXF XJC-plugins version used to generate code.

Example setting of options:

Groovy:

wsdl2java {
    wsdlDir = file("src/main/resources/myWsdlFiles") // define to support incremental build
    wsdlsToGenerate = [   //  2d-array of wsdls and cxf-parameters
            ['src/main/resources/wsdl/firstwsdl.wsdl'],
            ['-xjc','-b','bindingfile.xml','src/main/resources/wsdl/secondwsdl.wsdl']
    ]
    locale = Locale.GERMANY
    cxfVersion = "2.5.1"
    cxfPluginVersion = "2.4.0"
}

Kotlin:

extra["cxfVersion"] = "3.3.2"
extra["cxfPluginVersion"] = "3.2.2"

wsdl2java {
    wsdlDir = file("$projectDir/src/main/wsdl")
    wsdlsToGenerate = listOf(
        listOf("$wsdlDir/firstwsdl.wsdl"),
        listOf("-xjc", "-b", "bindingfile.xml", "$wsdlDir/secondwsdl.wsdl")
    )
}

Options for xsd2java (deprecated, separate plugin coming soon)

This will not work for version 0.8+!

Option Default value Description
generatedXsdDir "generatedsources/src/main/java" Destination directory for generated sources
xsdsToGenerate null 2-d array consisting of 2 or 3 values in each array: 1. xsd-file(input), 2. package for the generated sources, 3. (optional) a map containing additional options for the xjc task
encoding platform default encoding Set the encoding name for generated sources, such as EUC-JP or UTF-8.

Example setting of options:

xsd2java {
    encoding = 'utf-8'
    xsdsToGenerate = [
        ["src/main/resources/xsd/CustomersAndOrders.xsd", 'no.nils.xsd2java.sample', [header: false] /* optional map */]
    ]
    generatedXsdDir = file("generatedsources/xsd2java")
}

Complete example usage

This is a an example of a working build.gradle for a java project. You can also take a look at the test resources, which contain two working projects.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'no.nils:wsdl2java:0.12'
    }
}

apply plugin: 'java'
apply plugin: 'no.nils.wsdl2java'

repositories {
    mavenCentral()
}

dependencies {
    testCompile 'junit:junit:+'
}

wsdl2java {
    wsdlsToGenerate = [
            ['-p', 'com.acme.mypackage', '-autoNameResolution', "$projectDir/src/main/resources/wsdl/stockqoute.wsdl"]
    ]
    wsdlDir = file("$projectDir/src/main/resources/wsdl")
    locale = Locale.FRANCE
    cxfVersion = "2.5.1"
    cxfPluginVersion = "2.4.0"
}

Java 9+ support

This plugin automatically adds the necessary dependencies to work on Java 9+ when detected.

As of now, these dependencies are added:

implementation "javax.xml.bind:jaxb-api:2.3.1",
implementation "javax.xml.ws:jaxws-api:2.3.1",
implementation "org.glassfish.jaxb:jaxb-runtime:2.3.2",
implementation "org.glassfish.main.javaee-api:javax.jws:3.1.2.2",
implementation "com.sun.xml.messaging.saaj:saaj-impl:1.5.1"

Enable basic extension support for xjc

Apache CXF supports extension for xjc, e.g. for creating a hashCode, equals and toString method in the classes generated by xjc.
To use those extensions some more dependencies are necessary.

dependencies() {
    compile 'org.jvnet.jaxb2_commons:jaxb2-basics-runtime:0.11.0'

    // enable extension support for wsdl2java
    wsdl2java 'org.jvnet.jaxb2_commons:jaxb2-basics-runtime:0.11.0'
    wsdl2java 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0'
}

wsdl2java{
    wsdlsToGenerate = [
        ['-xjc-Xequals', '-xjc-XhashCode', 'src/main/resources/com/example/api/interface.wsdl']
    ]
}

This example creates the hashCode and the equals method.

A notice on multi-module projects

Instead of referring to absolute paths in your build-file, try using $projectDir as a prefix to your files and directories. As shown in the "Complete example usage".

Releasing

  • set version to final in build.gradle & commit

  • build artifact and upload

    export BINTRAY_USER= export BINTRAY_API_KEY= ./gradlew clean bintrayPublish bintrayUpload

  • increment version and set to SNAPSHOT & commit

  • git push

wsdl2java's People

Contributors

alediaferia avatar asatarov avatar christopherstott avatar gitter-badger avatar jeetah avatar jlagerweij avatar jremes-foss avatar jskov-jyskebank-dk avatar krausestefan avatar manuelsanchezortiz avatar nilsmagnus avatar pentadrago avatar rubengees avatar s-doering avatar siplo avatar vpavic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wsdl2java's Issues

Namespace mapping

I've been trying
wsdl2java{
wsdlsToGenerate = [
["-p",'http://some.namespace.ru=my.package.name', "$wsdlDir/services/equeue/wsdl/equeue.wsdl"]
]
wsdlDir = file("$projectDir/src/main/resources")
generatedWsdlDir = file("$projectDir/target/gen-java")
locale = Locale.ENGLISH
}
I get an error, , stack trace below.
Thanks so much!

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':integration:wsdl2java'.
...
Caused by: org.gradle.api.UncheckedIOException: Could not normalize path for file 'C:\work\projects\gradle_project\project\integration\target\gen-java\http://some.namespace.
at org.gradle.api.internal.file.AbstractFileResolver.normalise(AbstractFileResolver.java:141)
at org.gradle.api.internal.file.AbstractFileResolver.resolve(AbstractFileResolver.java:83)
at org.gradle.api.internal.file.AbstractFileResolver.resolve(AbstractFileResolver.java:63)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileCollectionConverter.convertInto(DefaultFileCollectionResolveContext.java:177)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:138)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileCollections(DefaultFileCollectionResolveContext.java:85)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileCollectionConverter.convertInto(DefaultFileCollectionResolveContext.java:161)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:102)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileCollections(DefaultFileCollectionResolveContext.java:85)
at org.gradle.api.internal.file.CompositeFileCollection.getSourceCollections(CompositeFileCollection.java:162)
at org.gradle.api.internal.file.CompositeFileCollection.getFiles(CompositeFileCollection.java:45)
at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:65)
at org.gradle.api.internal.file.copy.DeleteActionImpl.delete(DeleteActionImpl.java:40)
at org.gradle.api.internal.file.DefaultFileOperations.delete(DefaultFileOperations.java:130)
at org.gradle.api.internal.project.AbstractProject.delete(AbstractProject.java:690)
at no.nils.wsdl2java.Wsdl2JavaTask.deleteOutputFolders(Wsdl2JavaTask.groovy:127)
at no.nils.wsdl2java.Wsdl2JavaTask.wsdl2java(Wsdl2JavaTask.groovy:55)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
...
Caused by: java.io.IOException:

URI is not hierarchical

Hi,
I'm using no.nils:wsdl2java:0.10 to generate Java objects from a WSDL, however I'm receiving this exception when running the task from the root project. It doesn't occur when I run the task from the sub-project. Please can you offer some advice on how to fix this please?

Execution failed for task ':xxxx-xxx-xxxx:wsdl2java'.

java.lang.IllegalArgumentException: URI is not hierarchical

xsd2java option

Hi,

It seems in my example , xsd2java is not taking option parameter value when it's generating code

here is my example

xsd2java {
def contractDir = "$buildDir/extractedContracts"
File perContract = new File("$contractDir/Enterprise.xsd")
File adContract = new File("$contractDir/AdFpc.xsd")
File adListContract = new File("$contractDir/AdListData.xsd")

xsdsToGenerate = [
[file("$perContract"), 'com.performance.contract',[value:"-Xtbs -XautoNameResolution"]],
[file("$adContract"), 'ad.contract',[value:"-Xtbs -XautoNameResolution"]],
[file("$adListContract"), 'ad.list.contract',[value:"-Xtbs -XautoNameResolution"]],
]
generatedXsdDir = file(project.ext.generatedSrcDir)
}

-Xtbs generate equals, hashcode and toString method.

while it's successfully generating using below code.

task generateSources << {
def genSrcDir = new File(project.ext.generatedSrcDir)
genSrcDir.mkdirs()
def perContractJar = configurations.generate.find { it.name.equals("per-contract-1.0.0-18.jar") }
def aeroContractJar = configurations.generate.find { it.name.equals("aero1.0.0-11.jar") }
ant.taskdef(name: 'xjc', classname: 'com.sun.tools.xjc.XJC2Task', classpath: configurations.generate.asPath)
ant.xjc(package: 'com.performance.contract', destdir: project.ext.generatedSrcDir, extension: 'true',
schema: "jar:file:///$perContractJar!/Enterprise.xsd" ) { arg(line:"-XautoNameResolution -Xtbs") }
ant.xjc(package: 'ad.dispatchper.contract', destdir: project.ext.generatedSrcDir, extension: 'true',
schema: "jar:file:///$aeroContractJar!/AdFpc.xsd" ) { arg(line:"-XautoNameResolution -Xtbs") }
sourceSets.main.java.srcDirs += project.ext.generatedSrcDir
}

Let me know your suggestion what needs to be change in my syntax to make it work.

When specifying package name with -p that contains a URL, exception received

We have a WSDL that requires WSDL namespace to package name mapping.

In order to generate skeleton from this WSDL, we need to use specify a wsdl to namespace mapping:

-p http://www.multispeak.org/Version_4.1_Release=org.multispeak.version_4_1_release

When I run this through the plugin, I receive the following exception:

C:\work\project04> gradlew -info wsdl2java
Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using build file 'C:\work\project04\build.gradle'.
Included projects: [root project 'project04']
Evaluating root project 'project04' using build file 'C:\work\project04\build.gradle'.
All projects evaluated.
Selected primary task 'wsdl2java' from project :
Tasks to be executed: [task ':wsdl2java']
:wsdl2java (Thread[main,5,main]) started.
:wsdl2java
Executing task ':wsdl2java' (up-to-date check took 0.038 secs) due to:
  Value of input property 'wsdls' has changed for task ':wsdl2java'
Clear target folders [work\project04\generated\http:\www\multispeak\org\Version_4\1_Release=org\multispeak\version_4_1_release]
:wsdl2java FAILED
:wsdl2java (Thread[main,5,main]) completed. Took 0.099 secs.

I'm not sure, but it looks like the method deleteOutputFolders() calls findPackagePaths(), which does not account for the optional "wsdl-namespace=" option in the package declaration when mapping namespaces.

Perhaps something like this would work?

private Set<String> findPackagePaths() {
    Set<String> packagePaths = new HashSet<>();
    for (List<String> args : wsdlsToGenerate) {
        int packageArgIdx = args.indexOf("-p");
        int packageIx = packageArgIdx+1;
        if (packageArgIdx != -1 && args.size() >= packageIx) {
            String pathPath = args.get(packageIx);
            int esIdx = pathPath.indexOf("=");
            if (esIdx != -1) {
                pathPath = pathPath.substring(esIdx+1);
            }

            packagePaths.add(pathPath.replace(".", "/"));
        }
    }
    return packagePaths;
}

Option to disable attaching to compileJava

Currently we have a use-case to generate JAXB objects only periodically and against a hosted URL WSDL. However by default this plugin attaches various tasks to clean and compileJava. There should be a property that disables this attaching.

We run this only periodically and actually check in the generated code.

Currently we accomplish this by adding the following:

afterEvaluate {
   compileJava.dependsOn.remove wsdl2java
   compileJava.dependsOn.remove xsd2java
   clean.dependsOn.remove deleteGeneratedSources
   wsdl2java.dependsOn deleteGeneratedSources
 }

Running gradle tests causes a full rebuild of generated source

I have the following configuration

wsdl2java {
wsdlsToGenerate = [
["$projectDir/src/main/resources/io/proj/soa/v2015_01/wsdl/proj.wsdl"]
]
generatedWsdlDir = file("$projectDir/generatedsources")
wsdlDir = file("$projectDir/src/main/resources/io/proj/soa/v2015_01/wsdl")
cxfVersion = "3.0.1"
}

Irrespective of the fact no change has taken place in the target directory specified in 'wsdlDir', running the tests rebuilds the generated source

Any ideas that could solve this would be greatly apreciated

Thanks

Chris

wsdl2java section is run every time for every task

My wsdl2java{} definition:

wsdl2java {
    generatedWsdlDir = file("$projectDir/src/generated")
    wsdlDir = file("$projectDir/src/resources/wsdl")
    wsdlsToGenerate = getWsdlDefinitions()
}

As you can see the wsdlsToGenerate is built dynamically by other function (the code is simplified a lot):

def getWsdlDefinitions() {
    println "Adding WSDL definitions."
    def wsdlDefinitions = []
    wsdlDefinitions.addAll(wsdl2javadir("xxx"))
    wsdlDefinitions.addAll(wsdl2javadir("yyy"))
    return wsdlDefinitions
}

The contents of wsdl2javadir() function are not important here. The above solution causes the println output each time I run any of the Gradle tasks (even other than wsdl2java) which implies that this wsdl2java {} section is run every time for every Gradle task.

Is there a way of defining this configuration without causing this issue?

Dependency on cxf-xjc-ts only when needed or specify version

Since cxf-tools are released more frequent than cxf-xjc-ts, usage of the wsdl2java plugin will break if cxfVersion 2.5.2 or any other non-existent version of cxf-xjc-ts.

Possible solutions:

  • only include cxf-xjc-ts when needed .
  • specify version of cxf-xjc-ts in the same way as cxfVersion .

cxf-tools versions: http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.cxf%22%20AND%20a%3A%22cxf-tools%22

cxf-xjc-ts versions: http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.cxf.xjcplugins%22%20AND%20a%3A%22cxf-xjc-ts%22

To reproduce the problem, run the "runit.sh" script.

Rebuild source on build

Hi

I'm in the process to migrate all my source from ant to gradle.

Thanks for this plugin it works perfectly for me, and was easy to implement. I just have one question is there a way that after the first download of the WSDL and xsd files on the first time of the generated sources code, not to do this on each clean and build and only do this when the WSDL file was modify, The reason from this is that I don't always have access to the 3rd Party WSDL and there link is down, and I'm then not able to generate the sources, and compile my source,

The other question is that some of these 3rd parties don't have access to QA platforms and only production so i do have a copy off all the WSDL and xsd files, can i get this plugin to make use of the local files instead of trying to connect to their platform and downlaod all the files to generate this

Please see build script below

buildscript{
dependencies {
classpath 'no.nils:wsdl2java:0.8'
}
}

apply plugin :'java'
apply plugin :'no.nils.wsdl2java'

wsdl2java{
wsdlsToGenerate = [
[ projectDir.absolutePath + "/src/main/resources/wsdl/webservices.wsdl"]
]
generatedWsdlDir = file(projectDir.absolutePath + "/src/main/java/")
wsdlDir = file(projectDir.absolutePath + "/src/main/resources/wsdl")
cxfVersion = "3.0.1"
}

Dependency issue - "Could not find no.nils:wsdl2java:0.9"

The dependency:

'no.nils:wsdl2java:0.9'

Does not work. Gradle complains:

> Could not find no.nils:wsdl2java:0.9.
     Searched in the following locations:
         https://jcenter.bintray.com/no/nils/wsdl2java/0.9/wsdl2java-0.9.pom
         https://jcenter.bintray.com/no/nils/wsdl2java/0.9/wsdl2java-0.9.jar

Did you publish the artifact correctly?

Launch wsdl2java with multiple cxf version

Hi,
I need to generate twice java dir, one for an old cxf version and one for a most recent.
I have try to set two wsdl2java block, but only the last is executed

wsdl2java {
    generatedWsdlDir = file("gen2")  // target directory for generated source coude
    wsdlDir = file("resources/wsdl/v2/") // define to support incremental build
    wsdlsToGenerate = [   //  2d-array of wsdls and cxf-parameters
                ['-validate','-verbose','-autoNameResolution',
                    '-encoding', 'UTF-8',
                    '-exsh', 'true',
                    '-b',file('resources/wsdl/v2/jaxb-binding.xml'),
                    ...]
        ]
    cxfVersion = "2.7.12"
}
wsdl2java {
    generatedWsdlDir = file("gen2")  // target directory for generated source coude
    wsdlDir = file("resources/wsdl/v2/") // define to support incremental build
    wsdlsToGenerate = [   //  2d-array of wsdls and cxf-parameters
                ['-validate','-verbose','-autoNameResolution',
                    '-encoding', 'UTF-8',
                    '-exsh', 'true',
                    '-b',file('resources/wsdl/v2/jaxb-binding.xml'),
                    ...]
        ]
    cxfVersion = "2.1.10"
}

Thanks for your help

Preventing Java header comments?

Hi,

I could not find a way to prevent this comment on generated java files:

/**
 * This class was generated by Apache CXF 3.2.1
 * 2017-12-14T17:10:55.126+03:00
 * Generated source version: 3.2.1
 */

Everytime I build the project, all files change. Too many unnecessary code changes occur in version control system.

Create a sourceSet for generated code to enable different compiler options

Adding the generated source to the main source set means that any warnings from the generated code cannot be turned off without affecting manually-written code.

If the generated code is managed using its own sourceSet, compiler options can be configured separately.

There is a workaround but we should fix it properly. I can do that if you want

The workaround is:

project.afterEvaluate {
// workaround for a bug in wsdl2java
// the wsdl2java plugin adds its generated source to the main
// java source set; we prefer to have the generated source in a
// different sourceSet such that compiler warnings can be suppressed
// for generated code only
sourceSets.main.java.srcDirs = ["$projectDir/src/main/java"]
}

Support for task caching

In Gradle this is possible to mark task as cacheable (with @CacheableTask annotation). Thanks to that wsdl2java tasks would not be re-executed for the same inputs, what is especially useful if Build Cache is used.

The usage of that would probably configurable (to be able to disabled it) for small wsdls which generation can be faster than gathering data from cache.

WSDL fetcher task contribution available (java8)

I have written a task that can fetch WSDLs from endpoints. We use it extensively at Jyske Bank.

Unfortunately (for this project) I have written it in Java8.
I have no intention of rewriting it to Groovy (or older Java) for the purpose of contribution.

But if someone out there would like to do this, I will be happy to contribute the code in its Java8 form on a branch.

(Alternatively, this project could be updated to require Java8, but I suspect it might burn a lot of users stuck on Java6/7).

Problem generating java code from plugin

I have trouble generating java code from our wsdl using this plugin. I have created an example project here: https://github.com/strindberg/wsdl-gen-plugin.git.

I have also created an equivalent project, running wsdl2java through manual setup. This approach works. You can find that example here: https://github.com/strindberg/wsdl-gen-manual.git

When I run gradle using the plugin, I get the following errors:
% gradle clean build
:deleteGeneratedSources
:clean UP-TO-DATE
:wsdl2java FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':wsdl2java'.

    jar:file:/Users/jesper/.m2/repository/org/apache/cxf/cxf-tools-common/2.7.10/cxf-tools-common-2.7.10.jar!/org/apache/cxf/tools/common/jaxb/W3CEPRJaxbBinding_jaxb22.xml [44,28]: cvc-complex-type.3.2.2: Attribute 'xjc:recursive' is not allowed to appear in element 'class'.
    jar:file:/Users/jesper/.m2/repository/org/apache/cxf/cxf-tools-common/2.7.10/cxf-tools-common-2.7.10.jar!/org/apache/cxf/tools/common/jaxb/W3CEPRJaxbBinding_jaxb22.xml [40,28]: cvc-complex-type.3.2.2: Attribute 'xjc:recursive' is not allowed to appear in element 'class'.
    jar:file:/Users/jesper/.m2/repository/org/apache/cxf/cxf-tools-common/2.7.10/cxf-tools-common-2.7.10.jar!/org/apache/cxf/tools/common/jaxb/W3CEPRJaxbBinding_jaxb22.xml [36,28]: cvc-complex-type.3.2.2: Attribute 'xjc:recursive' is not allowed to appear in element 'class'.
    jar:file:/Users/jesper/.m2/repository/org/apache/cxf/cxf-tools-common/2.7.10/cxf-tools-common-2.7.10.jar!/org/apache/cxf/tools/common/jaxb/W3CEPRJaxbBinding_jaxb22.xml [32,28]: cvc-complex-type.3.2.2: Attribute 'xjc:recursive' is not allowed to appear in element 'class'.
    jar:file:/Users/jesper/.m2/repository/org/apache/cxf/cxf-tools-common/2.7.10/cxf-tools-common-2.7.10.jar!/org/apache/cxf/tools/common/jaxb/W3CEPRJaxbBinding_jaxb22.xml [28,28]: cvc-complex-type.3.2.2: Attribute 'xjc:recursive' is not allowed to appear in element 'class'.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Custom namespace prefix

Standard use case generate in SOAP response prefix "ns2" for my namespace. Is it possible to generate custom namespace prefix with this plugin ??

Exit on fail

Plugin should throw TaskExcecutionException on fail.

wsdl2java always delete generatedWsdlDir

Hi all!

I have a problem with this gradle plugin. My project's structure contains the generated java interfaces, and their implementations in the same package. So for example: hu.main.ExampleInterface.java
and hu.main.impl.ExampleInterfaceImpl.java. I dont want to add the generated interfaces to the git repo just the implementations. My goal that everytime when the project is cloned (from git server) and gradle wsdl2java is run instead of deleting the whole package (including the implementations) because of init, just the interface should be refresh.

Is it possible to set now?

Incomplete -xjc option support

Code as written only supports two xjc options (-xjc-Xts and -xjc-Xbg).

The XJC options that are available are:

Available plugin options:
  -Xinject-code      :  inject specified Java code fragments into the generated code
  -Xlocator          :  enable source location support for generated code
  -Xsync-methods     :  generate accessor methods with the 'synchronized' keyword
  -mark-generated    :  mark the generated code as @javax.annotation.Generated
  -Xpropertyaccessors :  Use XmlAccessType PROPERTY instead of FIELD for generated classes
  -Xdv                 : Initialize fields mapped from elements with their default values
  -Xts                 : Activate plugin to add a toString() method to generated classes
         equivalent to: -Xts:style:org.apache.cxf.xjc.runtime.JAXBToStringStyle.DEFAULT_STYLE
  -Xts:style:multiline : Have toString produce multi line output
         equivalent to: -Xts:style:org.apache.cxf.xjc.runtime.JAXBToStringStyle.MULTI_LINE_STYLE
  -Xts:style:simple    : Have toString produce single line terse output
         equivalent to: -Xts:style:org.apache.cxf.xjc.runtime.JAXBToStringStyle.SIMPLE_STYLE
  -Xts:style:org.apache.commons.lang.builder.ToStringStyle.FIELD : The full class+field
         name of the ToStringStyle to use.
  -Xbug671             : Activate plugin to map package names that contain keywords
  -Xbg                 : Generate getters methods for Booleans
  -Xbgi                 : Generate getXXX and isXXX methods for Booleans

I was able to work around this to get the options that I need for my application by modifying the project.afterEvaluate{} closure in Wsdl2JavaPlugin.groovy like so:

project.afterEvaluate {
            def cxfVersion = ext.cxfVersion
            def xjcVersion = ext.xjcVersion

            // add cxf as dependency
            project.dependencies {
                wsdl2java "org.apache.cxf.xjc-utils:cxf-xjc-runtime:$xjcVersion"
                compile "org.apache.cxf.xjc-utils:cxf-xjc-runtime:$xjcVersion"
                wsdl2java "org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:$cxfVersion"
                wsdl2java "org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws:$cxfVersion"

                if (project.wsdl2java.wsdlsToGenerate.collect { it.contains('-xjc-Xbg') }.contains(true)) {
                    wsdl2java "org.apache.cxf.xjcplugins:cxf-xjc-boolean:$xjcVersion"
                }
                if (project.wsdl2java.wsdlsToGenerate.collect { it.contains('-xjc-Xbug671') }.contains(true)) {
                    wsdl2java "org.apache.cxf.xjcplugins:cxf-xjc-bug671:$xjcVersion"
                }
                if (project.wsdl2java.wsdlsToGenerate.collect { it.contains('-xjc-Xbug986') }.contains(true)) {
                    wsdl2java "org.apache.cxf.xjcplugins:cxf-xjc-bug986:$xjcVersion"
                }
                if (project.wsdl2java.wsdlsToGenerate.collect { it.contains('-xjc-Xdv') }.contains(true)) {
                    wsdl2java "org.apache.cxf.xjcplugins:cxf-xjc-dv:$xjcVersion"
                }
                if (project.wsdl2java.wsdlsToGenerate.collect { it.contains('-xjc-Xts') || it.contains('-xjc-Xts:style:simple') || it.contains('-xjc-Xts:style:multiline') }.contains(true)) {
                    wsdl2java "org.apache.cxf.xjcplugins:cxf-xjc-ts:$xjcVersion"
                    compile "org.apache.cxf.xjcplugins:cxf-xjc-ts:$xjcVersion"
                }
            }

            // hook wsdl2java into build cycle only if used
            if(project.wsdl2java.wsdlsToGenerate != null && project.wsdl2java.wsdlsToGenerate.size() >0 ){
                project.sourceSets.main.java.srcDirs += project.wsdl2java.generatedWsdlDir
                project.compileJava.dependsOn project.wsdl2java
            }
            if (ext.deleteGeneratedSourcesOnClean) {
                project.clean.dependsOn project.deleteGeneratedSources
            }
        }

Notes:

  • This isn't comprehensive xjc support. It was the minimum to get what I needed.
  • For the cxf release I am forced to use (2.7.10) has a different version for cxf libs (2.7.10) than for the xjc support libraries (2.6.2). Code as written (for -Xts and -Xbg options) assumes the cxf and xjc support libs will have same version numbers. Added a separate ext var for xjc version to handle this.
  • This solution does not allow stringing xjc options together in comma separated fashion per the wsdl2java doc. The workaround (good enough for me) is to list xjc options separately.
-xjc<xjc args>

Specifies a comma separated list of arguments that are passed directly to the XJC processor when using the JAXB databinding. A list of available XJC plugins can be obtained using -xjc-X.

Not able to specify the wsdlLocation for the generated code.

I want to specify the relative path to wsdl file in the generated Java code. As of now the plugin adds the absolute path to wsdl file. e.g.

@WebServiceClient(name = "ServiceActivation",
wsdlLocation = "file:/C:/portal/workspace/src/main/wsdl/ServiceActivation40.wsdl",
targetNamespace = "http://xyz.com/ws/4.0/serviceactivation")

How can I cange it to append "classpath:ServiceActivation40.wsdl" instead of absolute path. I have been able to achieve it with maven.

Typo

generatedWsdlDir is wrong in de readme.md "generated-sources/src/main/java" => needs to be "generatedsources/src/main/java"

Build failed

Please help me to get it working.

* What went wrong:
Execution failed for task ':wsdl2java'.
> org.xml.sax.SAXParseException; systemId: jar:file:/C:/Users/***/.gradle/caches/modules-2/files-2.1/com.sun.xml.bind/jaxb-xjc/2.1.13/a953200fed20f683c09e8f419c2babb1d89d82a/jaxb-xjc-2.1.13.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 81; columnNumber: 48; src-resolve: Cannot resolve the name 'xjc:globalJavaType' to a(n) 'group' component.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.449 secs
[sts] Build failed
org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.2.1-bin.zip'.

My configuration is:

wsdl2java {
    generatedWsdlDir = file("$projectDir/my-generated-sources") 
    wsdlDir = file("$projectDir/src/main/resources/wsdl/")
    wsdlsToGenerate = [
        ["$projectDir/src/main/resources/wsdl/test.wsdl"]
    ]
    cxfVersion = "2.5.1"
}

buildscript:

buildscript {
    repositories {
        maven { url "http://repo.spring.io/libs-release" }
        mavenLocal()
        jcenter()
        mavenCentral()
    }
    dependencies { classpath 'no.nils:wsdl2java:0.6' }
}

wsdl2java in a multi-project build

Hi,

Is it possible to use the plugin in a multi-project solution?

I would like to define in the parent gradle build the specification for every project. I have tried with:

subprojects {

       wsdl2java {
        generatedWsdlDir = file("$projectDir/src/java/genereate")
        wsdlDir = file("$projectDir/src/wsdl/")
        wsdlsToGenerate = [
                ['$projectDir/src/wsdl/*.wsdl']
        ]
       }
}

But it did not work as only some sub-projects have WSDL files. Is there a way to specify something like this in the parent build file?

Thanks!

Gradle-Build-Error since upgrade Android Studio to 2.x

Hi, i updated Android Studio from 1.5.1 to 2.0 today and get the following error during gradle build now. I definitely deactivated the offline mode. Any suggestions??

Error:Execution failed for task ':opendataconnector:wsdl2java'.
Could not resolve all dependencies for configuration ':opendataconnector:wsdl2java'.
Could not resolve org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:+.
Required by:
tip-champion:opendataconnector:unspecified
> No cached version listing for org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:+ available for offline mode.
> No cached version listing for org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:+ available for offline mode.
Could not resolve org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws:+.
Required by:
tip-champion:opendataconnector:unspecified
> No cached version listing for org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws:+ available for offline mode.
> No cached version listing for org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws:+ available for offline mode.

Update
I updated gradle version too and built the project with gradle, not from android studio. This works.

Working directory doesn't seem to be set correctly for multi module builds

When executing wsdl2java in a sub-module of a multi module build it appears that the working directory is not set to the sub-module's directory. This manifests in inter-wsdl lookups failing with FileNotFoundExceptions.

Is it possible to change the workingDirectory for the task to ensure that it executes from the sub-module's projectDir perhaps?

Automatic dependency to xjcplugins

Is there a reason for the dependency to xjcplugins, e.g. cxf-xjc-boolean? It seems like the latest version of that plugin is 3.0.5, while the latest cxf version is 3.1.6, and if cxfVersion is set to 3.1.6, there is a dependency error to cxf-xjc-boolean version 3.1.6.

Maybe there should be an option for cxfPluginsVersion?

Hard References to wsdl in java classes

The generated service class gives a hard reference to all path references to the wsdl file.

Examples:

  1. @WebServiceClient(name = "TestServiceService", wsdlLocation = "file:/home/user/..../wsdlFile.wsdl", ....)
  2. url = new URL("file:/home/user/...../wsdlFile.wsdl");

CXF Version is 3.1.0. Assume that all paths in wsdl2java options are relative to $projectDir.

Also the following will be useful additions that are already present in the Maven plugin:

  1. 'Mark as generated' option.
  2. Ability to specify a binding file.
  3. No address binding
  4. Supplying serial version for web faults.

Thanks so much!

Not able to use the namespace option (-p)

Hi,
I've been trying to use the -p option to replace the wsdl namespace with my own package name but not sure how to do this. I have tried various options but no success.

Any ideas ?

wsdl2java{ wsdlsToGenerate = [ ["${projectDir}/src/main/resources/service.wsdl"], ["-p","src/main/java/mypackagename"] // ["-p", "namspaceToReplace", "src/main/java/mypackagename"] ] generatedWsdlDir = file("$projectDir/src/main/java") wsdlDir = file("$projectDir/src/main/resources") locale = Locale.ENGLISH }

Same version used for CXF and CXF Plugins

The version of the CXF Plugins lags behind the CXF tools. Currently the latest version of org.apache.cxf.xjcplugins:cxf-xjc-ts is 3.0.5 while the latest version of the org.apache.cxf:cxf-tools is 3.1.4. When setting the wsdl2java cxfVersion to 3.1.4 when using the -xjc-Xts flag, the build fails.

To solve this I propose that a separate cxfToolsVersion option is added. This could default to the value of cxfVersion.

cxfVersion for xsd2java?

Hi,

I have to work in a legacy environment and I need to use cxfVersion = "2.3.1"
Now I have class version issues and running
gradle dependencies

I see :

    wsdl2java
        +--- org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:2.3.1
        |    +--- com.sun.xml.bind:jaxb-xjc:2.1.13
        |    +--- com.sun.xml.bind:jaxb-impl:2.1.13
    ...
    xsd2java
        +--- com.sun.xml.bind:jaxb-xjc:2.2.5
          \--- com.sun.xml.bind:jaxb-impl:2.2.5

I don't think is behind the problem, but I just realized that there isn't a way to set the cxf version/jaxb on xsd2java

Folder "generatedsources" is created, even when the task "xsd2java" is not used

Example of build script:

buildscript{
    repositories{
        jcenter() 
        mavenCentral()
    }
    dependencies {
        classpath 'no.nils:wsdl2java:+'
    }
}

apply plugin :'java'
apply plugin :'no.nils.wsdl2java'

wsdl2java {
    wsdlDir = file("src/main/resources/wsdl")
    generatedWsdlDir = file("generated-sources")
    wsdlsToGenerate = [["$projectDir/src/main/resources/wsdl/first.wsdl"]]
}

sourceSets {
    main.java.srcDirs += [wsdl2java.generatedWsdlDir]
}

Unexpected option: -b when using -bareMethods option

Hi,

I get an apache-cxf exception when i add a second option. My oncfigurtion looks like this:

wsdl2java {
    generatedWsdlDir = file("target/generated/cxf")
    wsdlDir = file("src/main/resources/")
    wsdlsToGenerate = [
        ['-bareMethods', 'listReports', '-b', 'src/main/resources/bindings.xml', 'src/main/resources/portal.wsdl']
    ]
}

When running, I get following error:

org.apache.cxf.tools.common.toolspec.parser.BadUsageException: Unexpected option: -b

The logs show, that cxf is getting the options correctly:

15:56:57.921 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.CommandLineParser] Parsing arguments: -bareMethods listReports -b src/main/resources/bindings.xml -d /Users/lukas.hueck/projects/calimero_esb/target/generated/cxf src/main/resources/portal.wsdl
15:56:57.931 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.TokenInputStream] Reading token -bareMethods
15:56:57.931 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.TokenInputStream] Reading token listReports
15:56:57.931 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.TokenInputStream] Reading token -b
15:56:57.931 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.TokenInputStream] Reading token src/main/resources/bindings.xml
15:56:57.931 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.TokenInputStream] Reading token -d
15:56:57.932 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.TokenInputStream] Reading token /Users/lukas.hueck/projects/calimero_esb/target/generated/cxf
15:56:57.932 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.TokenInputStream] Reading token src/main/resources/portal.wsdl

At one point, cxf is checking, whether listReports is a valid option (I think this is the problem):

15:56:57.945 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.TokenInputStream] Peeking token -bareMethods
15:56:57.945 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.Option] switchArg is -bareMethods
15:56:57.945 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.Option] Matches a switch!!!
15:56:57.945 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.TokenInputStream] Reading token -bareMethods
15:56:57.945 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.Option] Setting argument value of option to
15:56:57.946 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.OptionGroup] Option bareMethods accepted the token
15:56:57.946 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.Form] Args is available
15:56:57.946 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.OptionGroup] Accepting token stream for optionGroup: options, tokens are now [ listReports -b src/main/resources/bindings.xml -d /Users/lukas.hueck/projects/calimero_esb/target/generated/cxf src/main/resources/portal.wsdl ], running through 38 options
15:56:57.947 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.TokenInputStream] Peeking token listReports
15:56:57.947 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.Option] switchArg is -fe
15:56:57.947 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.Option] switchArg is -frontend
15:56:57.947 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.TokenInputStream] Peeking token listReports
15:56:57.947 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.Option] switchArg is -db
15:56:57.948 [DEBUG] [org.apache.cxf.tools.common.toolspec.parser.Option] switchArg is -databinding

But still, I get an error. In case, this is a pure cxf problem I am sorry to post it here.

Specifying -exsh true not producing implicit SOAP headers

I am configuring the plugin as follows, however, the "-exsh true" argument is being ignored, i.e. the implicit SOAP header parameters are not in the generated source:

wsdl2java {
wsdlDir = file("$projectDir/src/main/resources")
generatedWsdlDir = file("$projectDir/build/generated-sources/wsdl") // target directory for generated source code
wsdlsToGenerate = [ // 2d-array of wsdls and cxf-parameters
['-exsh', 'true', "$projectDir/src/main/resources/ResponsysWS57.wsdl"],
['-exsh', 'true', "$projectDir/src/main/resources/ResponsysWS_Level1.wsdl"],
['-exsh', 'true', "$projectDir/src/main/resources/TriggeredMessageWS.wsdl"]
]
cxfVersion = "2.5.7"
}

Dynamic cxf version

Let user choose cxf version with an option instead of having to override dependencies in buildscript-closure.

Inmemory compilation error

Hi
I am trying to build a module on jenkins which uses xsd2java plugin, during compilation phase I get this error

Execution failed for task ':ddx-platform:compileJava'.

com/sun/tools/javac/util/Log$PrefixKind

detailed error:::::

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':ddx-platform:compileJava'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:62)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
    at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:158)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)
    at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:36)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:103)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:97)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:97)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:102)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:32)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:77)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:47)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    Caused by: java.lang.NoClassDefFoundError: com/sun/tools/javac/util/Log$PrefixKind
    at com.sun.tools.javac.main.Main.bugMessage(Main.java:587)
    at com.sun.tools.javac.main.Main.compile(Main.java:568)
    at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
    at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
    at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:45)
    at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:101)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:50)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:36)
    at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:34)
    at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25)
    at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:157)
    at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:139)
    at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:93)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:243)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:230)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 68 more

Gradle xsd2java - clean build

Hi
When I run gradle clean build on the project which uses xsd2java plugin, I get this error

  • What went wrong:
    Execution failed for task ':ddx-common-rest-api:compileJava'.

    com/sun/tools/javac/util/Log$PrefixKind

  • Try:
    Run with --info or --debug option to get more log output.

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':ddx-common-rest-api:compileJava'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:62)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
    at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:158)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)
    at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:36)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:103)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:97)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:97)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:102)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:32)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:77)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:47)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    Caused by: java.lang.NoClassDefFoundError: com/sun/tools/javac/util/Log$PrefixKind
    at com.sun.tools.javac.main.Main.bugMessage(Main.java:587)
    at com.sun.tools.javac.main.Main.compile(Main.java:568)
    at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
    at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
    at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:45)
    at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:101)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:50)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:36)
    at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:34)
    at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25)
    at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:157)
    at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:139)
    at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:93)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:243)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:230)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 68 more
    Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.util.Log$PrefixKind
    ... 89 more

But , when i run just build task, i do not see any error.

I think the plugin is broken when used 'clean' command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.