Maven Scriptlets

3.7k views Asked by At

when I am builting my project in NetBeans using Maven I get this warning message:

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

I change

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

to

<preinstallScriptlet>src/main/scripts/preinstall</preinstallScriptlet>
<postinstallScriptlet>src/main/scripts/postinstall</postinstallScriptlet>
<preremoveScriptlet>src/main/scripts/preremove</preremoveScriptlet>

in pom.xml. Then I got this error:

[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

and project was not built. What's wrong with this?

Thanks in advance.

1

There are 1 answers

1
makkus On

You probably need to use it like this:

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

(as per: http://www.mojohaus.org/rpm-maven-plugin/adv-params.html )