Wednesday, April 13, 2022

[SOLVED] Build RPM on Debian with Maven

Issue

In theory, using the rpm-maven-plugin/ and having alien install (which provides both rpm and rpmbuild binaries) it should be rather easy. But I alway get it failing with a cryptic error (because some macros are nor expanded):

$ mvn package
...
[INFO] --- rpm-maven-plugin:2.1.5:rpm (build-rpm) @ dist ---
[WARNING] rpm version string truncated to 0.2.2
[INFO] Creating directory /home/wikier/projects/foo/dist/target/rpm/foo
[INFO] Creating directory /home/wikier/projects/foo/dist/target/rpm/foo/BUILD
[INFO] Creating directory /home/wikier/projects/foo/dist/target/rpm/foo/RPMS
[INFO] Creating directory /home/wikier/projects/foo/dist/target/rpm/foo/SOURCES
[INFO] Creating directory /home/wikier/projects/foo/dist/target/rpm/foo/SPECS
[INFO] Creating directory /home/wikier/projects/foo/dist/target/rpm/foo/SRPMS
[INFO] Creating directory /home/wikier/projects/foo/dist/target/rpm/foo/tmp-buildroot
[INFO] Creating directory /home/wikier/projects/foo/dist/target/rpm/foo/buildroot
[INFO] Copying files to /home/wikier/projects/foo/dist/target/rpm/foo/SOURCES
[INFO] Copying files to /home/wikier/projects/foo/dist/target/rpm/foo/tmp-buildroot/usr/share/foo-magic-api
[INFO] Creating spec file /home/wikier/projects/foo/dist/target/rpm/foo/SPECS/foo.spec
[INFO] error: Unknown icon type: Icon_foo.png
[INFO] Building target platforms: x86-64-pc-linux
[INFO] Building for target x86-64-pc-linux
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.578 s
[INFO] Finished at: 2016-07-04T14:16:49+02:00
[INFO] Final Memory: 42M/1237M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.5:rpm (build-rpm) on project dist: RPM build execution returned: '1' executing '/bin/sh -c cd '/home/wikier/projects/foo/dist/target/rpm/foo/SPECS' && 'rpmbuild' '-bb' '--target' 'x86-64-pc-linux' '--buildroot' '/home/wikier/projects/foo/dist/target/rpm/foo/buildroot' '--define' '_topdir /home/wikier/projects/foo/dist/target/rpm/foo' '--define' '_build_name_fmt %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' '--define' '_builddir %{_topdir}/BUILD' '--define' '_rpmdir %{_topdir}/RPMS' '--define' '_sourcedir %{_topdir}/SOURCES' '--define' '_specdir %{_topdir}/SPECS' '--define' '_srcrpmdir %{_topdir}/SRPMS' 'foo.spec'' -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Anybody has some experience in a similar environment?


Solution

Got it! the log [INFO] error: Unknown icon type: Icon_foo.png should be actually ERROR, because later causes an error calling rpmbuild.



Answered By - wikier
Answer Checked By - Terry (WPSolving Volunteer)