0

我已将 REST/Spring/Jersey 项目配置为使用 enunciate 生成 API 文档。

我的 pom.xml 中的相关更改是

 <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>

我的 enunciate.xml 如下

<?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>

当我运行我的 maven 项目时,初始化发音时出现以下错误。如您所见,该错误不是很有帮助。任何提示我的配置可能有什么问题。

--- maven-enunciate-spring-plugin:1.28:assemble (default) @ xxx --- 初始化 enunciate。[csharp] 禁用 C# 编译,但仍会生成源代码。

调用发音:生成步骤...

构建失败

总时间:3.324s

无法在项目 xxx 上执行目标 org.codehaus.enunciate:maven-enunciate-spring-plugin:1.28:assemble (default):组装发音应用程序时出现问题。字符串索引超出范围:0 -> [帮助 1]

要查看错误的完整堆栈跟踪,请使用 -e 开关重新运行 Maven。使用 -X 开关重新运行 Maven 以启用完整的调试日志记录。

有关错误和可能的解决方案的更多信息,请阅读以下文章:[帮助 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

4

1 回答 1

0

StringIndexOutOfBoundsException是报告和修复here

“调用 API 失败”几乎总是由某些编译失败引起的。也许当您为了解决第一个问题而弄乱了依赖项时,您在代码库中引入了编译失败?

于 2014-04-09T21:32:53.530 回答