diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..9dd76d4 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,46 @@ +# Agent guide for plexus-xml 3.x + +`org.codehaus.plexus:plexus-xml` 3.x holds `Xpp3Dom`, `Xpp3DomBuilder`, `Xpp3DomWriter` and the XML pull parser as +they were in `plexus-utils` 3, and is the line for Maven 3 (it also works under Maven 4). It lives on the `3.x` +branch; `master` builds `4.x`, which needs Java 17 and works only under Maven 4. This line has no dependencies and +targets Java 8. + +## Build and test + +- Build with `mvn verify` on JDK 17 or later; the parent POM sets the Java release to 8 and the minimum Maven version + to 3.9.0. +- CI runs `.github/workflows/maven.yml` on every push and pull request. It calls the shared Plexus build workflow, + which runs `mvn verify javadoc:javadoc` on Linux, Windows and macOS with several JDKs, including 8. The deploy job + it also calls is limited to pushes to `3.x`. +- `.github/workflows/release-drafter.yml` drafts the release notes of this line from the labels of merged pull + requests, with `.github/release-drafter-3.x.yml`; label every pull request. +- Unit tests use JUnit 5 and run through Surefire with `childDelegation` on, so the test classes are used, not + Surefire's own `plexus-utils`. There are many test files, so iterate with targeted tests. +- The JAR sets `Automatic-Module-Name: org.codehaus.plexus.util.xml`, the same name as `4.x`; keep that name stable. +- Run `mvn spotless:apply` on JDK 17 to 21 before pushing; it also formats Markdown, except `src/site/markdown`. +- Keep public API compatible: Maven 3 consumers rely on this line. No new dependencies. + +## Fixes that belong to both lines + +- A fix for a class that exists in both `3.x` and `4.x` goes to `master` first and is ported here, or the reverse; + say in the pull request which one it is the twin of. +- `plexus-utils` 3 still bundles its own copy of these classes, so a fix to `MXParser`, `Xpp3Dom` or another XML + class here usually also needs a port to the `plexus-utils-3.x` branch of + [plexus-utils](https://github.com/codehaus-plexus/plexus-utils). The surrogate-pair fix in `MXParser` (3.1.1 here, + 3.6.4 there) is such a pair. +- A change that depends on `maven-api-xml`, or on Java 17, does not come here. + +## 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. + +- Behaviour of a public class in `org.codehaus.plexus.util.xml` or `...xml.pull`: its Javadoc, which is the + reference. +- The release line, the Java or Maven requirement, or the coordinates: `README.md`. +- `src/site/markdown/index.md` is the only site page, listed as Introduction in `src/site/site.xml` together with the + Javadoc. The site is published from `master` only, so keep this page consistent with the `master` one. +- A fix that also lands on `master` (or the other way round) updates the documentation of both lines in the same + step, so the `README.md` and Javadoc of the two lines never contradict each other. +- A new convention, build gate or test fixture: this file. + diff --git a/README.md b/README.md index 0e33110..6dc1e1a 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,91 @@ -Plexus-Xml -========== +# Plexus XML 3.x -[![Build Status](https://github.com/codehaus-plexus/plexus-xml/actions/workflows/maven.yml/badge.svg)](https://github.com/codehaus-plexus/plexus-xml/actions) -[![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-xml.svg?label=Maven%20Central&versionPrefix=3.)](https://search.maven.org/artifact/org.codehaus.plexus/plexus-xml) +[![Maven Central 3.x](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-xml.svg?label=Maven%20Central%203.x&versionPrefix=3.)](https://central.sonatype.com/artifact/org.codehaus.plexus/plexus-xml/versions) +[![GitHub CI](https://github.com/codehaus-plexus/plexus-xml/actions/workflows/maven.yml/badge.svg?branch=3.x)](https://github.com/codehaus-plexus/plexus-xml/actions/workflows/maven.yml?query=branch%3A3.x) -This library consists of XML classes (`org.codehaus.plexus.util.xml`) that have been extracted from [`plexus-utils`](https://github.com/codehaus-plexus/plexus-utils/) 3: +This is the `3.x` line of Plexus XML, the XML classes that [`plexus-utils`](https://github.com/codehaus-plexus/plexus-utils) +shipped up to its 3.x line, in the packages `org.codehaus.plexus.util.xml` and `org.codehaus.plexus.util.xml.pull`. +`plexus-utils` 4 no longer contains them, so `plexus-utils` 3 = `plexus-utils` 4 + `plexus-xml` 3. The library has +no dependencies. -> `plexus-utils` 3 = `plexus-utils` 4 + `plexus-xml` 3. +The library provides the following classes: -For publishing [the site](https://codehaus-plexus.github.io/plexus-xml/) do the following: +- `Xpp3Dom`, `Xpp3DomBuilder`, `Xpp3DomWriter` and `Xpp3DomUtils`, a small XML document model with its parser, + writer and merge helpers. +- `XmlPullParser` and its implementation `MXParser`, and `XmlSerializer` and its implementation `MXSerializer`. +- `XmlStreamReader` and `XmlStreamWriter`, which detect the encoding of an XML stream. +- `XMLWriter`, `PrettyPrintXMLWriter` and `CompactXMLWriter`, plus the helpers `XmlUtil` and `XmlWriterUtil`. +## Status + +This branch receives bug fixes, not new features. The `3.x` line is the one to use when your code runs in Maven 3, or +in both Maven 3 and Maven 4. The `4.x` line, built from `master`, is rebuilt on Maven 4's `maven-api-xml` and works +only under Maven 4: Maven 3 exports its own `Xpp3Dom` class to plugins, and that class lacks the constructor that +`Xpp3DomBuilder` 4.x calls. The [`master` README](https://github.com/codehaus-plexus/plexus-xml/blob/master/README.md) +explains the choice in full. + +If upgrading `plexus-utils` from 3 to 4 gave you a `NoClassDefFoundError` on `Xpp3Dom` and you don't target Maven 4, +add this line. + +A defect in `MXParser` or `Xpp3Dom` often exists in the copy that `plexus-utils` 3 still bundles, so a fix here often +needs a matching change on its `plexus-utils-3.x` branch, and the other way round. + +## Using it + +```xml + + org.codehaus.plexus + plexus-xml + 3.1.1 + ``` -mvn -Preporting verify site site:stage scm-publish:publish-scm + +3.1.1 is the latest `3.x` release; the badge above shows the current one. + +## Requirements + +Java 8 or later. The JAR sets the automatic module name `org.codehaus.plexus.util.xml`, the same name as the `4.x` +line. Building the project needs Maven 3.9.0 or later. + +## Documentation + +- [Javadoc](https://javadoc.io/doc/org.codehaus.plexus/plexus-xml/3.1.1) +- [Release notes](https://github.com/codehaus-plexus/plexus-xml/releases) + +The [project site](https://codehaus-plexus.github.io/plexus-xml/) is published from `master` only and describes +`4.x`. Publishing it from this branch would replace it, so do not. + +## Building + +```shell +mvn verify +``` + +A local build formats the sources with Spotless. CI only checks the format and fails on unformatted code, so run +`mvn spotless:apply` on JDK 17 to 21 and commit the result. + +## Releasing + +Releases of this line are cut from the `3.x` branch the same way as from `master`; the steps and the one-time setup +are in [RELEASING.md](https://github.com/codehaus-plexus/.github/blob/master/RELEASING.md): + +```shell +mvn release:prepare release:perform ``` +The release drafter keeps a separate draft for this branch: edit that one, and publish it without marking it the +latest release. Skip the site. + +## Contributing + +Conventions for contributors and agents are in [AGENTS.md](AGENTS.md); see also +[CONTRIBUTING.md](https://github.com/codehaus-plexus/.github/blob/master/CONTRIBUTING.md). Open pull requests +against `3.x`, and report bugs in the [issue tracker](https://github.com/codehaus-plexus/plexus-xml/issues). + +Report security vulnerabilities privately, as described in +[SECURITY.md](https://github.com/codehaus-plexus/.github/blob/master/SECURITY.md), not in a public issue. + +## License + +Plexus XML is licensed under the +[Apache License, Version 2.0](https://github.com/codehaus-plexus/plexus-xml/blob/3.x/LICENSE.txt). diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md new file mode 100644 index 0000000..52c6419 --- /dev/null +++ b/src/site/markdown/index.md @@ -0,0 +1,9 @@ +## Plexus XML Utilities + +A collection of various utility classes to ease working with XML in Maven 3. + +This is the `3.x` line. It requires Java 8 or later and has no dependencies. Its XML classes (in +`org.codehaus.plexus.util.xml` and `org.codehaus.plexus.util.xml.pull`) are the ones that +[`plexus-utils`](https://github.com/codehaus-plexus/plexus-utils) 3 bundles, extracted into their own library. See the +[README](https://github.com/codehaus-plexus/plexus-xml/tree/3.x#readme) for when to use it. The +[Javadoc](./apidocs/index.html) is the reference for the classes.