Search code examples
javaweb-servicesmaven-pluginenunciate

How can I use enunciate (for webservice document) in runtime?


I want to use enunciate to generate web-service documentation at run-time or load-time or generate from WAR file with sources (this better for my purpose), before this I use enunciate maven plugin to generate documents at compile time and without any problem I do it.

Unfortunately I can't find any document or manual about how can I do this, before I start this code, I found a page that describes how using enunciate in run-time on enunciate.codehaus.org. But now change enunciate site and maybe remove this content.

Now I try to write code that generates document from a java web-service and write this code:

    EnunciateConfiguration conf = new EnunciateConfiguration();
    conf.load(new File("src\\main\\enunciate.xml"));
    String[] sourceFile = new String[{"src\\main\\java\\com\\arman\\webservice\\ArmanService.java"};
    Enunciate enunciate = new Enunciate(sourceFile,conf);
    enunciate.setRuntimeClasspath((enunciate.getRuntimeClasspath() == null ?
                                   "" : (enunciate.getRuntimeClasspath() + ";")) + "target\\classes");
    File buildDir = new File("D:\\enunciate\\build");
    enunciate.setBuildDir(buildDir);
    File scratchDir = new File("D:\\enunciate\\scratchDir");
    enunciate.setScratchDir(scratchDir);
    File generateDir = new File("D:\\enunciate\\generateDir");
    enunciate.setGenerateDir(generateDir);
    File compileDir = new File("D:\\enunciate\\compileDir");
    enunciate.setCompileDir(compileDir);


    // enunciate.setJavacSourceVersion("1.6");
    // enunciate.setJavacTargetVersion("1.6");
    enunciate.setDebug(true);
    enunciate.setTarget(Enunciate.Target.PACKAGE);
    enunciate.setEncoding("UTF-8");
    enunciate.setVerbose(true);
    enunciate.setCompileDebugInfo(true);

    enunciate.execute();

this code run , no exception thrown, but only war file and basic-app generated without any document.

Anyone know how can I do this or where I can find any documentation about enunciate-rt?


Solution

  • finally I debugged enunciate source code and understood must reffer all enunciate dependency in classpath .