Fork me on GitHub

Java Library - Maven Archetype

Build Status Maven Central License

Features

There's a lot of project setup required for an application these days. Far more than the skeleton POM and a couple of classes provided by the standard Maven archetype. The GantSign Maven Archetype provides the following:

  • .gitattributes the text/binary handling for common file types.

  • .gitignore using gitignore.io templates to ignore common operating system files, editor files, Java and Maven files that shouldn't be versioned.

  • .editorconfig configure line endings, indent and file encodings for common editors/IDEs using EditorConfig.

  • IntelliJ IDEA config

  • Maven

    • Java version
    • File encoding
    • Reports
    • Minimum Maven version
    • Plugin versions
  • Maven plugins

    • flatten optimize the deployed POM by flattening parent POMs and stripping unnecessary information.
    • reproducible-build helps with Docker layer reuse.
    • fmt: reformat your Java code as part of the build to conform to the Google Java Style Guide.
    • sortpom: make the pom.xml easier to version control.
    • enforcer: ensure builds are reproducible and there are no class conflicts.
    • license: ensure files include a license header.
    • dependency: ensure dependencies are declared correctly.
    • jdeps: check for use of internal APIs (prepare for Java 9).
    • jacoco: enforce minimum code coverage.
    • checkstyle: fail build if bugs, bad practice, or poor style detected.
    • errorprone: extension to compiler plugin, fail build if bugs or bad practice detected.
  • Post-generation script

  • Security scanning

    This archetype includes the SpotBugs Maven Plugin with the Find Security Bugs plugin for performing static analysis on the code. The static analysis can be quite time consuming so it's not run by default.

Requirements

  • Java 11
  • Maven >= 3.5

Usage

To create a new project from this archetype, type:

mvn archetype:generate \
    -DarchetypeGroupId=com.github.gantsign.maven.archetypes \
    -DarchetypeArtifactId=java-library-maven-archetype \
    -DarchetypeVersion=5.0.0

You may find it easier to specify the archetype properties on the command line rather than interactively:

mvn archetype:generate \
    -DarchetypeGroupId=com.github.gantsign.maven.archetypes \
    -DarchetypeArtifactId=java-library-maven-archetype \
    -DarchetypeVersion=5.0.0 \
    -DgroupId=com.gantsign.TODO \
    -DartifactId=TODO \
    -Dversion=1.0.0-SNAPSHOT \
    -Dpackage=com.gantsign.TODO \
    -DprojectName=TODO \
    '-DorganizationName=GantSign Ltd.' \
    -DcopyrightStartYear=2018

License

This software is licensed under the terms in the file named “LICENSE” in the root directory of this project.

Author Information

John Freeman

GantSign Ltd. Company No. 06109112 (registered in England)