mojohaus / rpm-maven-plugin

http://www.mojohaus.org/rpm-maven-plugin/
Other
56 stars 48 forks source link

warning: File listed twice #80

Open zdary opened 7 years ago

zdary commented 7 years ago

in version 2.1.4 and 2.1.5

we have a warning: File listed twice when we try to list xml files differently from the rest of the files.

Notice the way we include xml files in first mapping and exclude xml files in the other mapping. As a result I would expect no duplication of files.

                <mapping>
                  <directory>/opt/callrec/web/apps/qm</directory>
                  <directoryIncluded>false</directoryIncluded>
                  <recurseDirectories>true</recurseDirectories>
                  <sources>
                    <source>
                      <location>${project.build.directory}/${project.build.finalName}</location>
                      <excludes>
                        <exclude>**/*.xml</exclude>
                      </excludes>
                    </source>
                  </sources>
                </mapping>
                <mapping>
                  <directory>/opt/callrec/web/apps/qm</directory>
                  <directoryIncluded>false</directoryIncluded>
                  <recurseDirectories>true</recurseDirectories>
                  <configuration>noreplace</configuration>
                  <sources>
                    <source>
                      <location>${project.build.directory}/${project.build.finalName}</location>
                      <includes>
                        <include>**/*.xml</include>
                      </includes>
                    </source>
                  </sources>
                </mapping>
siavashoutadi commented 6 years ago

I think the conflict is because of<recurseDirectories>true</recurseDirectories> is written in both mappings. So instead do this:

                <mapping>
                  <directory>/opt/callrec/web/apps/qm</directory>
                  <recurseDirectories>true</recurseDirectories>
                </mapping>

                <mapping>
                  <directory>/opt/callrec/web/apps/qm</directory>
                  <directoryIncluded>false</directoryIncluded>
                  <sources>
                    <source>
                      <location>${project.build.directory}/${project.build.finalName}</location>
                      <excludes>
                        <exclude>**/*.xml</exclude>
                      </excludes>
                    </source>
                  </sources>
                </mapping>
                <mapping>
                  <directory>/opt/callrec/web/apps/qm</directory>
                  <directoryIncluded>false</directoryIncluded>
                  <configuration>noreplace</configuration>
                  <sources>
                    <source>
                      <location>${project.build.directory}/${project.build.finalName}</location>
                      <includes>
                        <include>**/*.xml</include>
                      </includes>
                    </source>
                  </sources>
                </mapping>

So I created a separate mapping for the directory itself and all sub directories under it. That makes sure if you uninstall the rpm all sub directories are removed. And then you can include xml file in one mapping and exlude them in the other one. Hope that works for you.