Last updated
on 22-11-2012
at 12:00 AM

Blog

As part of my work on my JS-Test-Runner, I’ve been setting up Maven to do all my packaging for me. Deb packaging was relatively straight-forward (using the jDeb maven plugin), and happily builds on my Linux CI box and the my home Windows dev machine, but building RPMs requires a little more hackery.

The main issue is that rather than building it from scratch, as the jdeb plugin does, it uses rpmbuild directly. This unsurprisingly doesn’t exist on Windows! Your options are to hide this step under a profile and not execute it on Windows, or to install Cygwin and work from there. I went for option B:

  1. Configure RPM building in your pom (see mine for an example)
  2. Download cygwin
  3. Run the installer, and select rpm and rpm-build as packages that you’d like to have installed.
  4. Add your Cygwin bin folder (e.g. C:\cygwin\bin) to your PATH
  5. Rename the ‘system file’ (actually a symlink) at cygwin\bin\rpmbuild to cygwin\bin\rpmb
  6. Copy the script provided in this bug ticket comment to a new batch file called ‘rpmbuild.bat’ in your PATH, e.g. C:\cygwin\bin\rpmbuild.bat
  7. Make a small tweak to that file, changing the ‘rpmbuild’ at the start of the last line to ‘rpmb’

Some troubleshooting notes:

With this, I can now build JS-Test-Runner locally on my Windows box, no problemo; feel free to check out that code and try a local ‘mvn package’ to test your machine setup. RPMs will appear in [project]/target/rm/[project name]/RPMS/noarch, by default.

