diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..1d60eebc --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,38 @@ +# Agent guide for plexus-classworlds + +`org.codehaus.plexus:plexus-classworlds` (`bundle` packaging) is the classloader framework Maven +starts with: realms form a graph that imports specific packages from one another, and the launcher +builds those realms from a configuration file before invoking an application's `main`. +`COMPATIBILITY.md` explains why the legacy `org.codehaus.classworlds` classes must stay for Sisu's +`ClassRealmConverter`; treat that as a binary contract, not dead code. Requires Java 8 or later +(`javaVersion` 8 from the `plexus` parent), and the JAR sets +`Automatic-Module-Name: org.codehaus.plexus.classworlds`; keep that name stable. + +## Build and test + +- `mvn verify` builds. CI calls the shared `codehaus-plexus/.github` build workflow (default + `mvn verify javadoc:javadoc`, on the shared JDK and operating system matrix) and then the shared + deploy workflow. +- Run `mvn spotless:apply` on JDK 17 to 21 before pushing, or the formatting check fails. +- Unit tests use JUnit 5. Surefire enables assertions (`-ea`) only for `org.codehaus.classworlds` + and `org.codehaus.plexus.classworlds`, uses `forkCount` 1 and redirects test output to files; do + not drop those settings. +- `maven-dependency-plugin` copies Ant, log4j-api and jakarta.xml.bind-api test fixtures in + `generate-test-resources`; keep those items when adding tests that depend on them. +- The configuration files and JARs under `src/test/test-data` are test fixtures that tests read by + name; do not tidy them as documentation. + +## Documentation updates + +A change that users or contributors can notice ships with the documentation it affects, in the +same pull request. A refactor with no visible effect needs none. + +- Realm or `ClassWorld` API behavior: its Javadoc, and `src/site/markdown/apiusage.md`. This includes + which packages and classes a realm sees through imports and its parent. +- Launcher configuration syntax or startup behavior: `src/site/markdown/launcher.md`. +- The overview, or the legacy `org.codehaus.classworlds` layer: `src/site/markdown/index.md` and + `COMPATIBILITY.md`; keep the Backward Compatibility section of `README.md` in step. +- A page added or removed: the menu in `src/site/site.xml`. +- The Java requirement, or how to build and release: `README.md`. +- A new convention, build gate or test fixture: this file. + diff --git a/README.md b/README.md index 75b664dd..1a9daba4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Plexus Classworlds [![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-classworlds.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/org.codehaus.plexus/plexus-classworlds) -[![GitHub CI](https://github.com/codehaus-plexus/plexus-classworlds/workflows/GitHub%20CI/badge.svg)](https://github.com/codehaus-plexus/plexus-classworlds/actions) +[![GitHub CI](https://github.com/codehaus-plexus/plexus-classworlds/actions/workflows/maven.yml/badge.svg?branch=master)](https://github.com/codehaus-plexus/plexus-classworlds/actions/workflows/maven.yml?query=branch%3Amaster) [![Reproducible Builds](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/jvm-repo-rebuild/reproducible-central/master/content/org/codehaus/plexus/plexus-classworlds/badge.json)](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/codehaus/plexus/plexus-classworlds/README.md) [![License](https://img.shields.io/github/license/codehaus-plexus/plexus-classworlds.svg?label=License)](https://www.apache.org/licenses/LICENSE-2.0) @@ -59,8 +59,9 @@ and what is required before any future removal can be considered. ## Contributing -See [CONTRIBUTING.md](https://github.com/codehaus-plexus/.github/blob/master/CONTRIBUTING.md). In short: -`mvn verify` builds, and run `mvn spotless:apply` before pushing or CI will fail on formatting. +See [CONTRIBUTING.md](https://github.com/codehaus-plexus/.github/blob/master/CONTRIBUTING.md) and +[AGENTS.md](AGENTS.md). In short: `mvn verify` builds, and run `mvn spotless:apply` before pushing or CI +will fail on formatting. Please report security vulnerabilities privately — see [SECURITY.md](https://github.com/codehaus-plexus/.github/blob/master/SECURITY.md), not a public issue. diff --git a/src/site/markdown/apiusage.md b/src/site/markdown/apiusage.md index 6cfbacc1..f680e7f8 100644 --- a/src/site/markdown/apiusage.md +++ b/src/site/markdown/apiusage.md @@ -57,6 +57,11 @@ logComponentRealm.importFrom( "container", ``` +Package lookups follow the same import rules as class loading. A realm reports a package through +`Package.getPackage( name )` and its own `getPackages()` when the package is imported from another realm +or from the parent class loader, including a package that is reached only by importing one of its +classes by name. A package is never visible in a realm where a class in it is not. + The container implementation can then be loaded from its realm and used.