How do I include files with spaces in their names when using rpm-maven-plugin?

Go To StackoverFlow.com

1

I am trying to package my own project that includes parts of other projects. Here is a snippet from my pom.xml:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>rpm-maven-plugin</artifactId>
  ...
  <mappings>
    ...
    <mapping>
      <directory>${install.target}/contrib</directory>
      <sources>
        <source>
          <location>src/main/resources</location>
          <includes>
            <include>contrib/**/*</include>
          </includes>
        </source>
      </sources>
    </mapping>
    ...
  </mappings>
</plugin>

However, when I try to build an rpm, it errors out with a message similar to the following (repeated a couple of times):

error: Two files on one line: /install/path/contrib/project/licences/Apache
error: File must begin with "/": Software
error: Two files on one line: /install/path/contrib/project/licences/Apache
error: File must begin with "/": Licence
error: Two files on one line: /install/path/contrib/project/licences/Apache
error: File must begin with "/": v2.0.txt

Naturally, there is a file in the other project called Apache Software Licence v2.0.txt

Is there a way to tell maven to quote the filenames when generating the spec file? It looks like it is actually rpmbuild that is barfing, but I'm not completely sure.

2012-04-04 00:16
by MikeD
Does that mean you use a file outside of your current maven project? Furthermore usually the file is called LICENSE.txt which contains the license information - khmarbaise 2012-04-04 08:35
Yes, I am taking another project and copying it to my src/main/resources/contrib folder. The other project is not a maven project, so I can't just include it as a dependency. And I do not control what the file is called - I understand that it is usually just 'license' but in this case the project maintainers decided to make it 'Apache Software License - MikeD 2012-04-05 21:02
http://jira.codehaus.org/browse/MRPM-102 seems like it could be related - user944849 2012-04-06 03:28
@user944849 Yep, that's exactly it. If you turn that comment into an answer (and write up some knowledge around it), then I'll happily accept it. Guess I have to wait for 2.1 release - MikeD 2012-04-09 20:42


0

http://jira.codehaus.org/browse/MRPM-102 describes an issue where the plugin doesn't handle spaces in filenames correctly. The parser interprets the space as a delimiter between files and the build fails. Patch was submitted, accepted on 14 Apr 2012, for eventually release with version 2.1 of the plugin. Not sure if a nightly build is available.

2012-04-27 01:19
by user944849