mavenscriptletmojorpm-maven-plugin

Maven RPM plugin not generating correct %files section


I'm building a package using the Maven RPM plugin, and it's generating the %files section in the .spec file in a way that causes conflicts during installation. I want to install a file into /usr/bin, but the .spec file contains the following directive:

%attr(755,root,root) /usr/bin

This causes the RPM install to fail due to a conflict with another package which already owns that directory.

What I would like to do is have Maven specify the filename directly, which would avoid the entire issue. Here's the mapping section for that particular file:

          <mapping>
            <directory>/usr/bin</directory>
            <filemode>755</filemode>
            <sources>
              <source>
                <location>src/main/scripts/foobar.sh</location>
                <destination>foobar</destination>
              </source>
            </sources>
          </mapping>

Any suggestions?

(I've opened an issue at the plugin bug tracker for this)


Solution

  • As pointed out in the bug, the directoryIncluded[1] mapping controls this behavior. If you set this to false you will get the behavior you desire.

    [1] - http://mojo.codehaus.org/rpm-maven-plugin/map-params.html#directoryIncluded