我已将 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