user-id-maven-plugin Maven Plugin

Provide `user.id`-property for unix-like environments.

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

org.rjung.util
ArtifactId

ArtifactId

user-id-maven-plugin
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

user-id-maven-plugin Maven Plugin
Provide `user.id`-property for unix-like environments.
Project URL

Project URL

http://rynr.github.io/user-id-maven-plugin
Source Code Management

Source Code Management

http://github.com/rynr/user-id-maven-plugin

Download user-id-maven-plugin

How to add to project

<plugin>
    <groupId>org.rjung.util</groupId>
    <artifactId>user-id-maven-plugin</artifactId>
    <version>1.0</version>
</plugin>

Dependencies

compile (2)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 3.3.9
org.codehaus.plexus : plexus-utils jar 3.0.24

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.4

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

user-id maven plugin

This plugin provides the user-id (UID) of the user executing the build. Due to the java system itself not providing this information but only the username, the plugin gets the property user.name of the systems properties. This unfortunately breaky the possibillity to use the plugin for non-standard unix-environments.

WARNING

Using this plugin could couple your build tightly to your environment.
Please use it only if you really need it.

Example

To enable the plugin add this to your build-plugins in your pom.xml.

<plugin>
  <!-- Plugin only works with unix-like environments, please use it wisely! -->
  <groupId>org.rjung.util</groupId>
  <artifactId>user-id-maven-plugin</artifactId>
  <version>1.0</version>
  <!-- (If you have an idea how I can omit the executions, please contact the author of this plugin) -->
  <executions>
    <execution>
      <goals>
        <goal>user-id</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Now you can use ${user.id} within your pom.xml.

Configuration

You can adapt some different values to your need:

<plugin>
  <!-- Plugin only works with unix-like environments, please use it wisely! -->
  <!-- This contains the default configuration for standard unix systems. -->
  <groupId>org.rjung.util</groupId>
  <artifactId>user-id-maven-plugin</artifactId>
  <version>1.0</version>
  <configuration>
    <propertyName>user.id</propertyName>
    <passwdPath>/etc/passwd</passwdPath>
    <columnSeparator>:</columnSeparator>
    <usernameColumn>0</usernameColumn><!-- first column is 0 -->
    <uidColumn>2</uidColumn>
    <defaultUid>0</defaultUid>
  </configuration>
  <!-- (If you have an idea how I can omit the executions, please contact the author of this plugin) -->
  <executions>
    <execution>
      <goals>
        <goal>user-id</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Links

Versions

Version
1.0