Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven RPM Plugin: Relocate/prefix does not work

 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to change rpm relocate option with new prefix. When building it still uses the default value.
In RPM configuration %_prefix is default to /usr and I want to change it to /opt/company.

I have been writing in maven support for RPM where a previous RPM specification file was used:

Defined in the RPM specification file:
%define _prefix /opt/company
...
Prefix: %{_prefix}

After checking the created RPM specification file made by rpm-maven-plugin it does have these 2 values defined in it.



When I configure the mappings, I use the RPM defined values, %{_datadir}, %{_javadir} and %{_bindir}. When %{_prefix} is not defined it is default to /usr/.


When building with maven it does not find the files under /target/rpm/***/buildroot/opt/company/, but only under /target/rpm/***/buildroot/usr/
According to the specification I have done what is necessary in order to change from /usr to /opt/company, but it does not work. Any suggestions?


Seems rpm-maven-plugin creates the buildroot using the default %{_prefix} before it creates the spec-file. So the specfile is correct, but since the plugin creates the buildroot under /usr it cannot find the files under /opt/company.

[INFO] Creating directory /home/username/workspace2/myapp/target/rpm/myapp
[INFO] Creating directory /home/username/workspace2/myapp/target/rpm/myapp/BUILD
[INFO] Creating directory /home/username/workspace2/myapp/target/rpm/myapp/RPMS
[INFO] Creating directory /home/username/workspace2/myapp/target/rpm/myapp/SOURCES
[INFO] Creating directory /home/username/workspace2/myapp/target/rpm/myapp/SPECS
[INFO] Creating directory /home/username/workspace2/myapp/target/rpm/myapp/SRPMS
[INFO] Creating directory /home/username/workspace2/myapp/target/rpm/myapp/tmp-buildroot
[INFO] Creating directory /home/username/workspace2/myapp/target/rpm/myapp/buildroot
[INFO] Copying files to /home/username/workspace2/myapp/target/rpm/myapp/tmp-buildroot/usr/bin
[INFO] Copying files to /home/username/workspace2/myapp/target/rpm/myapp/tmp-buildroot/usr/share/java
[INFO] Copying files to /home/username/workspace2/myapp/target/rpm/myapp/tmp-buildroot/usr/share/myapp
[INFO] Copying files to /home/username/workspace2/myapp/target/rpm/myapp/tmp-buildroot/usr/share/myapp
[INFO] Copying files to /home/username/workspace2/myapp/target/rpm/myapp/tmp-buildroot/usr/share/myapp
[INFO] Copying files to /home/username/workspace2/myapp/target/rpm/myapp/tmp-buildroot/usr/share/myapp
[INFO] Creating spec file /home/username/workspace2/myapp/target/rpm/myapp/SPECS/myapp.spec
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried running mvn with -X to see if the rpm plugin provides any additional details on what it is doing? The -X will also tell you exactly what configuration settings it is using.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic