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
45 changes: 45 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Agent guide for modello

Modello (`org.codehaus.modello:modello`, `pom` packaging, inheriting the `plexus` parent) is a
code-generation framework: one `.mdo` model produces Java classes, readers and writers for XML, YAML
and JSON, an XSD and documentation; Maven uses it for its own POM and `settings.xml` models. The
reactor has `modello-core`, `modello-maven-plugin`, `modello-plugins` (one module per generator),
`modello-test` and `modello-ant-task`. It is MIT-licensed, unlike most Codehaus Plexus projects.

## Build and test

- `mvn verify` builds and runs the unit tests. The invoker integration tests of
`modello-maven-plugin` run only under `-Prun-its`.
- Run `mvn spotless:apply` on JDK 17 to 21 before pushing; CI fails on formatting otherwise.
- The code targets Java 8 (`javaVersion` 8 from the `plexus` parent), and the plugin's
`prerequisites` require Maven 3.9.0. `mavenVersion` pins the Maven 3.9 line that the plugin and
core are built against, so keep it on 3.9.x.
- CI calls the shared `codehaus-plexus/.github` build workflow with
`verify javadoc:javadoc -Prun-its`, on the shared JDK and operating system matrix.
- The plugin tests compile the generator output together with the classes in
`src/test/verifiers`; `modello-plugins/README.md` explains that layout.
- `src/main/mdo/modello.mdo` describes the model descriptor format. The `reporting` profile renders
it into `modello.html` on the site, so change it together with the code that implements the format.

## 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.

- A goal added, renamed or removed in `modello-maven-plugin`: the goal list in
`modello-maven-plugin/src/site/markdown/index.md`, and `usage.md` or the example page if the
recommended configuration changes. Examples show the plugin version as
`<version><!-- latest release --></version>` on the first declaration of `usage.md` and no version
elsewhere; the pages are plain Markdown, not Velocity templates.
- A parameter added or changed on a goal: its Javadoc, which is the goal page. Document the default,
the property name and `@since`.
- A generator changed or added in `modello-plugins`: that module's `src/site/markdown/index.md`
and its `src/site/site.xml`.
- A model attribute or generated API that needs a change in users' models: `modello.mdo`, and
`src/site/markdown/migration-guide.md` when it breaks existing models.
- Location tracking behavior: `src/site/markdown/location-tracking.md`.
- Ant task attributes or goals: `modello-ant-task/README.md`.
- The Java or Maven requirement, or how to build and release: `README.md`.
- A new convention, build gate or test fixture: this file, or `modello-plugins/README.md` for the
verifier layout.

21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Modello

