0

I have configured my REST/Spring/Jersey project to generate documentation for APIs using enunciate.

The relevant changes in my pom.xml are

 <plugin>
        <groupId>org.codehaus.enunciate</groupId>
        <artifactId>maven-enunciate-spring-plugin</artifactId>
         <version>1.28</version>
        <configuration>
            <generateDir>${project.build.directory}/enunciate-generate</generateDir>
          <configFile>enunciate.xml</configFile>
          <exports>
            <jaxws.client.library.binaries>client.jar</jaxws.client.library.binaries>
          </exports>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>assemble</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
.....
    <dependency>
      <groupId>org.codehaus.enunciate</groupId>
      <artifactId>maven-enunciate-spring-plugin</artifactId>
      <version>1.28</version>
    </dependency>

My enunciate.xml is as follows

<?xml version="1.0"?>
<enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.28.xsd">
<api-classes>
<include pattern="com.xxx.rest.*"/>
</api-classes>
<modules>
<docs docsDir="api" title="REST WebServices API"/>
<spring-app>
<war mergeWebXML="war/WEB-INF/web.xml"/>
<springImport file="war/WEB-INF/applicationContext-jdbc.xml"/>
</spring-app>
</modules>
</enunciate>

When I run my maven project I get the following error initializing enunciate. As you can see the error is not very helpful. Any hints what could be wrong in my configuration.

--- maven-enunciate-spring-plugin:1.28:assemble (default) @ xxx --- initializing enunciate. [csharp] C# compilation is disabled, but the source code will still be generated.

invoking enunciate:generate step...

BUILD FAILURE

Total time: 3.324s

Failed to execute goal org.codehaus.enunciate:maven-enunciate-spring-plugin:1.28:assemble (default) on project xxx: Problem assembling the enunciate app. String index out of range: 0 -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

  • what happens when you run the command with `-e`? – Daniel Kaplan Jan 29 '14 at 00:24
  • @tieTYT Here's my -e output: Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:658) at org.codehaus.enunciate.main.ImportedClassesClasspathHandler.handleResource(ImportedClassesClasspathHandler.java:55) at org.codehaus.enunciate.main.Enunciate.scanClasspath(Enunciate.java:457) at org.codehaus.enunciate.main.Enunciate.doGenerate(Enunciate.java:350) – stackular Jan 29 '14 at 12:48
  • java.lang.String.charAt(String.java:658) rg.codehaus.enunciate.main.ImportedClassesClasspathHandler.handleResource(ImportedClassesClasspathHandler.java:55org.codehaus.enunciate.main.Enunciate.scanClasspath(Enunciate.java:462)atg.codehaus.enunciate.main.Enunciate.doGenerate(Enunciate.java:355)atrg.codehaus.enunciate.ConfigMojo$MavenSpecificEnunciate.doGenerate(ConfigMojo.java:670)atrg.codehaus.enunciate.main.Enunciate$Stepper.step(Enunciate.java:1799)atrg.codehaus.enunciate.main.Enunciate$Stepper.stepTo(Enunciate.java:1831)atrg.codehaus.enunciate.AssembleMojo.execute(AssembleMojo.java:71). – user3246755 Jan 29 '14 at 22:07
  • After some sleuthing figured out that I had some swagger dependency in my pom.xml that was causing enunciate to throw the above error. I removed the swagger dependency and now I am able to go past the above error. I however get this error now. Failed to execute goal org.codehaus.enunciate:maven-enunciate-spring-plugin:1.28:assemble (default) on project dcat-rest: Problem assembling the enunciate app. The invocation of APT has failed. See http://jira.codehaus.org/browse/ENUNCIATE-771 for a case where this has been seen. There is no explanation for this error. -> [Help 1].....Investigating – user3246755 Jan 30 '14 at 01:54

1 Answers1

0

That StringIndexOutOfBoundsException was reported and fixed here.

The "invocation of API has failed" is almost always caused by some compile failure. Maybe when you messed with your dependencies to get around the first problem, you introduced a compile failure in your code base?

Ryan Heaton
  • 1,173
  • 7
  • 11