Class OrgSiteSupport

java.lang.Object
network.ike.plugin.OrgSiteSupport

public final class OrgSiteSupport extends Object
Shared utilities for org-site registration and deregistration.

Handles cloning the org site repository, writing/deleting project fragments, regenerating the master index, rendering AsciiDoc to XHTML, and publishing the built site to GitHub Pages.

Parallel to ReleaseSupport — all subprocess invocations use ProcessBuilder, no library dependencies beyond the JDK, maven-plugin-api, and AsciidoctorJ.

  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    buildSite(File orgRoot, org.apache.maven.api.plugin.Log log)
    Build the org site by invoking mvn site in the cloned org repo.
    static File
    cloneOrgRepo(String repoUrl, String branch, org.apache.maven.api.plugin.Log log)
    Shallow-clone the org site repository into a temporary directory.
    static void
    commitAndPush(File orgRoot, String message, String branch, org.apache.maven.api.plugin.Log log)
    Commit all changes in the org repo and push to the remote.
    static void
    deleteFragment(File orgRoot, String artifactId)
    Delete a project registration fragment.
    static void
    deregisterProject(org.apache.maven.api.plugin.Log log, String srcRepoUrl, String pubRepoUrl, String srcBranch, String pubBranch, String artifactId)
    Run the full deregistration workflow against the two-repo org-site layout (#367 — mirror of registerProject(File, Log, String, String, String, String, String, String, String, String, String, String, List)).
    static void
    publishToGhPages(File orgRoot, String repoUrl, org.apache.maven.api.plugin.Log log)
    Publish the staged site to the gh-pages branch using the same orphan-commit-force-push pattern as ReleaseSupport.
    static void
    publishToPubRepo(File srcRoot, String pubRepoUrl, String pubBranch, String artifactId, String version, org.apache.maven.api.plugin.Log log)
    Publish the target/site/ contents from a freshly- built source repo to a separate publish repo.
    static void
    Regenerate src/site/asciidoc/index.adoc from all fragments in the projects/ directory.
    static void
    Regenerate the <menu> blocks in the org-site's src/site/site.xml from the same fragment-list that drives the index body — eliminating the drift class where the landing-page body is auto-current but the left-nav is a stale hand-maintained snapshot (IKE-Network/ike-issues#520).
    static void
    registerProject(File callerGitRoot, org.apache.maven.api.plugin.Log log, String srcRepoUrl, String pubRepoUrl, String srcBranch, String pubBranch, String artifactId, String name, String description, String version, String siteUrl, String githubUrl, List<String> modules)
    Run the full registration workflow on a two-repo org-site layout (#367): Clone the SOURCE repo (srcRepoUrl) — has the Maven pom and src/site/ tree. Write the per-project fragment into projects/&lt;artifactId&gt;.adoc. Regenerate the master index from all fragments. Render the index AsciiDoc to XHTML (for doxia). Run mvn site to produce target/site/. Commit + push the source repo so the fragment + index are persisted. Publish target/site/ to the PUBLISH repo (pubRepoUrl) by cloning, wiping non-Git contents, copying the build output, committing, and pushing.
    static void
    renderToXhtml(File orgRoot, org.apache.maven.api.plugin.Log log)
    Render the master index AsciiDoc to XHTML using AsciidoctorJ in-process.
    static void
    writeFragment(File orgRoot, String artifactId, String name, String description, String version, String siteUrl, String githubUrl, List<String> modules)
    Write a project registration fragment to the org repo.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • writeFragment

      public static void writeFragment(File orgRoot, String artifactId, String name, String description, String version, String siteUrl, String githubUrl, List<String> modules) throws org.apache.maven.api.plugin.MojoException
      Write a project registration fragment to the org repo.

      Creates the projects/ directory if absent. Overwrites any existing fragment for the same artifact ID (re-registration on version bump).

      Parameters:
      orgRoot - root of the cloned org repository
      artifactId - Maven artifact ID (used as filename)
      name - human-readable project name
      description - one-line project description
      version - release version (not SNAPSHOT)
      siteUrl - public site URL (e.g., https://ike.network/ike-pipeline/)
      githubUrl - GitHub repository URL
      modules - reactor module names (may be empty)
      Throws:
      org.apache.maven.api.plugin.MojoException - if the fragment cannot be written
    • deleteFragment

      public static void deleteFragment(File orgRoot, String artifactId) throws org.apache.maven.api.plugin.MojoException
      Delete a project registration fragment.
      Parameters:
      orgRoot - root of the cloned org repository
      artifactId - Maven artifact ID (filename without extension)
      Throws:
      org.apache.maven.api.plugin.MojoException - if the fragment does not exist or cannot be deleted
    • regenerateIndex

      public static void regenerateIndex(File orgRoot) throws org.apache.maven.api.plugin.MojoException
      Regenerate src/site/asciidoc/index.adoc from all fragments in the projects/ directory.

      Registered projects are split into two sections: foundation members (see FOUNDATION, rendered in parent-tier order) and everything else (the examples, rendered alphabetically). The index preamble and section intros are embedded here as a template.

      Parameters:
      orgRoot - root of the cloned org repository
      Throws:
      org.apache.maven.api.plugin.MojoException - if fragments cannot be read or index cannot be written
    • regenerateSiteXml

      public static void regenerateSiteXml(File orgRoot) throws org.apache.maven.api.plugin.MojoException
      Regenerate the <menu> blocks in the org-site's src/site/site.xml from the same fragment-list that drives the index body — eliminating the drift class where the landing-page body is auto-current but the left-nav is a stale hand-maintained snapshot (IKE-Network/ike-issues#520).

      Three menu blocks are rewritten in place:

      • <menu name="Foundation"> — entries in FOUNDATION order, intersected with the fragments actually present on disk.
      • <menu name="Examples"> — fragments not in FOUNDATION, in alphabetical order.
      • <menu name="Source"> — foundation + examples, pointing at GitHub repo URLs.

      Everything else in site.xml — skin coordinates, banners, breadcrumbs, custom block, the licence comment — is preserved by find-and-replace on each labelled menu block.

      No-op when src/site/site.xml is absent. Called from registerProject(File, Log, String, String, String, String, String, String, String, String, String, String, List) and deregisterProject(Log, String, String, String, String, String) after regenerateIndex(File); the body and left-nav update in the same registration step.

      Parameters:
      orgRoot - root of the cloned org repository
      Throws:
      org.apache.maven.api.plugin.MojoException - if the descriptor cannot be read or written
    • renderToXhtml

      public static void renderToXhtml(File orgRoot, org.apache.maven.api.plugin.Log log) throws org.apache.maven.api.plugin.MojoException
      Render the master index AsciiDoc to XHTML using AsciidoctorJ in-process.

      Output is placed in target/generated-site/xhtml/index.xhtml within the org repo clone. The Maven site plugin picks this up via <generatedSiteDirectory>.

      Parameters:
      orgRoot - root of the cloned org repository
      log - Maven logger
      Throws:
      org.apache.maven.api.plugin.MojoException - if rendering fails
    • buildSite

      public static void buildSite(File orgRoot, org.apache.maven.api.plugin.Log log) throws org.apache.maven.api.plugin.MojoException
      Build the org site by invoking mvn site in the cloned org repo. Output lands at target/site/.

      Note: only site is invoked, not site:stage. site:stage requires <distributionManagement> in the project pom to compute relative paths; the org-site source pom intentionally omits it because the org site has no Nexus deployment target — it ships only as static HTML to the publish repo. mvn site alone produces the rendered target/site/ tree that publishToPubRepo then ships.

      Parameters:
      orgRoot - root of the cloned org repository
      log - Maven logger
      Throws:
      org.apache.maven.api.plugin.MojoException - if the build fails
    • publishToGhPages

      public static void publishToGhPages(File orgRoot, String repoUrl, org.apache.maven.api.plugin.Log log) throws org.apache.maven.api.plugin.MojoException
      Publish the staged site to the gh-pages branch using the same orphan-commit-force-push pattern as ReleaseSupport.
      Parameters:
      orgRoot - root of the cloned org repository
      repoUrl - git remote URL for force-push
      log - Maven logger
      Throws:
      org.apache.maven.api.plugin.MojoException - if publishing fails
    • cloneOrgRepo

      public static File cloneOrgRepo(String repoUrl, String branch, org.apache.maven.api.plugin.Log log) throws org.apache.maven.api.plugin.MojoException
      Shallow-clone the org site repository into a temporary directory.
      Parameters:
      repoUrl - git remote URL
      branch - branch to clone
      log - Maven logger
      Returns:
      the cloned directory
      Throws:
      org.apache.maven.api.plugin.MojoException - if cloning fails
    • commitAndPush

      public static void commitAndPush(File orgRoot, String message, String branch, org.apache.maven.api.plugin.Log log) throws org.apache.maven.api.plugin.MojoException
      Commit all changes in the org repo and push to the remote.
      Parameters:
      orgRoot - root of the cloned org repository
      message - commit message
      branch - branch to push
      log - Maven logger
      Throws:
      org.apache.maven.api.plugin.MojoException - if commit or push fails
    • registerProject

      public static void registerProject(File callerGitRoot, org.apache.maven.api.plugin.Log log, String srcRepoUrl, String pubRepoUrl, String srcBranch, String pubBranch, String artifactId, String name, String description, String version, String siteUrl, String githubUrl, List<String> modules) throws org.apache.maven.api.plugin.MojoException
      Run the full registration workflow on a two-repo org-site layout (#367):
      1. Clone the SOURCE repo (srcRepoUrl) — has the Maven pom and src/site/ tree.
      2. Write the per-project fragment into projects/&lt;artifactId&gt;.adoc.
      3. Regenerate the master index from all fragments.
      4. Render the index AsciiDoc to XHTML (for doxia).
      5. Run mvn site to produce target/site/.
      6. Commit + push the source repo so the fragment + index are persisted.
      7. Publish target/site/ to the PUBLISH repo (pubRepoUrl) by cloning, wiping non-Git contents, copying the build output, committing, and pushing.

      Pre-#367 this method assumed a single repo for both roles and ran mvn site inside a repo that had no pom — which silently failed every release that tried to auto-update the landing page. The two-repo split mirrors the README in IKE-Network.github.io and the manual flow operators have been using all along.

      Parameters:
      callerGitRoot - git root of the calling project
      log - Maven logger
      srcRepoUrl - git URL of the source repo (has pom)
      pubRepoUrl - git URL of the publish repo (rendered HTML)
      srcBranch - branch in the source repo
      pubBranch - branch in the publish repo
      artifactId - Maven artifact ID
      name - human-readable project name
      description - project description
      version - release version
      siteUrl - public site URL
      githubUrl - GitHub repository URL
      modules - reactor module names
      Throws:
      org.apache.maven.api.plugin.MojoException - if any step fails
    • deregisterProject

      public static void deregisterProject(org.apache.maven.api.plugin.Log log, String srcRepoUrl, String pubRepoUrl, String srcBranch, String pubBranch, String artifactId) throws org.apache.maven.api.plugin.MojoException
      Run the full deregistration workflow against the two-repo org-site layout (#367 — mirror of registerProject(File, Log, String, String, String, String, String, String, String, String, String, String, List)).
      Parameters:
      log - Maven logger
      srcRepoUrl - git URL of the source repo (has pom)
      pubRepoUrl - git URL of the publish repo (rendered HTML)
      srcBranch - branch in the source repo
      pubBranch - branch in the publish repo
      artifactId - artifact ID to deregister
      Throws:
      org.apache.maven.api.plugin.MojoException - if any step fails
    • publishToPubRepo

      public static void publishToPubRepo(File srcRoot, String pubRepoUrl, String pubBranch, String artifactId, String version, org.apache.maven.api.plugin.Log log) throws org.apache.maven.api.plugin.MojoException
      Publish the target/site/ contents from a freshly- built source repo to a separate publish repo.

      Clones the publish repo at pubBranch, wipes every file/directory except .git/, copies the entire target/site/ tree into the clone root, commits with a descriptive message, and pushes. Because the source build emits .nojekyll and CNAME (from src/site/resources/), those land naturally — no special preservation needed.

      Replaces the pre-#367 publishToGhPages flow, which pushed to a gh-pages branch of the SAME repo as the source. The new flow correctly addresses the IKE-Network org-site layout where source and publish live in different repos and the publish repo serves from main.

      Parameters:
      srcRoot - the source repo with target/site/ built
      pubRepoUrl - git URL of the publish repo
      pubBranch - branch to push to (typically main)
      artifactId - for the commit message
      version - for the commit message
      log - Maven logger
      Throws:
      org.apache.maven.api.plugin.MojoException - if any step fails