[![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.modello/modello-maven-plugin.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/org.codehaus.modello/modello-maven-plugin)
[![GitHub CI](https://github.com/codehaus-plexus/modello/workflows/GitHub%20CI/badge.svg)](https://github.com/codehaus-plexus/modello/actions)
[![GitHub CI](https://github.com/codehaus-plexus/modello/actions/workflows/maven.yml/badge.svg?branch=master)](https://github.com/codehaus-plexus/modello/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/modello/badge.json)](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/codehaus/modello/README.md)
[![MIT License](https://img.shields.io/github/license/codehaus-plexus/modello.svg?label=License)](https://opensource.org/licenses/mit-license.php)
[![MIT License](https://img.shields.io/github/license/codehaus-plexus/modello.svg?label=License)](https://opensource.org/license/mit)

Code generation from a single model file. You describe your data model once in an `.mdo` file, and Modello
generates the Java classes, the readers and writers, an XSD and the documentation — all kept in step,
Expand Down Expand Up @@ -46,15 +46,16 @@ Check the badge above for the current version. Each goal is a generator; pick th

## Generators

Java classes, plus readers and writers for XML (XPP3, StAX, SAX, DOM4J, JDOM), YAML (SnakeYaml, Jackson)
and JSON Schema, plus XSD, xdoc documentation and version converters. Velocity templates are supported
Java classes, plus readers and writers for XML (XPP3 and StAX; DOM4J readers and writers; SAX and JDOM
writers only), YAML (SnakeYaml) and JSON (Jackson), plus JSON Schema, XSD, xdoc documentation and
version converters. Velocity templates are supported
since 2.1.0 for anything not covered.

Each has its own page under [Plugins](https://codehaus-plexus.github.io/modello/) on the site.
Each has its own page under [Plugins](https://codehaus-plexus.github.io/modello/modello-plugins/) on the site.

## Requirements

Java 8 or later.
Java 8 or later, and Maven 3.9.0 or later to run the Maven plugin.

## Documentation

Expand All @@ -63,14 +64,14 @@ Java 8 or later.

## Licensing

Modello is licensed under the [MIT License](https://opensource.org/licenses/mit-license.php). The rest of
Modello is licensed under the [MIT License](https://opensource.org/license/mit). The rest of
the Codehaus Plexus projects are Apache-2.0.

## 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. Integration
tests run under `-Prun-its`.
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. Integration tests run under `-Prun-its`.

Please report security vulnerabilities privately — see
[SECURITY.md](https://github.com/codehaus-plexus/.github/blob/master/SECURITY.md), not a public issue.
36 changes: 18 additions & 18 deletions modello-ant-task/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ The `<modello>` task supports several attributes and nested elements to configur

### Attributes

| Attribute | Type | Description | Required | Default |
|:-------------------------------|:----------|:--------------------------------------------------------------------------------------|:--------:|:---------------:|
| **`version`** | `String` | The model version to generate (e.g., `1.0.0`). | **Yes** | — |
| **`outputDirectory`** | `File` | The directory where the generated files will be written. | **Yes** | — |
| **`javaSource`** | `String` | Target Java version for generated source code. | No | `8` |
| **`encoding`** | `String` | Character encoding for generated files. | No | `"utf-8"` |
| **`packageWithVersion`** | `boolean` | Whether to append the version to the package name (`"true"` / `"false"`). | No | `false` |
| **`packagedVersions`** | `String` | Additional historical versions, each generated into a versioned package. | No | — |
| **`domAsXpp3`** | `boolean` | Whether to generate DOM content as Xpp3Dom (`"true"`) or W3C DOM Element (`"false"`). | No | `true` |
| **`licenseFile`** | `File` | Path to file containing license header text to prepend to generated files. | No | — |
| **`licenseText`** | `String` | License header text to prepend to generated files. | No | — |
| **`extendedClassnameSuffix`** | `String` | Writer class name suffix for the `xpp3-extended-writer` goal. | No | `Ex` |
| **`xsdFileName`** | `String` | Custom output file name for generated XSD schema (`xsd` goal). | No | — |
| **`enforceMandatoryElements`** | `boolean` | Whether to enforce mandatory elements in XSD (`"true"` / `"false"`). | No | `false` |
| **`jsonSchemaFileName`** | `String` | Custom output file name for generated JSON Schema (`jsonschema` goal). | No | — |
| **`firstVersion`** | `String` | Earliest version to document when generating documentation (`xdoc` goal). | No | — |
| **`xdocFileName`** | `String` | Custom output file name for generated XDoc documentation (`xdoc` goal). | No | — |
| **`velocityBasedir`** | `File` | Base directory of Velocity templates (`velocity` goal). | No | project basedir |
| Attribute | Type | Description | Required | Default |
|:-------------------------------|:----------|:----------------------------------------------------------------------------------------|:--------:|:---------------:|
| **`version`** | `String` | The model version to generate (e.g., `1.0.0`). | **Yes** | — |
| **`outputDirectory`** | `File` | The directory where the generated files will be written. | **Yes** | — |
| **`javaSource`** | `String` | Target Java version for generated source code. | No | `8` |
| **`encoding`** | `String` | Character encoding for generated files. | No | `"utf-8"` |
| **`packageWithVersion`** | `boolean` | Whether to append the version to the package name (`"true"` / `"false"`). | No | `false` |
| **`packagedVersions`** | `String` | Additional historical versions, each generated into a versioned package. | No | — |
| **`domAsXpp3`** | `boolean` | Whether to generate DOM content as Xpp3Dom (`"true"`) or W3C DOM Element (`"false"`). | No | `true` |
| **`licenseFile`** | `File` | Path to file containing license header text to prepend to generated files. | No | — |
| **`licenseText`** | `String` | License header text to prepend to generated files. | No | — |
| **`extendedClassnameSuffix`** | `String` | Writer class name suffix for the `xpp3-extended-writer` goal. | No | `Ex` |
| **`xsdFileName`** | `String` | Custom output file name for generated XSD schema (`xsd` goal). | No | — |
| **`enforceMandatoryElements`** | `boolean` | Kept for backward compatibility; it has no effect, required fields are always enforced. | No | `false` |
| **`jsonSchemaFileName`** | `String` | Custom output file name for generated JSON Schema (`jsonschema` goal). | No | — |
| **`firstVersion`** | `String` | Earliest version to document when generating documentation (`xdoc` goal). | No | — |
| **`xdocFileName`** | `String` | Custom output file name for generated XDoc documentation (`xdoc` goal). | No | — |
| **`velocityBasedir`** | `File` | Base directory of Velocity templates (`velocity` goal). | No | project basedir |

### Nested Elements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
public class ModelloGenerateMojo extends AbstractModelloSourceGeneratorMojo {
private final Map<String, ModelloGenerator> generatorMap;

/**
* The id of the generator to run, as registered by a Modello plugin, for example {@code java} or
* {@code xpp3-reader}. The build fails and lists the available ids if no generator has this id.
*/
@Parameter(property = ModelloParameterConstants.GENERATOR_ID, defaultValue = "java")
private String generatorId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public final class ModelloJsonSchemaGeneratorMojo extends AbstractModelloGenerat
@Parameter(defaultValue = "${project.build.directory}/generated-site/jsonschema", required = true)
private File outputDirectory;

/**
* The name of the generated JSON Schema file. If not set, it is
* <code>&lt;model id&gt;-&lt;version&gt;.schema.json</code>.
*/
@Parameter
private String jsonSchemaFileName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class ModelloXdocMojo extends AbstractModelloGeneratorMojo {
private File outputDirectory;

/**
* The name of the generated xdoc file. If not set, it is <code>&lt;model id&gt;.xml</code>.
*
* @since 1.0-alpha-21
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@ public class ModelloXsdMojo extends AbstractModelloGeneratorMojo {
private File outputDirectory;

/**
* Boolean flag to enforce mandatory elements in the XML schema.
* If set to {@code false} the XSD won't enforce mandatory elements in the XML which can be useful if the XML is post processed (e.g. POM merging with parents).
* The default value is {@code false} for backwards compatibility reasons, but should be set to {@code true} for most cases.
* Kept for backward compatibility; it no longer has any effect. The generated schema always requires the
* fields that are {@code required} in the model and makes the others optional.
* @since 2.1.0
*/
@Parameter(defaultValue = "false")
private boolean enforceMandatoryElements;

/**
* The name of the generated XML Schema file. If not set, it is
* <code>&lt;model id&gt;-&lt;version&gt;.xsd</code>.
*
* @since 1.0-alpha-21
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
title: Example of multi-model configuration
author:
- Denis Cabasson
- Denis Cabasson
date: 10 August 2006
---

# Processing Multiple Modello Models

Expand All @@ -20,7 +18,6 @@ You can use the following configuration in your `pom.xml` to have the Modello Pl
[...]
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>mdo</id>
Expand Down
9 changes: 6 additions & 3 deletions modello-maven-plugin/src/site/markdown/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This plugin makes use of the [Modello](https://codehaus-plexus.github.io/modello

- [modello:xsd](./xsd-mojo.html) Generates an XML Schema from the Modello model.
- [modello:xdoc](./xdoc-mojo.html) Generates standard documentation for the Modello model, in xdoc format.
- [modello:jsonschema](./jsonschema-mojo.html) Generates a JSON Schema from the Modello model.
- [modello:java](./java-mojo.html) Generates Java beans from the Modello model.
- [modello:xpp3-writer](./xpp3-writer-mojo.html) Generates an XML Pull Parser writer from the Modello model.
- [modello:xpp3-reader](./xpp3-reader-mojo.html) Generates an XML Pull Parser reader from the Modello model.
Expand All @@ -23,15 +24,17 @@ This plugin makes use of the [Modello](https://codehaus-plexus.github.io/modello
- [modello:dom4j-reader](./dom4j-reader-mojo.html) Generates a DOM4J reader from the Modello model.
- [modello:stax-writer](./stax-writer-mojo.html) Generates a StAX writer from the Modello model.
- [modello:stax-reader](./stax-reader-mojo.html) Generates a StAX reader from the Modello model.
- [modello:jdom-writer](./jdom-writer-mojo.html) Generates a [jdom](http://www.jdom.org/) writer from the model that is capable of preserving element ordering and comments.
- [modello:jdom-writer](./jdom-writer-mojo.html) Generates a [JDOM](https://www.jdom.org/) writer from the model that is capable of preserving element ordering and comments.
- [modello:sax-writer](./sax-writer-mojo.html) Generates a SAX writer from the Modello model.
- [modello:jackson-writer](./jackson-writer-mojo.html) Generates a JSON writer based on Jackson Streaming APIs from the Modello model.
- [modello:jackson-reader](./jackson-reader-mojo.html) Generates a JSON reader based on Jackson Streaming APIs from the Modello model.
- [modello:jackson-extended-reader](./jackson-extended-reader-mojo.html) Generates a JSON reader based on Jackson Streaming APIs from the. Modello model that records line/column number metadata in the parsed model.
- [modello:jackson-extended-reader](./jackson-extended-reader-mojo.html) Generates a JSON reader based on Jackson Streaming APIs from the Modello model that records line/column number metadata in the parsed model.
- [modello:snakeyaml-writer](./snakeyaml-writer-mojo.html) Generates a YAML writer based on SnakeYaml Streaming APIs from the Modello model.
- [modello:snakeyaml-reader](./snakeyaml-reader-mojo.html) Generates a YAML reader based on SnakeYaml Streaming APIs from the Modello model.
- [modello:snakeyaml-extended-reader](./snakeyaml-extended-reader-mojo.html) Generates a YAML reader based on SnakeYaml Streaming APIs from the. Modello model that records line/column number metadata in the parsed model.
- [modello:snakeyaml-extended-reader](./snakeyaml-extended-reader-mojo.html) Generates a YAML reader based on SnakeYaml Streaming APIs from the Modello model that records line/column number metadata in the parsed model.
- [modello:velocity](./velocity-mojo.html) Creates files from the model using Velocity templates.
- [modello:converters](./converters-mojo.html) Generates classes that can convert between different versions of the model.
- [modello:generate](./generate-mojo.html) Runs the generator named by the `generatorId` parameter, for generators contributed by other Modello plugins.

## Usage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
title: Usage
author:
- Denis Cabasson
- Denis Cabasson
date: 10 August 2006
---

# Usage

Expand All @@ -23,7 +21,7 @@ You can use the following configuration in your `pom.xml` to invoke the Modello
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<version>${project.version}</version>
<version><!-- latest release --></version>
<configuration>
<models>
<model>src/main/mdo/myModel.mdo</model>
Expand Down
2 changes: 1 addition & 1 deletion modello-plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ That has a consequence worth knowing before you touch anything here:
> **Tooling that works from Maven source roots does not see this tree.**

Formatters, static analysis, IDE indexing and automated refactoring all skip it, and they skip it
*silently* — a run reports success having read none of these files. A JUnit 4 to JUnit 5 migration hit
*silently* — a run reports success having read none of these files. A test-framework migration hit
exactly this: the recipe reported success and had rewritten none of the 29 verifiers. Whatever you are
running across the codebase, check afterwards whether it reached this directory, and expect to finish
the job by hand.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ author:

# Modello Dom4J Plugin

Modello Dom4J Plugin generates XML readers and writers based on [Dom4J 1 API](http://dom4j.sourceforge.net/dom4j-1.6.1/).
Modello Dom4J Plugin generates XML readers and writers based on [Dom4J 1 API](https://dom4j.github.io/).

Notice: DOM content type is represented as [plexus-utils' Xpp3Dom](http://plexus.codehaus.org/plexus-utils/apidocs/org/codehaus/plexus/util/xml/Xpp3Dom.html) objects
Notice: DOM content type is represented as [plexus-xml's Xpp3Dom](https://codehaus-plexus.github.io/plexus-xml/apidocs/org.codehaus.plexus.util.xml/org/codehaus/plexus/util/xml/Xpp3Dom.html) objects

## dom4j-reader

Expand Down
Loading
Loading