javamavensystemdrpm-maven-plugin

What is bast practice for pom.xml for fix rpm-maven-plugin file /usr/lib/systemd/system conflicts?


I try pack jar and systemd unit to RPM.

My source code https://github.com/patsevanton/consul-demo

https://github.com/patsevanton/consul-demo/blob/master/backend/pom.xml#L120

<mapping>
    <directory>/usr/lib/systemd/system</directory>
    <filemode>644</filemode>
    <username>root</username>
    <sources>
        <source>
            <location>src/main/scripts/backend.service</location>
        </source>
    </sources>
</mapping>

i get error:

Transaction check error:
  file /usr/lib/systemd/system from install of consul-backend-0.0.1-1.noarch conflicts with file from package systemd-219-62.el7_6.2.x86_64

What is bast practice for pom.xml for fix rpm-maven-plugin file /usr/lib/systemd/system conflicts ?


Solution

  • Your configuration is trying to create the /usr/lib/systemd/system directory which is wrong. You have to change the configuration of the rpm-maven-plugin like this:

    <mapping>
        <directory>/usr/lib/systemd/system</directory>
        <filemode>644</filemode>
        <username>root</username>
        <groupname>root</groupname>
        <directoryIncluded>false</directoryIncluded>
         ..