Re: How to use the asciidoctor-maven-plugin to compile a separate jar package for asciidoc
Posted by abelsromero on
URL: https://discuss.asciidoctor.org/How-to-use-the-asciidoctor-maven-plugin-to-compile-a-separate-jar-package-for-asciidoc-tp6081p6101.html
The problem is that you are adding the maven oputput to as a <resources>.
With that you'll be adding all files located there in any component that follows maven-jar-plugin conventions.
You can do that, but then you have to exclude what you don't want in the docs and code jar.
The idea I had in mind was creation 2 different and TOTALLY SEPARATED folder structures:
* 1 for the jar
* 1 for the docs
That way you don't need to mess with excludes/includes, just point to the folder you want to use for each jar.
To do that what I did was:
1. Create a property in the pom to store the path of generated docs:
<output.path>${project.build.outputDirectory}/my-generated-docs</output.path>
2. Set that as output in the asciidoctor-maven-plugin configuration.
<outputDirectory>${output}/path</outputDirectory>
3. Set the generates docs path as `classesDirectory` in the "HELP" configuration of the maven-jar-plugin. This property tells the plugin to copy everything inside the folder. Provided you don't overlap code/resources with docs,
it's fine.
<classesDirectory>${output.path}</classesDirectory>
No need to exclude or include anything.
Still, I am not sure that will interact with the OSGi`maven-bundle-plugin`, but I don't see why it shouldn't work.
If you have problems, just create an example on GitHub/GitLab and we can work on it.