在eclipse中使用wsimport的maven插件开发WSDL客户端
?
The first problem is the parameters, in the official web site, I can only find one parameters "packageName", but I also want to indicate the input WSDL file and directory, and also different mapping rules for different WSDL files.?Luckily?we have google. Here is the parameters supported by the plugin.
?
http://mojo.codehaus.org/jaxws-maven-plugin/wsimport-mojo.html
?
But another problem come up, when I try to have different execution, it seems only the first one executed, google again, the reason is the plugin has the state recorded, the different execution use the same directory and file name, so after the first one finished, other will get the executed status, and will not be executed again. So the work around is to set different statflag directory for different executions.
?
<plugin><groupId>org.codehaus.mojo</groupId><artifactId>jaxws-maven-plugin</artifactId><executions><execution><id>1</id> <configuration><extension>true</extension><verbose>true</verbose><wsdlDirectory>src/main/java/com/fd/link/</wsdlDirectory><sourceDestDir>src/main/java/</sourceDestDir><wsdlFiles><wsdlFile>linkApple.wsdl</wsdlFile></wsdlFiles><staleFile>src/main/java/com/fd/link/linkApple.asmx.stale</staleFile> <packageName>com.fd.link.linkApple</packageName></configuration><goals><goal>wsimport</goal></goals></execution><execution><id>2</id><configuration><extension>true</extension><verbose>true</verbose><wsdlDirectory>src/main/java/com/fd/link/</wsdlDirectory><sourceDestDir>src/main/java/</sourceDestDir><wsdlFiles><wsdlFile>linkBird.wsdl</wsdlFile></wsdlFiles><staleFile>src/main/java/com/fd/link/linkBird.asmx.stale</staleFile> <packageName>com.fd.link.linkBird</packageName></configuration><goals><goal>wsimport</goal></goals></execution></executions></plugin>?
?
It seems OK, but we have another problem, according to the official example, it depend on JDK tools. But the console report error, and the directory always indicated to Jre. And it is because the ${java.home} used in maven will refer to the JVM used by eclipse, and by default, it is Jre used by system, so to solve this problem, just configure eclipse.ini, add "-vm c:/jdk/bin/javax.exe" .
OK, maven running with?jaxws-maven-plugin, the client generated successfully.