Skip to content

fuinorg/srcgen4j-maven

Repository files navigation

srcgen4j-maven

Source code generation for Java (Maven Plugin)

Build Status Coverage Status Maven Central LGPLv3 License Java Development Kit 11

Versions

  • 0.4.3 (or later) = Java 11 before namespace change from 'javax' to 'jakarta'
  • 0.4.2 (or previous) = Java 8

What is this?

The project provides a Maven plugin that executes a parse/generate workflow based on the srcgen4j-common/srcgen4j-core projects.

Usage

Simply add the plugin to your project's Maven POM and add configuration an dependencies.

<plugin>
    <groupId>org.fuin.srcgen4j</groupId>
    <artifactId>srcgen4j-maven-plugin</artifactId>
    <version>0.4.3-SNAPSHOT</version>
    <configuration>
        <jaxbClassesToBeBound>
            <param>org.fuin.srcgen4j.core.velocity.VelocityGeneratorConfig</param>
            <param>org.fuin.srcgen4j.core.velocity.ParameterizedTemplateParserConfig</param>
            <param>org.fuin.srcgen4j.core.velocity.ParameterizedTemplateGeneratorConfig</param>
        </jaxbClassesToBeBound>
    </configuration>
    <executions>
        <execution>
            <id>srcgen4j</id>
            <phase>process-sources</phase>
            <goals>
                <goal>process-template</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity-engine-core</artifactId>
            <version>2.3</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.5</version>
        </dependency>
    </dependencies>
</plugin>

⚠️ If you use a snapshot version, be sure to include the snapshot repositoy to your settings (See below).

Example

You can also find an example project here: test-project.

Debugging

To start the generation process in debug mode you can checkout the srcgen4j-maven-app project.

Snapshots

Snapshots can be found on the OSS Sonatype Snapshots Repository.

Add the following to your .m2/settings.xml (section "repositories") to enable snapshots in your Maven build:

<repository>
    <id>sonatype.oss.snapshots</id>
    <name>Sonatype OSS Snapshot Repository</name>
    <url>http://oss.sonatype.org/content/repositories/snapshots</url>
    <releases>
        <enabled>false</enabled>
    </releases>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
</repository>

An additional entry to the "pluginRepositories" section is also required:

<pluginRepository>
    <id>sonatype.oss.snapshots</id>
    <name>Sonatype OSS Snapshot Repository</name>
    <url>http://oss.sonatype.org/content/repositories/snapshots</url>
    <releases>
        <enabled>false</enabled>
    </releases>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
</pluginRepository>

About

Source code generation for Java (Maven Plugin)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages