Example on how to use Maven to compile and trigger a custom code generator in one run.
Go to file
Maximilian Kratz 4d7b7aa3a9
Merge pull request #3 from maxkratz/feature/update-maven-dependencies
Updates Maven dependency: exec-maven-plugin
2024-02-27 16:23:11 +01:00
.github/workflows Updates setup-maven Action to v5 2024-02-08 15:40:40 +01:00
org.example.codegen Updates Maven dependency: exec-maven-plugin 2024-02-27 16:22:29 +01:00
LICENSE Adds README.md, LICENSE, and a GitHub Actions CI config 2024-01-28 10:37:59 +01:00
README.md Adds README.md, LICENSE, and a GitHub Actions CI config 2024-01-28 10:37:59 +01:00

README.md

Maven code generation example

This example shows how to configure a Maven project to consider code generation classes and generated code. The usual procedure is:

  1. Compiling the code generator itself
  2. Running the code generator to, e.g., generate new java classes
  3. Compile the whole project (including the previously generated classes)

The example can be used to, for example, use custom code generators and their functionality to generate code withing a CI pipeline (without the need to run individual steps manually).

CI

Structure

Name Type Purpose
org.example.codegen Eclipse (java) project Contains the sources of the custom code generator.
ci.yml File Example GitHub Actions configuration to build and push the project.
pom.xml File Maven configuration file that contains the project's configuration.

How to build

  • Generate code + build the project:
    $ mvn clean package
  • Build + install the project to the local .m2/ folder:
    $ mvn clean install
  • Change the version of the plug-in to a new semver (e.g., before publishing a new release):
    $ mvn versions:set -DnewVersion=0.0.2-SNAPSHOT

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for more details.