问题描述
我有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 (将#修改为@)