Giter Site home page Giter Site logo

rasata / rpm-systemd-maven-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dglecom/rpm-systemd-maven-plugin

0.0 1.0 0.0 28 KB

This plugin can be used to generate files for RPM packages and systemd services

License: Apache License 2.0

Java 69.60% Scala 30.40%

rpm-systemd-maven-plugin's Introduction

RPM Systemd Maven Plugin

This plugin can be used to generate files for RPM packages and systemd services.

Build Status Maven Central

Usage

The plugin currently supports two goals:

  • generate-systemd-file: This generates a systemd file for the module
  • generate-rpm-postinst-file: This generates a postinst file to set up the target system
<plugin>
    <groupId>de.douglas.maven.plugin</groupId>
    <artifactId>rpm-systemd-maven-plugin</artifactId>
    <version>1.0</version>
    <executions>
        <execution>
            <phase>generate-resources</phase>
            <goals>
                <goal>generate-systemd-file</goal>
                <goal>generate-rpm-install-files</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Usage in conjunction with the RPM Maven Plugin

This plugin can be used in conjunction with the RPM Maven Plugin to create a RPM package including the systemd and postinst file.

<plugins>
    <plugin>
        <groupId>de.douglas.maven.plugin</groupId>
        <artifactId>rpm-systemd-maven-plugin</artifactId>
        <executions>
            <execution>
                <phase>generate-resources</phase>
                <goals>
                    <goal>generate-systemd-file</goal>
                    <goal>generate-rpm-postinst-file</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>rpm-maven-plugin</artifactId>
        <configuration>
            <mappings>
                <mapping>
                    <directory>/usr/lib/systemd/system</directory>
                    <sources>
                        <source>
                            <location>${project.build.directory}/rpm-systemd-maven-plugin/${project.artifactId}.service</location>
                        </source>
                    </sources>
                    <directoryIncluded>false</directoryIncluded>
                    <configuration>false</configuration>
                </mapping>
            </mappings>
            <postinstallScriptlet>
                <scriptFile>target/rpm-systemd-maven-plugin/postinst</scriptFile>
                <fileEncoding>utf-8</fileEncoding>
            </postinstallScriptlet>
            ...
        </configuration>
    </plugin>
</plugins>

Override variables

You can override the following variables in the plugin configuration:

javaPath

  • Path to the java binary in the systemd service file
  • Defaults to /usr/bin/java

runnableJarPath

  • Path to the runnable jar of the module in the systemd service file
  • Defaults to /usr/share/${project.artifactId}/${project.build.finalName}.${project.packaging}

workingDirectoryPath

  • Path to the working directory in the systemd service file
  • Used as home directory for the user the module will be executed with
  • Defaults to /var/lib/${project.artifactId}

environmentFilePath

  • Path to the environment file in the systemd service file
  • Created in the postinst file
  • Defaults to /etc/sysconfig/${project.artifactId}

systemdServiceFileName

  • Name of the systemd service file
  • Used in the postinst file to preset the systemd service
  • Defaults to ${project.artifactId}.service

user

  • User to be used for module execution in the systemd service file
  • Used to set permissions for directories
  • Defaults to ${project.artifactId}

group

  • Group to be used for module execution in the systemd service file
  • Used to set permissions for directories
  • Defaults to ${project.artifactId}

additionalDirectories

  • List of additional directories to be created in the postinst file
  • Defaults to an empty list

Example

To override the runnableJarPath and add additional directories, use

<plugins>
    <plugin>
        <groupId>de.douglas.maven.plugin</groupId>
        <artifactId>rpm-systemd-maven-plugin</artifactId>
        <configuration>
            <runnableJarPath>/opt/${project.artifactId}/${project.build.finalName}-jarlotte.jar</runnableJarPath>
            <additionalDirectories>
                <additionalDirectory>
                    <directory>/etc/${project.artifactId}</directory>
                    <user>root</user>
                    <group>root</group>
                </additionalDirectory>
                <additionalDirectory>
                    <directory>/var/log/${project.artifactId}</directory>
                    <user>${project.artifactId}</user>
                    <group>${project.artifactId}</group>
                </additionalDirectory>
            </additionalDirectories>
        </configuration>
        ...
    </plugin>
</plugins>

or

<properties>
    <runnableJarPath>/opt/${project.artifactId}/${project.build.finalName}-jarlotte.jar</runnableJarPath>
</properties>

License

The RPM Systemd Maven Plugin is released under version 2.0 of the Apache License.

rpm-systemd-maven-plugin's People

Contributors

makubi avatar supertux88 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.