org.fuin.smp:system-maven-plugin

Maven plugin that provides UnixSystem values like UID or GID as project properties [PLUGIN].

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

org.fuin.smp
ArtifactId

ArtifactId

system-maven-plugin
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Maven plugin that provides UnixSystem values like UID or GID as project properties [PLUGIN].
Project Organization

Project Organization

fuin.org (Germany)

Download system-maven-plugin

How to add to project

<plugin>
    <groupId>org.fuin.smp</groupId>
    <artifactId>system-maven-plugin</artifactId>
    <version>0.1.0</version>
</plugin>

Dependencies

compile (10)

Group / Artifact Type Version
org.twdata.maven : mojo-executor jar 2.2.0
org.apache.commons : commons-exec jar 1.3
org.apache.commons : commons-compress jar 1.9
commons-io : commons-io jar 2.4
org.fuin : utils4j jar 0.9.2
org.slf4j : slf4j-api jar 1.7.12
org.glassfish : javax.json jar 1.0.4
com.jcabi : jcabi-maven-slf4j jar 0.9
org.bouncycastle : bcprov-jdk15on jar 1.52
org.bouncycastle : bcpkix-jdk15on jar 1.52

provided (3)

Group / Artifact Type Version
org.apache.maven : maven-core jar 3.3.9
org.apache.maven : maven-plugin-api jar 3.3.9
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.5

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
org.assertj : assertj-core jar 3.5.1
nl.jqno.equalsverifier : equalsverifier jar 2.1.2

Project Modules

There are no modules declared in this project.

system-maven-plugin

This Maven plugin provides UnixSystem values like "uid" or "gid" as project properties.

Build Status Maven Central LGPLv3 License Java Development Kit 1.8

Getting started

Just add the plugin to your Maven POM:

<plugin>
    <groupId>org.fuin.smp</groupId>
    <artifactId>system-maven-plugin</artifactId>
    <version>0.1.0</version>
    <!-- You can optionally change the prefixes
    <configuration>
        <generic-prefix>org.fuin.smp.</generic-prefix>
        <unix-prefix>org.fuin.smp.unix.</unix-prefix>
    </configuration>
    -->
    <executions>
        <execution>
            <phase>initialize</phase>
            <goals>
                <goal>read-system-information</goal>
            </goals>
        </execution>
    </executions>
</plugin>

This will make all properties from UnixSystem available as project properties.

Here is a Docker Maven Plugin example on how to use the properties:

<plugin>
    <groupId>io.fabric8</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <version>0.22.1</version>
    <configuration>
        <images>
            <image>
                <name>your/cool-image</name>
                <run>
                    <volumes>
                        <bind>
                            <volume>${project.build.directory}:/usr/src/result</volume>
                        </bind>
                    </volumes>
                    <user>${org.fuin.smp.uid}:${org.fuin.smp.gid}</user>
                </run>
            </image>
        </images>
    </configuration>
</plugin>

This starts the image with the local user's UID and GID and files written into '${project.build.directory}' will have exactly that owner and group.

Available Properties

Generic

Property Description
org.fuin.smp.uid UID for the current user (String)
org.fuin.smp.gid GID for the current user (String)
org.fuin.smp.username Username for the current user (String)

UnixSystem

Property Description
org.fuin.smp.unix.gid GID for the current Unix user (long)
org.fuin.smp.unix.groups Supplementary groups for the current Unix user (long[])
org.fuin.smp.unix.uid UID for the current Unix user (long)
org.fuin.smp.unix.username Username for the current Unix user (String)

Limitations

Currently only Unix like systems are supported. It should also be possible to include NTSystem but somehow the class was missing in my local Java 8 JRE and I hadn't enough time to investigate this. Any help welcome.

Snapshots

Snapshots can be found on the OSS Sonatype Snapshots Repository.

Add the following to your .m2/settings.xml to enable snapshots in your Maven build:

<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>
org.fuin.smp

fuin.org

Versions

Version
0.1.0