Fork me on GitHub

Kotlin Application - 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

    • jib for building smaller Docker images using layers.
    • reproducible-build helps with Docker layer reuse.
    • ktlint plugin that uses ktlint to format and check Kotlin code for style issues.
    • 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.
  • 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=kotlin-application-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=kotlin-application-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 \
    '-DdockerImageName=TODO'

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)