GitHub - maveniverse/nisse: Maveniverse Nisse (original) (raw)

Requirements:

Nisse is a suite of extensions and plugins for Maven 3 and Maven 4 that provides following:

Usage with Maven

There are 3 extensions: extension3 meant to be used with Maven 3 exclusively (does not work in Maven 4), thenextension4 meant to be used with Maven 4 exclusively (does not work in Maven 3), and finally extension, that works in both, Maven 3 and Maven 4. Last is the recommended extension to be used. Use it like this:

eu.maveniverse.maven.nisse extension ${version.nisse}

Note: Nisse can be used as "plugin only" as well, but functionality in this case is limited ONLY to providing properties for interpolation (within a project).

Nisse can serve as OS Detector drop in replacement, just add Nisse as extension to your project and specify -Dnisse.compat.osDetector on CLI or better, in .mvn/maven.config file. If this option present, Nisse will emit same properties as OS Detector did.

To check what Nisse injects, simplest command to use is Nisse dump:

$ mvn validate -N -Dnisse.dump

The -N is needed only if you are in root of some complex multi-module project. Note that this only works when Nisse is declared as a "core extension"(Maven 3 and 4) through .mvn/extensions.xml or as a "user-wide extension" (Maven 4 only) through ~/.m2/extensions.xml. Otherwise, one may use dump-properties Mojo or the nisse.dump property of inject-properties Mojo.

Usage with Gradle

Nisse is also available as a Gradle plugin. See the Gradle Plugin documentation for full details.

Minimal setup:

plugins { id("eu.maveniverse.gradle.plugins.nisse-gradle-plugin") version "${nisseVersion}" }

// Access discovered properties in tasks tasks.register("showVersion") { doLast { println "OS: ${project.nisse['nisse.os.name']}" println "Git commit: ${project.nisse['nisse.jgit.commit']}" } }

The plugin supports a nisseConfig DSL for configuring sources (dynamic version, counting version, deactivating sources, etc.) — see the Gradle README.

Implemented Sources

There are 4 sources provided out of the box:

Look into ITs for usage examples.