代码之家  ›  专栏  ›  技术社区  ›  Vijay Kumar

使用enulate生成API文档时出错

  •  0
  • Vijay Kumar  · 技术社区  · 14 年前

    Enunciate 下载了maven-enutate插件。然而,我在编译时得到以下错误,因为webservice注释位于我的POJO实现的接口类上,而不是POJO本身。

    I don't want to clutter the POJO by adding the annotations to it.  
    
        artifact org.mortbay.jetty:maven-jetty-plugin: checking for updates from central
    [INFO] [enunciate:docs {execution: default}]
    [INFO] initializing enunciate.
    [INFO] invoking enunciate:generate step...
    [WARNING] Validation result has errors.
    /Users/vkumar/IdeaProjects/identity-service/trunk/src/main/java/com/foobar/ids/service/IDService.java:17: [jersey] Jersey doesn't support interfaces as root resources. 
    The @Path parameter will need to be applied to the implementation class.
    
    public interface IDService {
           ^
    1 error
    [INFO] ------------------------------------------------------------------------
    
    
    

    这个pom.xml文件代码片段在这里

            <plugin>
              <groupId>org.codehaus.enunciate</groupId>
              <artifactId>maven-enunciate-plugin</artifactId>
              <!-- check for the latest version -->
              <version>1.20</version>
              <executions>
                <execution>
                  <goals>
                    <goal>docs</goal>
                  </goals>
                  <configuration>
    
                    <!-- the directory where to put the docs -->
                    <docsDir>${project.build}/docs </docsDir>
    
                  </configuration>
                </execution>
              </executions>
            </plugin>
    
    1 回复  |  直到 14 年前
        1
  •  2
  •   Ryan Heaton    14 年前

    但是,CXF并没有提出同样的要求,因此您可能需要考虑使用JAX-RS的CXF实现,而不是Jersey实现:

        <plugin>
          <groupId>org.codehaus.enunciate</groupId>
          <artifactId>maven-enunciate-cxf-plugin</artifactId>
          <!-- check for the latest version -->
          <version>1.20</version>
          <executions>
            <execution>
              <goals>
                <goal>docs</goal>
              </goals>
              <configuration>
    
                <!-- the directory where to put the docs -->
                <docsDir>${project.build}/docs </docsDir>
    
              </configuration>
            </execution>
          </executions>
        </plugin>
    
    推荐文章