0

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?

2 Answers2

0

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

Ryan Heaton
  • 1,173
  • 7
  • 11
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

delkant
  • 2,304
  • 1
  • 29
  • 28