Open aonishuk opened 8 years ago
Also I wonder if there's any workaround for this issue, which I can implement in the project not waiting for the rpm-maven-plugin where this is fixed?
2 suggestions:
use:
<mapping>
<directory>/</directory>
<sources>
<source>
<location>${project.build.directory}${dirsep}${project.artifactId}-${project.version}</location>
<noDefaultExcludes>true</noDefaultExcludes> <!--add this, not sure it would work -->
</source>
</sources>
</mapping>
or split into multiple mappings, each has its own directory ( ie /etc/initd, /use/lib/xxxxx, /etc/init/xxxx, etc )
Thanks for quick response dantran.
Also I noticed that from the spec point of view this should be as simple as adding:
%exclude /etc
%exclude /etc/init.d
...
in the %files section.
I wonder If there is any way I can do that for rpm maven plugin?
I would suggest dont put high hope into this plugin to do complex mappings :-)
Hi,
two year are passed since the submission of this problem and I have fallen in the same issue.
I can't understand the "splitting" suggestion read before.
Is there any valuable way to avoid this problem?
Regards, S.
opssss,
I have tried the
<directoryIncluded>false</directoryIncluded>
and it actually worked! So now is possible to exclude some directory creation from rpm ?
Regards, S.
like 2-year-old suggestion. I no longer try to do complex mapping at rpm-m-p configuration. The simplest is to stage as much as you can under a dir under 'target' and push all into rpm-m-p in one shot
Sorry,
I am not an expert of rpm and maven, I still don't understand. let me explain, I would like to build a rpm for installing these files:
/etc/csvconverter/csvconverter.cfg
/etc/csvconverter/log4j2.xml
/urs/share/csvconverter/lib/commons-cli-1.4.jar
/urs/share/csvconverter/lib/commons-csv-1.5.jar
/urs/share/csvconverter/lib/csvconverter.jar
/urs/share/csvconverter/lib/javax.json-1.1.2.jar
/urs/share/csvconverter/lib/log4j-api-2.11.0.jar
/urs/share/csvconverter/lib/log4j-core-2.11.0.jar
/usr/lib/systemd/system/csvconverter.service
All the files but the last one are in new directory, the last one (/usr/lib/systemd/system/csvconverter.service) is in a system directory that my rpm doesn't have to create.
Which is your suggestion to achieve such a goal?
I have written a pom like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.2.0</version>
<executions>
<execution>
<id>generate-rpm</id>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<workarea>/Users/fox/Documents/workspace/2018-03-31_-_CSVConverter</workarea>
<license>xxx</license>
<distribution>xxx</distribution>
<group>Application/Collectors</group>
<packager>Stefano Bossi</packager>
<prefix>/usr/share/csvconverter</prefix>
<changelogFile>src/changelog</changelogFile>
<version>1.0</version>
<release>12345</release>
<requires>
<require>jre > 1.8</require>
</requires>
<needarch>x86_64</needarch>
<targetOS>linux</targetOS>
<mappings>
<mapping>
<directory>/usr/lib/systemd/system</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
<location>src/main/resources_deploy/csvconverter.service</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/etc/csvconverter</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<configuration>true</configuration>
<sources>
<source>
<location>src/main/resources_deploy/csvconverter.cfg</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/etc/csvconverter</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<configuration>true</configuration>
<sources>
<source>
<location>src/main/resources_deploy/log4j2.xml</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/urs/share/csvconverter/lib</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<sources>
<source>
<location>target/csvconverter-1.0.jar</location>
<destination>csvconverter.jar</destination>
</source>
</sources>
</mapping>
<mapping>
<directory>/urs/share/csvconverter/lib</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<dependency>
<includes>
<include>org.apache.commons:commons-csv:1.5</include>
</includes>
</dependency>
</mapping>
<mapping>
<directory>/urs/share/csvconverter/lib</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<dependency>
<includes>
<include>org.apache.logging.log4j:log4j-api:2.11.0</include>
</includes>
</dependency>
</mapping>
<mapping>
<directory>/urs/share/csvconverter/lib</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<dependency>
<includes>
<include>org.apache.logging.log4j:log4j-core:2.11.0</include>
</includes>
</dependency>
</mapping>
<mapping>
<directory>/urs/share/csvconverter/lib</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<dependency>
<includes>
<include>commons-cli:commons-cli:1.4</include>
</includes>
</dependency>
</mapping>
<mapping>
<directory>/urs/share/csvconverter/lib</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<dependency>
<includes>
<include>org.glassfish:javax.json:1.1.2</include>
</includes>
</dependency>
</mapping>
</mappings>
<postinstallScriptlet>
<scriptFile>src/main/resources_deploy/postInstallScript.sh</scriptFile>
</postinstallScriptlet>
</configuration>
</plugin>
Do you think this could work?
Regards, S.
looks reasonable. you can also use rpm:unpack validate
Thanks for the suggestion.
unfortunately running the installation of the package with rpm -vvvi
to debug the steps rpm
decide to take, I have:
D: ========== Directories not explicitly included in package:
D: 0 /etc/csvconverter/
D: 1 /urs/share/csvconverter/lib/
D: 2 /usr/lib/systemd/system/
D: ==========
Which is wrong, the expected is that only the /usr/lib/systemd/system/
should appear there because is the only one where I have used <directoryIncluded>false</directoryIncluded>
.
Is this a bug? Any suggestion to fix the problem?
Thanks, S.
try this
<source>
<location>src/main/resources_deploy</location>
<includes>
<include>csvconverter.cfg</include>
</includes>
</source>
After a lot of tries I finally found a configuration which works for my rpm:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.2.0</version>
<executions>
<execution>
<id>generate-rpm</id>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<workarea>/Users/fox/Documents/workspace/2018-03-31_-_CSVConverter</workarea>
<license>xxx</license>
<distribution>xxx</distribution>
<group>Application/Collectors</group>
<packager>Stefano Bossi</packager>
<prefix>/usr/share/csvconverter</prefix>
<changelogFile>src/changelog</changelogFile>
<version>1.0</version>
<release>12345</release>
<requires>
<require>jre > 1.8</require>
</requires>
<needarch>x86_64</needarch>
<targetOS>linux</targetOS>
<mappings>
<mapping>
<directory>/etc/csvconverter</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<configuration>true</configuration>
<sources>
<source>
<location>src/main/resources_deploy/log4j2.xml</location>
</source>
<source>
<location>src/main/resources_deploy/csvconverter.cfg</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/urs/share/csvconverter</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
</mapping>
<mapping>
<directory>/usr/share/csvconverter/lib</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<sources>
<source>
<location>target/csvconverter-1.0.jar</location>
<destination>csvconverter.jar</destination>
</source>
</sources>
<dependency>
<includes>
<include>org.apache.commons:commons-csv:1.5</include>
<include>org.apache.logging.log4j:log4j-api:2.11.0</include>
<include>org.apache.logging.log4j:log4j-core:2.11.0</include>
<include>commons-cli:commons-cli:1.4</include>
<include>org.glassfish:javax.json:1.1.2</include>
</includes>
</dependency>
</mapping>
<mapping>
<directory>/usr/lib/systemd/system</directory>
<filemode>644</filemode>
<username>root</username>
<groupname>root</groupname>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
<location>src/main/resources_deploy/csvconverter.service</location>
</source>
</sources>
</mapping>
</mappings>
<postinstallScriptlet>
<scriptFile>src/main/resources_deploy/postInstallScript.sh</scriptFile>
</postinstallScriptlet>
</configuration>
</plugin>
Hope this could help other guys using this plugin.
Regards, S.
I want to exclude specific directories from being included to rpm like /usr/sbin, /usr/lib, /etc/init.d, /var/lib, /var/log, /var (not it's contents though) this is critical since centos7 won't let you install rpm without doing that. Also I don't want to exclude other directories which are specific to my project (critical for empty dirs). So directoryIncluded=false works bad for me.
Excluding directories with seems not working. Once I add something to exclude it just stops listing directories at all
Here is my definition:
Here is the rpm files list I get:
This results in problems while installing the package on centos7: