Search code examples
javajax-wswsgen

jax-ws: what exactly does the "keep" flag in the "wsgen" tool do?


What exactly does the keep flag in the wsgen tool do? I am using the default command-line implementation that ships with Oracle Java 7 (at: /usr/lib/jvm/java-7-oracle/bin/wsgen).

The documentation says: "Keep generated files" however I 've tried both:

wsgen -cp dist/foo.jar -r ../client/ -s ../client/src-auto/ -keep foo.Hello

and

wsgen -cp dist/foo.jar -r ../client/ -s ../client/src-auto/       foo.Hello

and the generated files are always overwritten (both the Java client stub files and the wsdl files). The same behavior is shown by the wsgen Ant task - the keep attribute doesn't seem to produce any effects whether true or false.


Solution

  • wsgen generates your web service artifacts, compiles them and keeps only the .class files. By using the -keep option you are telling wsgen to also keep the generated .java files.

    -s instructs wsgen to keep the .java files and place them at the specified location at which point I think the -keep option is ignored since you used the -s option (you did so in both your examples).

    Try playing with a simple command with just -keep and see when it keeps .java files and when it does not.