I have a maven module that uses the plugin jaxws-maven-plugin
. I have the webservice up and running and when browsing to the .../myWebservice?wsdl
, I get the WSDL. No problem.
This also works when running the wsimport
maven goal through:
<plugin>
<groupId>
org.codehaus.mojo</groupId>
<artifactId>
jaxws-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>
wsimport</goal>
</goals>
</execution>
开发者_如何学JAVA </executions>
<configuration>
<sourceDestDir>
src/main/java</sourceDestDir>
<wsdlUrls>
<wsdlUrl>
http://host/f/soap/fWeb?wsdl</wsdlUrl>
</wsdlUrls>
</configuration>
</plugin>
When running
mvn clean install
All is fine... However, it doesn't work when I run
mvn clean deploy
Looking at the logged out parameters, they are identical in both cases:
[INFO] jaxws:wsimport args: [-s, D:\works2\f-service\src\main\java, -d, D:\works2\f-
service\target\classes, -Xnocompile, http://host/f/soap/fWeb?wsdl]
parsing WSDL...
After a really long timeout, that feels like a http timeout, it fails with this message:
[ERROR] Unexpected end of file from server
Failed to read the WSDL document: http://host/f/soap/fWeb?wsdl, because
1) could not find the document;
2) the document could not be read;
3) the root element of the document is not wsdl:definitions.
ERROR failed.noservice=Could not find wsdl:service in the provided WSDL(s):
At least one WSDL with at least one service definition needs to be provided.
Failed to parse the WSDL.
It's a bit confusing, since it takes so long... In fact the full namespace is not mentioned in the WSDL, root element is <definitions>
, not <wsdl:definitions>
, but then why does it work with mvn clean install
...?
Thanks!
RaoulActually, I have no idea why mvn clean install
and mvn clean deploy
don't have a consistent result. First, wsimport
is bound to the generate-sources
phase and is executed in both case much earlier. Second, the deploy
phase which occurs right after install
doesn't do much more things, as documented:
done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
So, really, I don't see how copying an artifact to a repository can impact wsimport
or make the build fail on something related to the WSDL. Very, very weird. Maybe run mvn -X clean deploy
to see if you can get more information.
Anyway, I have a few suggestions about the jaxws-maven-plugin configuration.
The first one would be to not generate sources in src/main/java
. IMO, generated sources should go under the target
directory as you want to be able to delete them during a clean
. So I'd suggest to use the default value which is ${project.build.directory}/jaxws/wsimport/java
or something like ${project.build.directory}/generated-sources/jaxws
instead (this is the standard maven pattern for generated stuff). But this is a side note, this won't solve your issue :)
The second suggestion is about the <wsdlUrls>
configuration. Instead of using <wsdlUrls>
, why don't you get the WSDL (as a file) and put it in src/wsdl
(or another location in which case you'll have to specify it using the <wsdlLocation>
element). This should help to workaround the timeout issue.
精彩评论