views:

21

answers:

2

Hi, I have a maven project that has both code and documentation (pdf files). When I create a release of my software, I'd like to package the jar file and the documentation for the user. Is there a "correct" way to do this in maven? Should I have a multiple modules - one for the code (it's a small project, so the code is a single module right now) and one for the documentation? One module for each documentation pdf? Or some other way to package it in a single project? Any help with this would be appreciated.

thanks, Jeff

A: 

Take a look at the following post: Creating Documentation With Maven, It could very well answer your question.

StudiousJoseph
@StudiousJoseph. Thanks for the reference. In this case I already have the PDFs created, and while I can include them in the site, I'm trying to just create a distributable package that contains them. I guess I could do it as part of an assembly...
Jeff Storey
+1  A: 

When I create a release of my software, I'd like to package the jar file and the documentation for the user. Is there a "correct" way to do this in maven?

I would use the Assembly Plugin to create a zip and/or tar.gz distribution of the project containing both the jar and the various PDFs files.

Should I have a multiple modules - one for the code (it's a small project, so the code is a single module right now) and one for the documentation? One module for each documentation pdf? Or some other way to package it in a single project?

I don't really see the need, I'd keep everything in a single module and put the PDF in src/main/doc or something like that.

Pascal Thivent
Thanks. That's the direction I was leaning. Appreciate the help.
Jeff Storey
@Pascal, I may have been a little quick to respond. I realized if it's in src/main/doc (or something similar), it will get copied to the target dir every time I do a clean/build, which sounds like a pain since it doesn't affect the code but will take a macro amount of time. If I put it in a separate module, I wouldn't need to deal with that issue, but I could still easily distribute the documentation when I need to. I see pros and cons to both ways - I'll have to think about this some more.
Jeff Storey
@Jeff The PDF files will get copied only if you tell maven to do so. My suggestion was to use a custom assembly to grab them from `src/main/doc`, not to copy them to the `target` directory (and I would bind the plugin in a special release profile). Of course, you can also put them in another module. Still, my point is that they would get copied if you tell maven to do so, and that's not what I suggested.
Pascal Thivent
Ah, I see. That makes more sense. Thanks for clarifying.
Jeff Storey