如何从依赖项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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...