0

我试图将模型类导入到发音文档中,但我在 Maven 日志中得到以下信息:

Class com.mycompany.model.MyClass was explicitly imported, but it was not found on the classpath. We'll try to import it anyway.

我试图在我的发音生成文档中包含请求和响应类。但是,我得到的只是以下内容:

POST
Request             Body
element:            (custom)
media types:        application/json

(no documentation provided)

Response            Body
element:            (custom)
media types:        application/json

(no documentation provided)

发音.xml

<?xml version="1.0"?>
<enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.27.xsd">
    <api-import pattern="com.mycompany.model.*" />
    <api-import pattern="com.mycompany.model.MyClass" />
    <api-classes>
        <include pattern="com.mycompany.common.imrest.model.*"/>
        <include pattern="com.mycompany.model.MyClass"/>
    </api-classes>
</enunciate>

pom.xml

        <plugin>
            <groupId>org.codehaus.enunciate</groupId>
            <artifactId>maven-enunciate-plugin</artifactId>
            <version>1.27</version>
            <configuration>
                <configFile>enunciate.xml</configFile>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>assemble</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

另外,第二个问题。有没有办法在文档中包含示例 JSON 请求和响应?

4

1 回答 1

0

Enunciate 扫描您的类路径,导入您配置为要导入的任何类。但它在扫描过程中没有找到那个类。您是否确认您依赖于包含com.mycompany.model.MyClass该类的 jar?

回复:JSON 示例:如果jackson-xc.jar在您的类路径中,Enunciate 将默认生成示例 JSON。否则,您可以强制示例 json:

 <enunciate ...>
   ...
   <modules>
     <docs forceExampleJson="true"/>
   </modules>
 </enunciate>
于 2013-12-05T00:44:40.853 回答