Class OrgSiteSupport
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 TypeMethodDescriptionstatic voidBuild the org site by invokingmvn sitein the cloned org repo.static FilecloneOrgRepo(String repoUrl, String branch, org.apache.maven.api.plugin.Log log) Shallow-clone the org site repository into a temporary directory.static voidcommitAndPush(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 voiddeleteFragment(File orgRoot, String artifactId) Delete a project registration fragment.static voidderegisterProject(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 ofregisterProject(File, Log, String, String, String, String, String, String, String, String, String, String, List)).static voidpublishToGhPages(File orgRoot, String repoUrl, org.apache.maven.api.plugin.Log log) Publish the staged site to thegh-pagesbranch using the same orphan-commit-force-push pattern asReleaseSupport.static voidpublishToPubRepo(File srcRoot, String pubRepoUrl, String pubBranch, String artifactId, String version, org.apache.maven.api.plugin.Log log) Publish thetarget/site/contents from a freshly- built source repo to a separate publish repo.static voidregenerateIndex(File orgRoot) Regeneratesrc/site/asciidoc/index.adocfrom all fragments in theprojects/directory.static voidregenerateSiteXml(File orgRoot) Regenerate the<menu>blocks in the org-site'ssrc/site/site.xmlfrom 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 voidregisterProject(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 intoprojects/<artifactId>.adoc. Regenerate the master index from all fragments. Render the index AsciiDoc to XHTML (for doxia). Runmvn siteto producetarget/site/. Commit + push the source repo so the fragment + index are persisted. Publishtarget/site/to the PUBLISH repo (pubRepoUrl) by cloning, wiping non-Git contents, copying the build output, committing, and pushing.static voidrenderToXhtml(File orgRoot, org.apache.maven.api.plugin.Log log) Render the master index AsciiDoc to XHTML using AsciidoctorJ in-process.static voidwriteFragment(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.
-
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 repositoryartifactId- Maven artifact ID (used as filename)name- human-readable project namedescription- one-line project descriptionversion- release version (not SNAPSHOT)siteUrl- public site URL (e.g., https://ike.network/ike-pipeline/)githubUrl- GitHub repository URLmodules- 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 repositoryartifactId- Maven artifact ID (filename without extension)- Throws:
org.apache.maven.api.plugin.MojoException- if the fragment does not exist or cannot be deleted
-
regenerateIndex
Regeneratesrc/site/asciidoc/index.adocfrom all fragments in theprojects/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
Regenerate the<menu>blocks in the org-site'ssrc/site/site.xmlfrom 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 inFOUNDATIONorder, intersected with the fragments actually present on disk.<menu name="Examples">— fragments not inFOUNDATION, 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.xmlis absent. Called fromregisterProject(File, Log, String, String, String, String, String, String, String, String, String, String, List)andderegisterProject(Log, String, String, String, String, String)afterregenerateIndex(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.xhtmlwithin the org repo clone. The Maven site plugin picks this up via<generatedSiteDirectory>.- Parameters:
orgRoot- root of the cloned org repositorylog- 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 invokingmvn sitein the cloned org repo. Output lands attarget/site/.Note: only
siteis invoked, notsite:stage.site:stagerequires<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 sitealone produces the renderedtarget/site/tree that publishToPubRepo then ships.- Parameters:
orgRoot- root of the cloned org repositorylog- 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 thegh-pagesbranch using the same orphan-commit-force-push pattern asReleaseSupport.- Parameters:
orgRoot- root of the cloned org repositoryrepoUrl- git remote URL for force-pushlog- 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 URLbranch- branch to clonelog- 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 repositorymessage- commit messagebranch- branch to pushlog- 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):- Clone the SOURCE repo (
srcRepoUrl) — has the Maven pom and src/site/ tree. - Write the per-project fragment into
projects/<artifactId>.adoc. - Regenerate the master index from all fragments.
- Render the index AsciiDoc to XHTML (for doxia).
- Run
mvn siteto producetarget/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.
Pre-#367 this method assumed a single repo for both roles and ran
mvn siteinside 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 projectlog- Maven loggersrcRepoUrl- git URL of the source repo (has pom)pubRepoUrl- git URL of the publish repo (rendered HTML)srcBranch- branch in the source repopubBranch- branch in the publish repoartifactId- Maven artifact IDname- human-readable project namedescription- project descriptionversion- release versionsiteUrl- public site URLgithubUrl- GitHub repository URLmodules- reactor module names- Throws:
org.apache.maven.api.plugin.MojoException- if any step fails
- Clone the SOURCE repo (
-
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 ofregisterProject(File, Log, String, String, String, String, String, String, String, String, String, String, List)).- Parameters:
log- Maven loggersrcRepoUrl- git URL of the source repo (has pom)pubRepoUrl- git URL of the publish repo (rendered HTML)srcBranch- branch in the source repopubBranch- branch in the publish repoartifactId- 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 thetarget/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 entiretarget/site/tree into the clone root, commits with a descriptive message, and pushes. Because the source build emits.nojekyllandCNAME(fromsrc/site/resources/), those land naturally — no special preservation needed.Replaces the pre-#367
publishToGhPagesflow, which pushed to agh-pagesbranch 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 frommain.- Parameters:
srcRoot- the source repo withtarget/site/builtpubRepoUrl- git URL of the publish repopubBranch- branch to push to (typicallymain)artifactId- for the commit messageversion- for the commit messagelog- Maven logger- Throws:
org.apache.maven.api.plugin.MojoException- if any step fails
-