Ean*_*nlr 5 maven-2 jax-ws wsimport
我必须使用wsimport生成源,并且我假设它应该转到/ target / generated-sources / wsimport而不是/ src / main / java。
问题是wsimport需要在执行之前创建目标文件夹,并且失败。我可以先使用任何Maven插件创建该目录吗?我可以使用ant来做,但是我更喜欢将其保存在POM中。
尝试使用构建助手插件的add source目标:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/target/generated/src/wsimport</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我必须使用 wsimport 生成源,并且我假设它应该转到 /target/ generated-sources/wsimport 而不是 /src/main/java 。
这是一个正确的假设。
问题是 wsimport 需要在执行之前创建目标文件夹,但它失败了。我可以先使用任何 Maven 插件创建该目录吗?我可以使用 ant 来完成,但我更喜欢将其保留在 POM 中。
我从来没有注意到这个问题(并且将其视为一个错误,插件必须处理此类事情)。
奇怪的部分是,WsImportMojo似乎通过调用来完成必须做的事情File#mkdirs():
public void execute()
throws MojoExecutionException
{
// Need to build a URLClassloader since Maven removed it form the chain
ClassLoader parent = this.getClass().getClassLoader();
String originalSystemClasspath = this.initClassLoader( parent );
try
{
sourceDestDir.mkdirs();
getDestDir().mkdirs();
File[] wsdls = getWSDLFiles();
if(wsdls.length == 0 && (wsdlUrls == null || wsdlUrls.size() ==0)){
getLog().info( "No WSDLs are found to process, Specify atleast one of the following parameters: wsdlFiles, wsdlDirectory or wsdlUrls.");
return;
}
...
}
...
}Run Code Online (Sandbox Code Playgroud)
您能展示如何调用该插件及其配置吗?
| 归档时间: |
|
| 查看次数: |
9227 次 |
| 最近记录: |