mavenrpm-maven-plugin

rpm-maven-plugin exclude directories in final rpm


Is there a way to avoid the full directory path being created in the final rpm package by executing the rpm-maven-plugin?

 <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>rpm-maven-plugin</artifactId>
            <version>2.1.1</version>
            <extensions>true</extensions>
            <executions>
                <execution>
                    <id>attach-rpm</id>
                    <goals>
                        <goal>attached-rpm</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <group>client2-scripts</group>
                <mappings>
                    <mapping>
                        <directory>/opt/bbmc/bin</directory>
                        <filemode>750</filemode>
                        <username>elasticsearch</username>
                        <groupname>elasticsearch</groupname>
                        <sources>
                            <source>
                                <location>src/main/</location>
                                <includes>
                                    <include>commons/config/*.ini</include>
                                    <include>commons/config/*.properties</include>
                                    <include>*/*.py</include>
                                </includes>
                            </source>
                        </sources>
                    </mapping>
                </mappings>
            </configuration>
        </plugin>

The produced directory structured looks like this:

opt
   bbmc
       bin
          bbto793
                 *.py
              ...

Instead of the desired one:

opt
   bbmc
       bin
          *.py

Solution

  • Put the files in src/main in the same structure you want to deliver in your rpm.