Class AdocUnionMojo
java.lang.Object
network.ike.plugin.AdocUnionMojo
- All Implemented Interfaces:
org.apache.maven.api.plugin.Mojo
@Mojo(name="adoc-union",
defaultPhase="generate-sources")
public class AdocUnionMojo
extends Object
implements org.apache.maven.api.plugin.Mojo
Unpacks every topic library a module declares into one AsciiDoc union per repository,
<reactor root>/target/generated-sources/adoc, and checks that the module's own
includes resolve there (IKE-Network/ike-issues#1342; design topic dev-adoc-packages
in ike-lab-documents). It replaces the stock unpack-dependencies execution for
adoc zips.
A library lays its root out as packages, <group>/<domain>/<topic>.adoc, and ships
a manifest at META-INF/ike/<group>/<artifact>/manifest.yaml listing them. The goal:
- resolves the module's dependencies with classifier
adocand typezip, transitively, asunpack-dependenciesdoes; - copies an external library's content from its zip, and links the package directories
of a library that is a module of the same reactor to its
src/docs/asciidoc, so an edit reached through an include changes the real source (ike.adoc.link, default true). Whether IntelliJ resolves includes, previews and navigates through such a link is to be confirmed by KEC on one machine; - treats a zip without a manifest as a legacy library: refused, naming the artifact,
unless
ike.adoc.legacy=true, which unpacks it into the legacy per-module directory as before; - refuses two libraries that ship one package, naming both;
- is idempotent from every module, so a
-plbuild works: an unchanged library is not rewritten, and an entry whose library no module declares anymore is left alone, since the union is per repository and not per module; - verifies that every
include::{adoc}/...andinclude::{topics}/...in the module'ssrc/docs/asciidocresolves in the union, and fails the build for one that does not with the exact<dependency>block to add, found in the union's manifests and then in the local repository by the group prefix of the path. It never fetches an undeclared library; - sets the project properties
adocandtopicsto the union, so the asciidoctor plugin's attributes can reference them. While a legacy library was unpacked,topicsnames the legacy directory instead, so the old include lines keep resolving until the last consumer migrates.
The module itself, when its own source root has the package layout, is linked into the
union too, so a library's own {adoc} includes resolve in a build of that module
alone.
Typical wiring, in ike-parent (IKE-Network/ike-issues#1343):
<execution>
<id>adoc-union</id>
<phase>generate-sources</phase>
<goals><goal>adoc-union</goal></goals>
</execution>
Modules of a -T reactor share the union, so the goal serializes its writes
JVM-wide.
- Since:
- 276
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Resolves the declared libraries, updates the union, verifies the module's includes and sets theadocandtopicsproperties.
-
Field Details
-
PROPERTY_ADOC
The project property set to the union directory, which the{adoc}attribute reads.- See Also:
-
PROPERTY_TOPICS
The project property set for the{topics}alias, which the migration keeps.- See Also:
-
-
Constructor Details
-
AdocUnionMojo
public AdocUnionMojo()Creates this goal instance.
-
-
Method Details
-
execute
public void execute()Resolves the declared libraries, updates the union, verifies the module's includes and sets theadocandtopicsproperties.- Specified by:
executein interfaceorg.apache.maven.api.plugin.Mojo- Throws:
org.apache.maven.api.plugin.MojoException- on a legacy library outside legacy mode, two libraries shipping one package, an include that does not resolve, or a file that cannot be written
-