微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何从依赖项jar中引用wsdl文件?

如何解决如何从依赖项jar中引用wsdl文件?

我有3个模块:

api模块包含xsd + wsdl文件,并在编译期间使用来自Apache的cxf-codegen-plugin生成Java对象。

service模块实现了api生成的接口,该接口作为依赖项导入。

然后ear模块从service构建耳包。

这是服务定义的方式:

@Stateless
@BindingType(SOAPBinding.soAP12HTTP_BINDING)
@WebService(portName = "blabla",serviceName = "blabla",targetNamespace = "http://blabla",wsdlLocation = "meta-inf/wsdl/mywebservice.wsdl",// this should be relative to the api jar
        endpointInterface = "blabla")
@SchemaValidation
public class MyWebServiceImpl implements MyWebService {}

问题是,我们注意到,如果不指定wsdlLocation,则模式验证将不起作用,因此需要添加它。但是我们不知道如何引用它,而无需将wsdl文件直接添加service jar的根目录中。我们进行以下组装(位于服务模块中):

<assembly
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
    <id>resources</id>
    <formats>
        <format>jar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <includes>
                <include>service-artifact</include>
            </includes>
            <outputDirectory>/</outputDirectory>
            <useProjectArtifact>true</useProjectArtifact>
            <scope>runtime</scope>
            <unpack>true</unpack>
        </dependencySet>
        <dependencySet>
            <includes>
                <include>api-artifact</include>
            </includes>
            <outputDirectory>/</outputDirectory>
            <useProjectArtifact>true</useProjectArtifact>
            <scope>runtime</scope>
            <unpack>true</unpack>
            <unpackOptions>
                <includes>
                    <include>meta-inf/wsdl/**</include>
                </includes>
            </unpackOptions>
        </dependencySet>
    </dependencySets>
</assembly>

我想摆脱这一点,因为我认为没有必要这样做,因为依赖性已经存在。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。