Re: How to use the asciidoctor-maven-plugin to compile a separate jar package for asciidoc

Posted by zera on
URL: https://discuss.asciidoctor.org/How-to-use-the-asciidoctor-maven-plugin-to-compile-a-separate-jar-package-for-asciidoc-tp6081p6100.html

Hi, abelsromero

In fact, I have implemented two jars, but I do not think my way is right. now I give my steps and the wrong parts.

S1: I define the maven project like this:


S2: and My pom configuration as below:
<build>
                <resources>
                        <resource>
                                <directory>src/main/java</directory>
                                <excludes>
                                        <exclude>**/*.java</exclude>
                                </excludes>
                        </resource>
                        <resource>
                                <directory>${basedir}/src/main/resources</directory>
                        </resource>
                        <resource>
                                <directory>${project.build.directory}/docs/</directory>
                                <excludes>
                                        <exclude>**/*.adoc</exclude>
                                        <exclude>**/*.pdf</exclude>
                                </excludes>
                                <includes>
                                        <include>**/images/*</include>
                                        <include>**/en/index.html</include>
                                        <include>**/en/*.css</include>
                                </includes>
                        </resource>
                </resources>
                <plugins>
                        <plugin>
                                <groupId>org.apache.felix</groupId>
                                <artifactId>maven-bundle-plugin</artifactId>
                                <extensions>true</extensions>
                                <configuration>
                                        <instructions>
                                                <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                                                <Bundle-Activator>XXX.internal.Activator</Bundle-Activator>
                                                <SCM-Version>v${scmVersion}</SCM-Version>
                                                <Contains-Manual>Y</Contains-Manual>
                                                <Export-Package>
                                                </Export-Package>
                                                <Import-Package>       
                                                </Import-Package>
                                                <Include-Resource>
                                                        ...
                                                </Include-Resource>
                                        </instructions>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.asciidoctor</groupId>
                                <artifactId>asciidoctor-maven-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <id>output-html</id>
                                                <phase>generate-resources</phase>
                                                <goals>
                                                        <goal>process-asciidoc</goal>
                                                </goals>
                                                <configuration>
                                                        <sourceHighlighter>coderay</sourceHighlighter>
                                                        <backend>html</backend>
                                                        <attributes>
                                                                <project-version>${project.version}</project-version>
                                                                <linkcss>true</linkcss>
                                                                <sectnums>true</sectnums>
                                                                <toc>left</toc>
                                                                <toclevels>4</toclevels>
                                                                <icons>font</icons>
                                                        </attributes>
                                                </configuration>
                                        </execution>
                                </executions>
                                <configuration>
                                        <preserveDirectories>true</preserveDirectories>
                                        <relativeBaseDir>true</relativeBaseDir>
                                        <sourceDirectory>
                                                docs/help</sourceDirectory>
                                        <outputDirectory>${project.build.directory}/docs/help</outputDirectory>
                                        <headerFooter>true</headerFooter>
                                        <imagesDir>images</imagesDir>
                                </configuration>
                        </plugin>
                        <plugin>
                                <artifactId>maven-jar-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <id>HELP</id>
                                                <phase>package</phase>
                                                <goals>
                                                        <goal>jar</goal>
                                                </goals>
                                                <configuration>
                                                        <classifier>HELP</classifier>
                                                        <archive>
                                                                <manifest>
                                                                        <addDefaultImplementationEntries>false</addDefaultImplementationEntries>
                                                                        <addDefaultSpecificationEntries>false</addDefaultSpecificationEntries>
                                                                </manifest>
                                                                <manifestEntries>
                                                                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}.HELP</Bundle-SymbolicName>
                                                                        <SCM-Version>v${scmVersion}</SCM-Version>
                                                                        <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                                                                        <Web-ContextPath>/${project.groupId}.${project.artifactId}</Web-ContextPath>
                                                                </manifestEntries>
                                                        </archive>
                                                        <includes>
                                                                <include>**/**/help/**/images/*.*</include>
                                                                <include>**/**/help/en/index.html</include>
                                                                <include>**/**/help/en/*.css</include>
                                                        </includes>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>
                </plugins>
        </build>

and I run "mvn clean install", generate two jars:



Thanks !!!