Source code generation for Java — a small, configuration-driven framework for building parse/generate pipelines.
A model-driven approach almost always requires generating some code (model-to-text) or other output. srcgen4j makes this easy: you wire up one or more parsers (that read input models) and generators (that write output) in a single XML configuration, and run them as a pipeline from a Maven build or programmatically.
This repository is a multi-module Maven build. The artifacts keep their original coordinates
under the org.fuin.srcgen4j group:
| Module | Artifact | Description |
|---|---|---|
| commons | srcgen4j-commons |
Configuration model and common base classes for the parse/generate workflow. |
| core | srcgen4j-core |
Ready-to-use parsers and generators (EMF/Ecore, Apache Velocity, Xtext). |
| maven | srcgen4j-maven-plugin |
Maven plugin that runs the pipeline during a build. |
Dependency direction: commons ← core ← maven-plugin.
See each module's README for configuration examples and usage details.
Requirements:
- JDK 21 or later
- Maven — no local install needed, use the bundled Maven Wrapper (
./mvnw)
Build the whole reactor (commons → core → maven-plugin) and run all tests:
./mvnw clean verify -s settings.xmlThe provided settings.xml enables the snapshot repository needed for the -SNAPSHOT
dependencies; drop -s settings.xml once you build against released versions only.
Snapshot artifacts are published to the
Central Portal Snapshots repository.
To consume them, add the repository to your ~/.m2/settings.xml (or project pom.xml):
<repository>
<id>central.sonatype.snapshots</id>
<name>Central Portal Snapshots</name>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>To use the Maven plugin as a snapshot, add the same entry to the pluginRepositories section:
<pluginRepository>
<id>central.sonatype.snapshots</id>
<name>Central Portal Snapshots</name>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>Bug reports and pull requests are welcome via GitHub Issues.
Licensed under the GNU Lesser General Public License, version 2.1.
