permaculture playing cards*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven RPM Plugin: Relocate/prefix does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven RPM Plugin: Relocate/prefix does not work" Watch "Maven RPM Plugin: Relocate/prefix does not work" New topic
Author

Maven RPM Plugin: Relocate/prefix does not work

Sverre Moe
Ranch Hand

Joined: Jul 10, 2007
Posts: 110
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

Joined: May 14, 2008
Posts: 5811
    
    7

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.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven RPM Plugin: Relocate/prefix does not work
 
Similar Threads
Tomcat url redirect problem
install error -- The packaging for this project did not assign a file to the build artifact
Trouble remotely deploying to JBoss 4 server using Maven plugin
what do these options means in tomcat 7?
Maven Glassfish Plugin