0

你能帮我解决我在使用 Enunciate maven 插件时遇到的问题吗?问题是我的域在其他项目中,而不是在API项目中(不是包,而是java项目),所以在生成文档时,没有数据模型,但我在同一个项目中创建了一个数据模型(@XmlRootElement) API,它生成了。那么,插件能否生成其他项目中的数据模型呢?

4

2 回答 2

0

1.Export sources from your external API project You can add this to the API project or to the parent project in case this API project it's a module

<project ...>
...
 <build>
   ...
  <plugins>
    ...
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-source-plugin</artifactId>
      <executions>
       <execution>
         <id>attach-sources</id>
         <phase>package</phase>
         <goals>
           <goal>jar</goal>
         </goals>
       </execution>
      </executions>
    </plugin>
  </plugins>
 </build>
</project>

2.add a reference to the package in your enunciate.xml file

 <enunciate ...>
  <api-import pattern="com.mycompany.pck1.dao.*" />
 </enunciate ...>

3.create the dependency to the sources of the external project.

<project ...>
  ...
 <dependencies>
  ...
   <dependency>
     <groupId>...</groupId>
     <artifactId>domain</artifactId>
     <version>...</version>
     <classifier>sources</classifier>
     <scope>compile</scope>
     <optional>true</optional>
   </dependency>
   ...
  </dependencies>

** enunciate will try to compile your code so you need to add all the dependencies to external libraries

More Help: Multi-module projects

于 2013-08-23T14:28:38.810 回答
0

查看常见问题解答。第一个问题链接到该文档,该文档教您如何将类“导入”到项目中。

于 2013-07-06T20:09:55.803 回答