如何从WSDL包括端口生成Java? Ant WsImport ws jaxws-导入Maven插件

问题描述

我正在从Gradle迁移到Maven。

Gradle构建从几个WSDL生成java类

对于其中一个WSDL,在Gradle中有一个大块调用Ant的WsImport任务,该任务使用XJC。

task.wsimport {
    ext.classesDir = "${buildDir}/classes/jaxb"
    ext.sourcesDirsome = "${buildDir}/generated/"
    ext.packageSome = "some"
    ext.schemaSome = "${projectDir}/src/main/resources/someService/some-soap-service.wsdl"

    outputs.dir classesDir
    doLast {
        project.ant {
            mkdir(dir: sourcesDirsome)
            taskdef(name: 'wsimport',classname: 'com.sun.tools.ws.ant.WsImport',classpath: configurations.jaxws.asPath
            )
            wsimport(keep: true,destdir: classesDir,sourcedestdir: sourcesDirsome,extension: "true",verbose: "false",quiet: "false",package: packageSome,xnocompile: "true",wsdllocation: "/someService/some-soap-service.wsdl",wsdl: schemaSome) {
                xjcarg(value: "-XautoNameResolution")
            }
            javac(destdir: classesDir,source: 11,target: 11,debug: true,includeantruntime: false,debugLevel: "lines,vars,source",classpath: configurations.jaxb.asPath) {
                src(path: sourcesDirsome)
                include(name: "**/*.java")
                include(name: "*.java")
            }
            copy(todir: classesDir) {
                fileset(dir: sourcesDirsome,erroronmissingdir: false) {
                    exclude(name: "**/*.java")
                }
            }
        }
    }

}

对于Maven,我选择了jaxws-maven-plugin,它也使用XJC。

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <configuration>
                <wsdlDirectory>${xsdsBaseDir}/someService</wsdlDirectory>
                <wsdlLocation>${xsdsBaseDir}/someService/some-soap-service.wsdl</wsdlLocation>
                <packageName>some</packageName>
                <keep>true</keep>
                <sourceDestDir>${project.build.directory}/generated-sources/main/java</sourceDestDir>
                <target>2.0</target>
            </configuration>
            <executions><execution><goals><goal>wsimport</goal></goals></execution></executions>
        </plugin>

但是生成代码缺少Groovy中生成的某些类-WSDL端口的那些类。

可能是什么原因?我已经阅读了WsImport和jaxws-maven-plugin的手册,但两者几乎一样。
我有事吗也许有一些不同的认值?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)