Maven Scriptlets

时间:2011-11-10 08:43:47

标签: maven scriptlet mojo rpm-maven-plugin

当我使用Maven在NetBeans中构建项目时,我收到此警告消息:

[WARNING] DEPRECATED [postinstallScript]: Use postinstallScriplet
[WARNING] DEPRECATED [preinstallScript]: Use preinstallScriplet
[WARNING] DEPRECATED [preremoveScript]: Use preremoveScriplet

我改变了

<preinstallScript>src/main/scripts/preinstall</preinstallScript>
<postinstallScript>src/main/scripts/postinstall</postinstallScript>
<preremoveScript>src/main/scripts/preremove</preremoveScript>

<preinstallScriptlet>src/main/scripts/preinstall</preinstallScriptlet>
<postinstallScriptlet>src/main/scripts/postinstall</postinstallScriptlet>
<preremoveScriptlet>src/main/scripts/preremove</preremoveScriptlet>
pom.xml中的

。然后我收到了这个错误:

[ERROR]BUILD ERROR
------------------------------------------------------------------------
Failed to configure plugin parameters for: org.codehaus.mojo:rpm-maven-plugin:2.0.1

    (found static expression: 'src/main/scripts/postinstall' which may act as a default value).


Cause: Cannot assign configuration entry 'postinstallScriptlet' to 'class org.codehaus.mojo.rpm.Scriptlet' from 'src/main/scripts/postinstall', which is of type class java.lang.String

并没有建立项目。这有什么问题?

提前致谢。

1 个答案:

答案 0 :(得分:4)

您可能需要像这样使用它:

<preinstallScriptlet>
    <scriptFile>src/main/bin/preinstall.sh</scriptFile>
    <fileEncoding>utf-8</fileEncoding>
</preinstallScriptlet>

(根据:http://www.mojohaus.org/rpm-maven-plugin/adv-params.html