0

I'm using Enunciate to generate REST documentation upon building a REST application. Enunicate outputs documentation to /target/docs. I would like to add the /docs directory to the resulting JAR file (and rename it) to be able to serve docs as static content.

How do I do this? I can't figure out how to get these static files (which are generated upon build) into the JAR.

Hans Westerbeek
  • 5,645
  • 3
  • 34
  • 35
sbrattla
  • 5,274
  • 3
  • 39
  • 63
  • I think you will want to add these to your resources/static directory inside your jar correct? Otherwise you can't serve them up. How about copying them using a Maven Ant command after a certain goal? – Rob Baily Apr 14 '16 at 14:32
  • Closely related to 'Maven: Lifecycle vs. Phase vs. Plugin vs. Goal' http://stackoverflow.com/questions/26607834/maven-lifecycle-vs-phase-vs-plugin-vs-goal/ – Hans Westerbeek Apr 14 '16 at 15:53

2 Answers2

0

I guess you can solve this by configuring the Maven plugin for enunciate and wiring it up to be run in the 'generate-resources' lifecycle phase.

Also, make sure you set the output-dir to a subdirectory of src/main/resources/static, as commented by Rob above.

Hans Westerbeek
  • 5,645
  • 3
  • 34
  • 35
0

I added this to my enunciate.xml to force the docs directory to be generated in a custom location which will be packaged with the .war file

<docs docsDir="target/<app_name>/docs"/>

and then maven will put the entire contents of target/ into the resulting war file package

Megan D
  • 379
  • 3
  • 13