Many thanks for the core elements of this go to the gentlemen (or ladies) of MRPM-4, a bug ticket in the maven RPM plugin covered in comments looking at ways of doiing this. The slight tweaks to their approach are to better deal with paths, as what I could decipher from the discussion on that ticket didn’t quite hit the spot.

  1. Sid Psyko at 11:35AM on 28/08/2013

    Ping back from: http://sidpsyko.blogspot.com/2013/08/another-word-on-using-rpm-maven-plugin.html

  2. Ranjana at 08:42PM on 15/10/2013

    Hiya, I tried your approach. However, rpm build is still failing with this warning:
    [INFO] C:\Users\eranagg\git\BaseConnectivityInfoFlow\ERICbaseconnectivityinfoflowmodel_CXP9030578\target\rpm\ERICbaseconnectivityinfoflowmodel_CXP9030578\SPECS>bash c "rpmb -bb —buildroot /cygdrive/c/Users/eranagg/git/BaseConnectivityInfoFlow/ERICbaseconnectivityinfoflowmodel_CXP9030578/target/rpm/ERICbaseconnectivityinfoflowmodel_CXP9030578/buildroot —define ""_topdir /cygdrive/c/Users/eranagg/git/BaseConnectivityInfoFlow/ERICbaseconnectivityinfoflowmodel_CXP9030578/target/rpm/ERICbaseconnectivityinfoflowmodel_CXP9030578"" —target ""noarch-pc-windows 7"" —define ""_build_name_fmt %{ARCH}/%{NAME}%{VERSION}-%{RELEASE}.%{ARCH}.rpm"" ERICbaseconnectivityinfoflowmodel_CXP9030578.spec"
    [WARNING] error: Target buffer overflow
    [INFO] Building target platforms: noarch-pc-windows 7
    [INFO] Building for target noarch-pc-windows 7
    [INFO] Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.47645
    [WARNING] + umask 022
    [WARNING] + cd /cygdrive/c/Users/eranagg/git/Bif ‘[’ -e /cygdrive/c/Users/eranagg/git/BaseConnectivityInfoFlow/ERICbaseconnectivityinfoflowmodel_CXP9030578/target/rpm/ERICbaseconnectivityinfoflowmodel_CXP9030578/buildroot ‘]’
    [WARNING] /var/tmp/rpm-tmp.47645: line 20: cd: /cygdrive/c/Users/eranagg/git/Bif: No such file or directory
    [WARNING] error: Bad exit status from /var/tmp/rpm-tmp.47645 (%install)
    [WARNING] Target buffer overflow
    [WARNING] Bad exit status from /var/tmp/rpm-tmp.47645 (%install)
    [INFO]
    [INFO]
    [INFO] RPM build errors:

    Can you please suggest if tehre is anyway I can increase buffer size or if there is any alternative to this.

    Thanks
    Ranjana

  3. Smithd732 at 07:33PM on 05/05/2014

    There is numerous separate years Los angeles Weight reduction eating plan with each a person can be a necessity. The pioneer part can be your original obtaining rid of belonging towards the extra pounds. la weight loss dkgckgkdfkbeegeg

  4. Pharmd702 at 07:33PM on 05/05/2014

    Very nice site! <a href="http://oixapey2.com/rqsqs/1.html">cheap goods</a>

  5. Pharmb378 at 07:33PM on 05/05/2014

    Very nice site! [url=http://oixapey2.com/rqsqs/2.html]cheap goods[/url]

  6. Pharme660 at 07:33PM on 05/05/2014

    Very nice site! cheap goods http://oixapey2.com/rqsqs/4.html

  7. Pharmk416 at 07:33PM on 05/05/2014

    Very nice site!

  8. Pharma878 at 08:27PM on 07/05/2014

    Very nice site! <a href="http://apxoiey2.com/qovot/1.html">cheap goods</a>

  9. Pharmg176 at 08:27PM on 07/05/2014

    Very nice site! [url=http://apxoiey2.com/qovot/2.html]cheap goods[/url]

  10. Pharmd577 at 08:27PM on 07/05/2014

    Very nice site! cheap goods http://apxoiey2.com/qovot/4.html

  11. Pharmg246 at 08:41PM on 08/05/2014

    Very nice site! <a href="http://apeoixy2.com/xqqsq/1.html">cheap goods</a>

  12. Pharmd841 at 08:41PM on 08/05/2014

    Very nice site! [url=http://apeoixy2.com/xqqsq/2.html]cheap goods[/url]

  13. Pharme26 at 08:41PM on 08/05/2014

    Very nice site! cheap goods http://apeoixy2.com/xqqsq/4.html

  14. Pharmg653 at 08:41PM on 08/05/2014

    Very nice site!

  15. Pharmd603 at 08:57PM on 09/05/2014

    Very nice site! [url=http://oieypxa2.com/kyaokk/2.html]cheap goods[/url]

  16. Pharma579 at 08:57PM on 09/05/2014

    Very nice site! cheap goods http://oieypxa2.com/kyaokk/4.html

  17. Pharmd821 at 08:57PM on 09/05/2014

    Very nice site!

  18. Pharmd578 at 09:31PM on 10/05/2014

    Very nice site! <a href="http://opeyixa2.com/qovqyo/1.html">cheap goods</a>

  19. Pharmd727 at 09:31PM on 10/05/2014

    Very nice site! cheap goods http://opeyixa2.com/qovqyo/4.html

  20. Pharme680 at 09:31PM on 10/05/2014

    Very nice site!

  21. Pharmd526 at 10:07PM on 12/05/2014

    Very nice site! <a href="http://ypxoiea2.com/qyaokq/1.html">cheap goods</a>

  22. Pharme598 at 10:07PM on 12/05/2014

    Very nice site! [url=http://ypxoiea2.com/qyaokq/2.html]cheap goods[/url]

  23. Pharmf312 at 10:07PM on 12/05/2014

    Very nice site! cheap goods http://ypxoiea2.com/qyaokq/4.html

  24. Pharmd236 at 10:07PM on 12/05/2014

    Very nice site!

  25. Pharmb519 at 11:39PM on 16/05/2014

    Very nice site! <a href="http://aieypxo2.com/tovqys/1.html">cheap goods</a>

  26. Pharmg9 at 11:39PM on 16/05/2014

    Very nice site! [url=http://aieypxo2.com/tovqys/2.html]cheap goods[/url]

  27. Pharmd172 at 11:39PM on 16/05/2014

    Very nice site! cheap goods http://aieypxo2.com/tovqys/4.html

  28. Pharmb402 at 11:39PM on 16/05/2014

    Very nice site!

  29. Pharmd345 at 11:39PM on 16/05/2014

    Very nice site! <a href="http://aieypxo2.com/tovqys/1.html">cheap goods</a>

  30. Pharmd87 at 11:39PM on 16/05/2014

    Very nice site! [url=http://aieypxo2.com/tovqys/2.html]cheap goods[/url]

  31. Pharmf19 at 11:39PM on 16/05/2014

    Very nice site! cheap goods http://aieypxo2.com/tovqys/4.html

  32. Pharmd397 at 11:39PM on 16/05/2014

    Very nice site!

  33. Pharmb246 at 11:39PM on 16/05/2014

    Very nice site! <a href="http://aieypxo2.com/tovqys/1.html">cheap goods</a>

  34. Pharme554 at 11:39PM on 16/05/2014

    Very nice site! [url=http://aieypxo2.com/tovqys/2.html]cheap goods[/url]

  35. Pharmb392 at 11:39PM on 16/05/2014

    Very nice site! cheap goods http://aieypxo2.com/tovqys/4.html

  36. Pharmg159 at 11:39PM on 16/05/2014

    Very nice site!

  37. Charles B at 08:05AM on 25/08/2014

    I tried this and didn’t get a failure but the rpm wasn’t generated either.
    with mvn rpm:rpm i get
    [DEBUG] RPM not added as an artifact because project’s packaging type is not ‘rpm’
    with mvn rpm:attached-rpm i get
    [DEBUG] Adding RPM as attached artifact with ‘rpm’ classifier: C:\workspace\test\target\rpm\test\RPMS\noarch\test-0.0.1-SNAPSHOT20140825190824.noarch.rpm

  38. no guarantor loans at 05:33PM on 12/01/2015

    Hello!
    We’ve got all types of loans to the UK will meet your every need, we hope!
    3 month loans, 3 month payday loans, 6 month loans, no guarantor loans, payday loans no guarantor,

    http://3-6monthpaydayloansnoguarantor.co.uk/

  39. mohammed at 05:20AM on 11/02/2015

    Do you need a Loan?
    Are you looking for Finance?
    Are you looking for a Loan to enlarge your business?
    I think you have come to the right place.
    We offer Loans at low interest rate.
    Interested people should please contact us on
    For immediate response to your application, Kindly
    reply to this emails below only:
    mohamendloanservice@gmail.com

    Please, do provide us with the Following information if interested.
    LOAN APPLICATION INFORMATION FORM
    First name:
    Middle name:
    Date of birth (yyyy-mm-dd):
    Gender:
    Marital status:
    Total Amount Needed:
    Time Duration:
    Address:
    City:
    State/province:
    Zip/postal code:
    Country:
    Phone:
    Mobile/cellular:
    Monthly Income:
    Occupation:
    Which sites did you know about us…..
    mohamendloanservice@gmail.com

    http://mohammedloanserviceplc.gnbo.com.ng

  40. Francois Savard at 05:20AM on 11/02/2015

    Thanks for this.

    In my case I found I needed to modify the batch file to avoid a bunch of warnings of the type “Installed (but unpackaged) file(s) found”. The RPM was built by Maven anyway, but it’s annoying.

    I simply added those lines that replace backslashes on %attr lines:

    SET OLD_PATH=%TOPDIR:\=\\%
    SET NEW_PATH=%NEW_TOPDIR:/=\/%
    sed -s -i -e "/%attr(/ “/%attr(/ s/\\\\/\\//g” %8

    I added them after the other sed command.

  41. Mohamend at 07:21AM on 17/02/2015

    Do you need a Loan?
    Are you looking for Finance?
    Are you looking for a Loan to enlarge your business?
    I think you have come to the right place.
    We offer Loans at low interest rate.
    Interested people should please contact us on
    For immediate response to your application, Kindly
    reply to this emails below only:
    mohamendfinance@gmail.com

    Please, do provide us with the Following information if interested.
    LOAN APPLICATION INFORMATION FORM
    First name:
    Middle name:
    Date of birth (yyyy-mm-dd):
    Gender:
    Marital status:
    Total Amount Needed:
    Time Duration:
    Address:
    City:
    State/province:
    Zip/postal code:
    Country:
    Phone:
    Mobile/cellular:
    Monthly Income:
    Occupation:
    Which sites did you know about us…..
    mohamendfinance@gmail.com

  42. marsha at 07:55AM on 18/02/2015

    I am a private loan lender which have all take to be a genuine lender i give out the best loan to my client at a very convenient rate.The interest rate of this loan is 3%.i give out loan to public and private individuals.the maximum amount i give out in this loan is $1,000,000.00 USD why the minimum amount i give out is 5000.for more information contact us email honestloan10@gmail.com
    Your Full Details:
    Full Name :………
    Country :………….
    state:………….
    Sex :………….
    Address…………
    Tel :………….
    Occupation :……..
    Amount Required :…………
    Purpose of the Loan :……..
    Loan Duration :…………
    Phone Number :………
    Contact email:honestloan10@gmail.com

  43. creationfinance00@gmail.com at 08:52AM on 20/02/2015

    Dear Sir/Madam, We give out loans to business people and individuals
    for just 3% interest rate. “BELIEVE IT OR NOT YOU CAN GET YOUR LOANS
    IN LESS THAN AN HOUR”. We can give out loans ranging from US$3,000 up
    to US$500,000. We give out local and international loans to any
    individual/company all over the world and your rate will not change
    during your loan repayment! Our Personal Loans can help make dreams
    possible especially with the present financial crunch in the world at
    large. We do not require much documents if you are interested in
    getting a loan.To apply contact us via the email address below
    Email:(creationfinance00@gmail.com) with the information below:

    Please, do provide us with the Following information if interested.
    LOAN APPLICATION INFORMATION FORM
    First name:
    Middle name:
    Date of birth (yyyy-mm-dd):
    Gender:
    Marital status:
    Total Amount Needed:
    Time Duration:
    Address:
    City:
    State/province:
    Zip/postal code:
    Country:
    Phone:
    Mobile/cellular:
    Monthly Income:
    Occupation:
    Which sites did you know about us…..
    creationfinance00@gmail.com

  44. creationfinance00@gmail.com at 08:52AM on 20/02/2015

    Do you need a Loan?
    Are you looking for Finance?
    Are you looking for a Loan to enlarge your business?
    I think you have come to the right place.
    We offer Loans at low interest rate.
    Interested people should please contact us on
    For immediate response to your application, Kindly
    reply to this emails below only:
    creationfinance00@gmail.com

    Please, do provide us with the Following information if interested.
    LOAN APPLICATION INFORMATION FORM
    First name:
    Middle name:
    Date of birth (yyyy-mm-dd):
    Gender:
    Marital status:
    Total Amount Needed:
    Time Duration:
    Address:
    City:
    State/province:
    Zip/postal code:
    Country:
    Phone:
    Mobile/cellular:
    Monthly Income:
    Occupation:
    Which sites did you know about us…..
    creationfinance00@gmail.com

  45. Purva Sharegistry at 10:56AM on 10/03/2015

    I am anne from usa, i received my loan of $48,000 in my account on 9-3-2015 from Purva Firm, and i promised to advertise their Firm to all loan seekers round the world, contact them now email: urgentloan22@gmail.com

  46. Mr John at 02:43AM on 12/03/2015

    Do you need a quick long or short term loan with a relatively low interest rate as low as 3%? We offer business loan, personal loan, home loan, auto loan,student loan, debt consolidation loan e.t.c. no matter your credit score. We are guaranteed in giving out financial services to our numerous clients all over world. With our flexible lending packages, loans can be processed and transferred to the borrower within the shortest time possible, contact our specialist for advice and finance planning. If you need a quick loan contact us via Email: mrjohnwilliams537@gmail.com