简体   繁体   中英

Does Enunicate maven plug-in could generate the data model which in other java project?

Would you please help me to fix a problem I met that to use Enunciate maven plug-in? The problem is my domain is in other project, not in API project (not package, but java project), so when generate the documents, there is no data model, but I create a data model (@XmlRootElement) in the same project of API, it generated. So, does the plug-in could generate the data model which in other project?

Check out the FAQ . The first question links to this document which teaches you how to "import" classes into the project.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM