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!