wsimportを使用してソースを生成する必要があり、/ src / main/javaではなく/target/generated-sources/wsimportに移動する必要があると思います。
問題は、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>
wsimport を使用してソースを生成する必要があり、/src/main/java ではなく、/target/generated-sources/wsimport に移動する必要があると想定しています。
これは正しい仮定です。
問題は、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;
}
...
}
...
}
プラグインとその構成を呼び出す方法を教えてください。