Class InjectJavadocThemeMojo

java.lang.Object
network.ike.plugin.InjectJavadocThemeMojo
All Implemented Interfaces:
org.apache.maven.api.plugin.Mojo

@Mojo(name="inject-javadoc-theme", defaultPhase="site") public class InjectJavadocThemeMojo extends Object implements org.apache.maven.api.plugin.Mojo
Overlay the IKE green stylesheet onto a generated Javadoc apidocs tree.

Java 25's stock Javadoc stylesheet exposes a :root block of CSS custom properties — colours, fonts, spacing. This mojo writes a companion stylesheet resource-files/ike-theme.css that overrides only those custom properties to the sentry-green palette used by the project Maven site, then injects a second <link rel="stylesheet"> tag into every HTML page so the override cascades over the stock stylesheet.

Same pattern as InjectBreadcrumbMojo for JaCoCo reports: a single in-source CSS string is the source of truth, written into the apidocs output after the javadoc tool has produced its files, and the existing default stylesheet is left untouched (resilient to Java version updates).

Usage in the IKE release flow:

mvn site                                  # produces target/site/apidocs/
mvn ike:inject-javadoc-theme              # writes ike-theme.css and patches HTML
mvn site:stage                            # collects target/site → target/staging

IKE-Network/ike-issues#518.

  • Constructor Details

    • InjectJavadocThemeMojo

      public InjectJavadocThemeMojo()
      Creates this goal instance.
  • Method Details

    • getLog

      protected org.apache.maven.api.plugin.Log getLog()
      Access the Maven logger.
      Returns:
      the logger
    • execute

      public void execute() throws org.apache.maven.api.plugin.MojoException
      Specified by:
      execute in interface org.apache.maven.api.plugin.Mojo
      Throws:
      org.apache.maven.api.plugin.MojoException
    • injectThemeCssLink

      public static String injectThemeCssLink(String html)
      Inject a stylesheet link to resource-files/ike-theme.css after the existing link to resource-files/stylesheet.css. The injected URL inherits the same relative-path prefix as the stock stylesheet, so it resolves correctly from any page depth.
      Parameters:
      html - the HTML content
      Returns:
      HTML with the theme link injected, or unchanged if no stock stylesheet link is present
    • generateThemeCss

      public static String generateThemeCss()
      Generate the IKE theme override CSS for Javadoc.

      Overrides only the :root custom properties exposed by the stock Java 25 stylesheet — the cascade does the rest. Palette constants come from IkePalette so this theme, InjectBreadcrumbMojo's, and ike-base-parent's site.css all share one source.

      Returns:
      CSS content as a string