我想建立一个rpm和安装后运行2脚本。我如何通过rpm-maven-plugin来实现这一点呢?例如,我的脚本是:
/opt/sss/${component.name}/bin/mkdir.sh
/opt/sss/${component.name}/bin/starter.sh下面是我目前的pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<!-- <version>2.0-beta-3</version> -->
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<group>Applications</group>
<release>1</release>
<name>${component.name}</name>
<version>${project.version}</version>
<mappings>
<mapping>
<directory>/opt/sss/${component.name}/bin</directory>
<filemode>775</filemode>
<username>root</username>
<groupname>super</groupname>
<sources>
<source>
<location>bin</location>
</source>
</sources>
</mapping>
</mappings>
<postinstallScriptlet>bin/mkdir.sh</postinstallScriptlet>
</configuration>
</plugin>当我运行它时,我得到了这个错误:
[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.3:rpm (default-rpm) on project installation: Unable to parse configuration of mojo org.codehaus.mojo:rpm-maven-plugin:2.1.3:rpm for parameter postinstallScriptlet: Cannot configure instance of org.codehaus.mojo.rpm.Scriptlet from发布于 2015-06-04 21:17:23
我找到了1个脚本的解决方案。当我尝试设置2个脚本文件时,我会更新这个答案。
<postinstallScriptlet>
<scriptFile>bin/mkdir.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</postinstallScriptlet>发布于 2018-02-23 06:38:25
一种简单的方法是将两个脚本调用都封装在单个脚本中。像这样:
假设您有两个脚本:
script1.sh和script2.sh
编写包装器脚本(wrapper.sh):
#!/bin/bash script1.sh --一些参数脚本2.sh--一些参数
现在通过maven调用postInstallScriptlet:
......./wrapper.sh utf-8
这与PostInstallScriptlet无关,只是一个变通方法。如果有人找到了更好的方法,很高兴接受他们的方法!
如果您想了解有关高级参数的更多信息,请访问以下地址:http://www.mojohaus.org/rpm-maven-plugin/adv-params.html
https://stackoverflow.com/questions/30636699
复制相似问题