Maven RPM plugin not generating correct %files section - maven

I'm building a package using the Maven RPM plugin, and it's generating the %files section in the .spec file in a way that causes conflicts during installation. I want to install a file into /usr/bin, but the .spec file contains the following directive:
%attr(755,root,root) /usr/bin
This causes the RPM install to fail due to a conflict with another package which already owns that directory.
What I would like to do is have Maven specify the filename directly, which would avoid the entire issue. Here's the mapping section for that particular file:
<mapping>
<directory>/usr/bin</directory>
<filemode>755</filemode>
<sources>
<source>
<location>src/main/scripts/foobar.sh</location>
<destination>foobar</destination>
</source>
</sources>
</mapping>
Any suggestions?
(I've opened an issue at the plugin bug tracker for this)

As pointed out in the bug, the directoryIncluded[1] mapping controls this behavior. If you set this to false you will get the behavior you desire.
[1] - http://mojo.codehaus.org/rpm-maven-plugin/map-params.html#directoryIncluded

One of the maintainers answered my question on the issue tracker. It turns out that the directoryIncluded mapping does exactly what I want.

Related

Maven rpm plugin does not overwrite files

I have below configuration in pom.xml file for rpm. I want to copy a jar at specific folder when rpm runs. The code is as below in pom.xml:
<mapping>
<directory>/var/lib/abc</directory>
<filemode>777</filemode>
<username>aaa</username>
<groupname>aaa</groupname>
<sources>
<source>
<location>/opt/lib/temp.jar</location>
</source>
</sources>
</mapping>
The same configuration I have in another pom file for another rpm.
The problem is, when I run the any rpm first it created the folder, copy the file.
Working as expected but I run another rpm file, it generated error that the files are already present and not overwrite those file.
I just want to know, is there any way to overwrite those file or any way avoid the error if the files are already present to that location.
Thanks,
Atul
The issue has been resolved.
There is strange fix I did:
<filemode>777</filemode>
This line I have to added in pom file, where it was missing.
I thought, it would allow me, as the directoy is already created.

Optional mapping sections in Maven RPM plugin?

I have a Maven RPM plugin mapping thus:
<mapping>
<directory>/etc/myconfig</directory>
<configuration>true</configuration>
<sources>
<source>
<location>${project.build.directory}</location>
<includes>
<include>*.conf</include>
</includes>
</source>
</sources>
</mapping>
However, depending on the packaging process, there may be zero .conf files to put in /etc. When this occurs, RPM plugin says:
[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.2:rpm (default) on project clients:
Unable to copy files for packaging: You must set at least one file. -> [Help 1]
Is there any way to have a mapping section that is happy with including zero files?
The best I've been able to come up with is omitting the <includes> tag, which takes everything from what's specified in <location>.
location
The file or directory to include. If a directory is specified, all files and subdirectories are also included.
You will need to be as specific as possible in the path for these mappings that don't have include patterns specified. I added confs to the location below to avoid pulling in everything else in project.build.directory.
Even if no files are selected, the <directory> will still be created.
<mapping>
<directory>/etc/myconfig</directory>
<configuration>true</configuration>
<sources>
<source>
<location>${project.build.directory}/confs</location>
</source>
</sources>
</mapping>
Me too faced the same issue and was trying hard to resolve it. The error message is not so intuitive. It's really hard to address such issue.
error :
[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1-alpha-3x:attached-rpm (generate-rpm) on project XXX_assembly: Unable to copy files for packaging: You must set at least one file. -> [Help 1]
I was using below version of plugin
*
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1-alpha-3x</version>
*
Below is my Mapping tag from plugin
What this mapping was trying to is copy batch-test-1.0.war from ../batch/target location to target location at ${app.prefix}/batch
Issue was tag was having name of war file which does not exist and incorrect. i have given wrong name of war file so Maven was complaining that it should have something to copy.i corrected it by giving correct name of my war file as below.
batch-test-1.0.war

JavaFX Self Installer With Inno Setup 5 - Allow user to change install directory

I am using Ant to build a self deploying EXE for a JavaFX application.
Currently Inno Setup places the EXE here: C:\Users\username\AppData\Local\application name
I would like to place this in a different location, and provide the user the option to override this. However I can't seem to find the ant settings to change this.
Is this possible?
Thanks!
Actually you can't change this using ANT. However, as you already know the deploy mechanism uses Inno Setup and you can modify its behaviour.
During the fx:deploy ANT task a default ApplicationName.iss file is created. This default file contains e.g. the setting, which is responsible for the install directory. This default file is only created, if you don't provide any customized on your own. So, I would recommend to run the ANT script, copy the default file and modify it. If you enable the verbose flag of the fx:deploy task you can use the console output to find out, where the default file is created and where the ANT task searches for your customized file before creating the default one:
<fx:deploy
...
verbose="true">
<fx:info title="${appname}" vendor="${vendor}"/>
...
</fx:deploy>
In my case I found the default file in
C:\Users\gfkri\AppData\Local\Temp\fxbundler3627681647438085792\windows
and had to put the customized file to
package/windows/ApplicationName.iss
relative to the ANT build script.
If you got so far, you'll find the line DisableDirPage=Yes in your ApplicationName.iss file. Change it to DisableDirPage=No and the user gets the possibility to change the install directory.
Further you will find the parameter DefaultDirName. If you want to install your Application to C:\Program File\ApplicationName by default you can use the constant {pf} e.g.: DefaultDirName={pf}\ApplicationName.
The original answer is not true anymore, because that feature got added to the JDK (just dont know when, but it was there when using 1.8.0u60 or so).
Just add <installdirChooser> as some <bundleArguments> and set it to true:
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.4.0</version>
<configuration>
<mainClass>your.mainclass</mainClass>
<verbose>true</verbose>
<bundleArguments>
<identifier>SOME-GUID-USED-FOR-UPDATE-DETECTION</identifier>
<installdirChooser>true</installdirChooser>
</bundleArguments>
</configuration>
</plugin>
Disclaimer: I'm the maintainer of the javafx-maven-plugin

How to set directoryMode Permissions for folder in assembly descriptor?

I cant seem to change the output directory permissions in my assembly descriptor. It seems to be ignored entirely. The file permissions however are set correctly. I am using Maven 3.
<fileSet>
<directory>src/main/conf</directory>
<fileMode>0644</fileMode>
<directoryMode>0755/directoryMode>
<outputDirectory>conf</outputDirectory>
</fileSet>
The directories still appear as 775.
drwxrwxr-x
Is this a known bug? I even tried defining a fileset separately excluding all files and just specifying the output directory but to no avail.
Any tips or workarounds appreciated.
This appears to have been a bug (MASSEMBLY-621) with the assembly plugin. This bug was fixed in version 2.4. I too was facing this problem, upgrading the plugin from 2.3 to 2.4 resolved this issue (using Maven 2.2.1, did not test Maven 3).
Other related bugs:
MASSEMBLY-422

Maven rpm plugin does not like 'executable' as a directory path name

In the source mappings, I specify many different directories. All works well.
However if I specify the directory which has the name executable the RPM plugin returns an error code of 1. The files strangely enough are still copied to the RPM buildroot, but the RPM plugin overall fails. I renamed the directory to 'lib' and it builds fine.
Is the executable a reserved word or keyword of some sort??? The mapping below causes the build to fail. I have checked spelling and that is fine. The path exists. So why is it failing???
<mapping>
<directory>/executable</directory> //rpm directory
<filemode>0644</filemode>
<sources>
<source>
<location>/path/to/directory/executable</location> // local dir under target
</source>
</sources>
</mapping>

Resources