Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,20 @@ jobs:

steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Set up JDK 8
- name: Set up JDK 21
uses: actions/setup-java@17f84c3641ba7b8f6deff6309fc4c864478f5d62 # v3.14.1
with:
java-version: '8'
java-version: '21'
distribution: 'temurin'
cache: maven
- name: maven-settings-xml-action
run: echo "<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd\"> <activeProfiles> <activeProfile>github</activeProfile> </activeProfiles> <profiles> <profile> <id>github</id> <repositories> <repository> <id>central-repo</id> <url>https://repo.maven.apache.org/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central-plugin-repository</id> <url>https://repo.maven.apache.org/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <servers/> <mirrors/> <pluginGroups/> </settings>" > ~/.m2/settings.xml
# CI runs with -Pno-fetch: skip the live GitHub + Whimsy retrieval so that
# anonymous rate-limiting on shared GH Actions egress IPs cannot make the
# validation build flaky. The ASF BuildBot does the live fetch when it
# publishes to asf-site.
- name: Build with Maven
run: mvn help:system -U -ntp --batch-mode --show-version --fail-at-end clean install
run: mvn help:system -U -ntp --batch-mode --show-version --fail-at-end -Pno-fetch clean install
- name: basic validations
run: |
[ -f target/opennlp-site/index.html ] && echo 'index.html exist'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ target
.project
*.log
*.iml
tmp
63 changes: 60 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,73 @@ Welcome to OpenNLP Site Source Code
[![Build Status](https://github.com/apache/opennlp/workflows/Java%20CI/badge.svg)](https://github.com/apache/opennlp-site/actions)
[![Stack Overflow](https://img.shields.io/badge/stack%20overflow-opennlp-f1eefe.svg)](https://stackoverflow.com/questions/tagged/opennlp)

#### Requirements

- Java 21
- Maven 3.6.3+

#### Build

```bash
mvn clean install
```

#### Test Site locally - starts a web server on Port 8080
The output is rendered to `target/opennlp-site/`. Open `target/opennlp-site/index.html` in a browser to preview.

#### Live dev mode

```bash
mvn clean package jbake:inline -Djbake.port=8080 -Djbake.listenAddress=0.0.0.0
mvn compile -Pserve # http://localhost:8080/
mvn compile -Pserve -Djbake.port=9000 # custom port
```

Bakes the site once, then serves `target/opennlp-site/` over HTTP and watches `src/main/jbake/` recursively. Any change to a content file, template, asset or `jbake.properties` triggers a re-bake (debounced ~400 ms); reload the browser to see it. Press Ctrl-C to stop.

The contributor fetch (Whimsy + GitHub) runs once at startup and is reused across re-bakes — no re-fetch and no new rate-limit cost while you iterate. Cached HTTP responses live under `target/contrib-cache/`. Restart `mvn compile -Pserve` to refresh the contributor data.

#### Live contributor data

The team page (`team.html`) is populated at build time by the `org.apache.opennlp.website.Site` driver, which fetches:

- the OpenNLP committer/PMC roster from [Whimsy LDAP exports](https://whimsy.apache.org/public/), and
- live contributor + activity data from the GitHub REST API across `apache/opennlp`, `apache/opennlp-site`, `apache/opennlp-addons` and `apache/opennlp-sandbox`.

It then partitions members into **Active Team** (any activity in the last 2 years), **Emeritus** (committer/PMC with no recent activity) and a **Wall of Fame** (everyone else with a GitHub login — committers/PMCs aren't repeated here). Identity merging (login + apache id + email + normalized name) and bot filtering match the logic of the `opennlp-stats` reference tool.

HTTP responses are cached on disk under `target/contrib-cache/` with a 6-hour TTL, so iterative local builds are cheap. The build runs without a GitHub token; anonymous rate limits (60 req/h) may leave a few `/users/{login}` lookups unresolved on a cold cache, which can drop a committer whose GitHub login differs from their Apache id into Emeritus until the cache warms. Re-running the build inside the TTL fills it in.

##### Manual roster overrides

Whimsy doesn't always carry `githubUsername` for committers, and the live `/users/{login}` bridge can hit anonymous rate limits, so `src/main/resources/team-overrides.properties` lets you pin attributes per Apache id. The file is read at build time and merged on top of the Whimsy + GitHub data.

| Key | Meaning |
| --- | --- |
| `<apacheId>.gh` | One or more `;`-separated GitHub logins. The first is used for the card link and avatar; the rest are merged into the same record so their commits/PRs/comments roll up. |
| `<apacheId>.status` | `active` or `emeritus`. Forces the section bucket regardless of what the live activity check says. |
| `<apacheId>.chair` | `true` for the current PMC chair. Renders an extra orange `Chair` badge on the card and adds the chair entry to the legend. |

Example:

```properties
jzemerick.gh = jzonthemtn
jzemerick.status = active
jzemerick.chair = true

joern.gh = kottmann
joern.status = active
```

##### Skipping the live fetch (offline / restricted CI)

If the build environment can't reach `api.github.com` or `whimsy.apache.org` — corporate proxy, blocked CI runner, demo build — skip the retrieval entirely:

```bash
mvn compile -Pno-fetch # Maven profile
OPENNLP_SITE_NO_FETCH=1 mvn compile # env var (any non-empty truthy value)
```

The team page renders with empty Active/Emeritus/Wall-of-Fame sections (each shows a "No contributors to show." placeholder); the rest of the site builds normally.

#### Build Bot

Website is build via ASF BuildBot. You find it [here](https://ci.apache.org/).
Website is built via ASF BuildBot. You find it [here](https://ci.apache.org/).
189 changes: 146 additions & 43 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>

<groupId>org.apache.opennlp</groupId>
<artifactId>opennlp-site</artifactId>
Expand All @@ -32,66 +31,104 @@
<properties>
<!-- Build Properties -->
<jbake-core.version>2.6.7</jbake-core.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.version>3.3.9</maven.version>
<maven.compiler.release>21</maven.compiler.release>
<maven.version>3.6.3</maven.version>
<asciidoctor.version>2.5.10</asciidoctor.version>
<freemarker.version>2.3.32</freemarker.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<!-- JBake itself; we drive it programmatically from Site.java -->
<dependency>
<groupId>org.jbake</groupId>
<artifactId>jbake-core</artifactId>
<version>${jbake-core.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Freemarker templates (.ftl) -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
</dependency>
<!-- AsciiDoc rendering (.ad) -->
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>${asciidoctor.version}</version>
</dependency>
<!-- JBake 2.6 demoted these to runtime scope, but Site.java touches the API directly -->
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.10</version>
</dependency>
<!-- Pinned to 3.0.37 because JBake 2.6.7 hard-codes admin/admin to open the embedded
"cache" database. OrientDB 3.2 disabled those default credentials and JBake's
ContentStore.startup fails with OSecurityAccessException, aborting the bake. -->
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-core</artifactId>
<version>3.0.37</version>
</dependency>
<!-- OrientDB 3.0.37 transitively pulls JNA 4.5.0, which ships only i386/x86_64 native
stubs. 5.13.0 adds arm64-darwin so the build runs on Apple Silicon. -->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.13.0</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.13.0</version>
</dependency>
<!-- JSON parsing for the GitHub + Whimsy clients in contributors/ -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20240303</version>
</dependency>
</dependencies>

<build>
<finalName>opennlp-site</finalName>

<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.13.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<release>${maven.compiler.release}</release>
</configuration>
</plugin>
</plugin>
<plugin>
<groupId>org.jbake</groupId>
<artifactId>jbake-maven-plugin</artifactId>
<version>0.3.5</version>

<!-- dependencies -->
<dependencies>
<!-- optional : a jbake version -->
<dependency>
<groupId>org.jbake</groupId>
<artifactId>jbake-core</artifactId>
<version>${jbake-core.version}</version>
</dependency>
<!-- for freemarker templates (.ftl) -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
</dependency>
<!-- for ascii doc format (.ad) -->
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>${asciidoctor.version}</version>
</dependency>
<!-- Overriding orientdb, required to work on Apple Silicon (M1,..) -->
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-core</artifactId>
<version>3.1.16</version>
</dependency>

</dependencies>

<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>default-generate</id>
<id>opennlp-site</id>
<phase>compile</phase>
<goals>
<goal>generate</goal>
<goal>java</goal>
</goals>
<configuration>
<includeProjectDependencies>true</includeProjectDependencies>
<mainClass>org.apache.opennlp.website.Site</mainClass>
<arguments>
<argument>${project.basedir}/src/main/jbake</argument>
<argument>${project.build.directory}/${project.build.finalName}</argument>
<argument>${project.build.directory}/jbake-staged</argument>
<argument>${project.build.directory}/contrib-cache</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -632,4 +669,70 @@
</plugins>
</build>

<profiles>
<!-- mvn compile -Pserve -> bake once, serve target/opennlp-site/ on http://localhost:${jbake.port}/,
and re-bake whenever something under src/main/jbake/ changes. -->
<profile>
<id>serve</id>
<properties>
<jbake.port>8080</jbake.port>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>opennlp-site</id>
<configuration>
<arguments>
<argument>${project.basedir}/src/main/jbake</argument>
<argument>${project.build.directory}/${project.build.finalName}</argument>
<argument>${project.build.directory}/jbake-staged</argument>
<argument>${project.build.directory}/contrib-cache</argument>
<argument>--serve</argument>
<argument>--port=${jbake.port}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<!-- mvn compile -Pno-fetch -> skip the live GitHub + Whimsy retrieval entirely.
Use this when network egress to api.github.com / whimsy.apache.org is blocked
(corporate proxy, restricted CI runner, offline build). The team page renders
with empty Active/Emeritus/Wall-of-Fame sections; everything else builds
normally. The same can be triggered with -DopennlpSiteNoFetch=true or by
exporting OPENNLP_SITE_NO_FETCH=1 in the build environment. -->
<profile>
<id>no-fetch</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>opennlp-site</id>
<configuration>
<arguments>
<argument>${project.basedir}/src/main/jbake</argument>
<argument>${project.build.directory}/${project.build.finalName}</argument>
<argument>${project.build.directory}/jbake-staged</argument>
<argument>${project.build.directory}/contrib-cache</argument>
<argument>--no-fetch</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Loading
Loading