Need help with AntActionInstallerListener

55 views
Skip to first unread message

Oliver Kersten

unread,
Mar 7, 2016, 10:25:21 AM3/7/16
to izpack-user
Hello,
for many hours I try to bring the "AntActionInstallerListener" to run, but it does not work.
I use IzPack 5.0.7 with Ant 1.9.6 and Java 8. There is no error during installer creation or installation. It just does not do anything with my test Ant script in the installer.
Here is a simple project to show what I've done. Maybe someone can help me to find my fault.
Thank you in advance.
ciao, Oliver

>>>>>>>>> Ant-Build-Script
<?xml version="1.0"?>

<!-- Ant Skript für die Erstellung eines Update-Installers. -->
<project name="TestMe" default="install">
    
    <property name="path.izpack" value="C:/Entwicklung/Programme/IzPack" />
    
    <path id="build.classpath">
        <fileset dir="${path.izpack}">
            <include name="lib/*.jar" />
        </fileset>
    </path>
    <taskdef name="izpack" classpathref="build.classpath" classname="com.izforge.izpack.ant.IzPackTask" />
 
    <target name="install">
        <izpack input="installTest.xml"
                output="TestInstall.jar"
                installerType="standard"
                inheritAll="true"
                basedir="${basedir}"
                izPackDir="${path.izpack}/" />
    </target>
    
</project>

>>>>>>>>>> IzPack Input XML
<izpack:installation version="5.0"
                     xmlns:izpack="http://izpack.org/schema/installation"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 
  <info>
    <appname>TestApp</appname>
    <appversion>1.0.0</appversion>
    <javaversion>1.6</javaversion>    
  </info>
  
  <locale>
    <langpack iso3="deu"/>
  </locale>
 
  <guiprefs width="600" height="480" resizable="no">
  </guiprefs>
 
  <panels>
    <panel classname="TargetPanel"/>
    <panel classname="PacksPanel"/>
    <panel classname="InstallPanel"/>
    <panel classname="FinishPanel"/>
  </panels>
  
  <listeners>
  <listener classname="AntActionInstallerListener" stage="install" />
  </listeners>
     
  <packs>
    <pack id="pack.core" name="core" required="yes" >
      <description>core</description>
      <fileset dir="C:/temp/TestFolder" targetdir="${INSTALL_PATH}/MyFolder" override="true"/>
    </pack>
  </packs>
  
  <resources>
  <res id="AntActionsSpec.xml" src="AntActionsSpec.xml" />
    <res id="MyTestScript" src="TestScript.xml" />
  </resources>
  
  <jar src="ant.jar" stage="both"/>
  <jar src="ant-launcher.jar" stage="both"/>
  
</izpack:installation>

>>>>>>> AntActionsSpec.xml
<izpack:antactions version="5.0"
                   xmlns:izpack="http://izpack.org/schema/antactions"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

<pack name="pack.core">
<antcall buildresource="MyTestScript" order="beforepacks" logfile="${INSTALL_PATH}/antlog.log">
<target name="testMe"/>
<property name="install.path" value="${INSTALL_PATH}"></property>
</antcall>
</pack>

</izpack:antactions>


>>>>>>>>>> Ant Test Script in Installer
<?xml version="1.0"?>

<!-- Ant Skript für das Backup vor der Installation. -->
<project name="TestScript" default="testMe">
    
    <target name="testMe">
        <mkdir dir="${install.path}\MyAntTestFolder"/>
    </target>
    
</project>

René Krell

unread,
Mar 8, 2016, 2:42:32 AM3/8/16
to izpac...@googlegroups.com
Hi Oliver,

the answer seems to be simple:
In AntActionsSpec.xml, change:
<pack name="pack.core">
to
<pack name="core">

Unfortunately you have to use the 'name' attribute as identifier here,
not the 'id' of a pack.
This is a long-standing logical mistake in IzPack but we didn't want
to change it to not break too much. Maybe in some next major version.
We should probably add a cross check here during compiling, whether
the referenced pack exists at all to avoid such failures. I will
create an issue for this to not forget.

René
> --
> You received this message because you are subscribed to the Google Groups
> "izpack-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to izpack-user...@googlegroups.com.
> To post to this group, send email to izpac...@googlegroups.com.
> Visit this group at https://groups.google.com/group/izpack-user.
> For more options, visit https://groups.google.com/d/optout.

René Krell

unread,
Mar 8, 2016, 3:05:10 AM3/8/16
to izpack-user
Here is an issue to add the compiler cross check for referenced packs in AntActionSpec.xml: https://izpack.atlassian.net/browse/IZPACK-1374.

Oliver Kersten

unread,
Mar 8, 2016, 5:12:25 AM3/8/16
to izpack-user
Hi René,
thanks a lot. The only thing that was missing too, is a reference on the common-io.jar 
Now it works.
Have a nice day.
ciao, Oliver

René Krell

unread,
Mar 8, 2016, 6:12:37 AM3/8/16
to izpac...@googlegroups.com
A reference to commons-io.jar?
What needed this, any stacktrace? Needed by the native
AntActionInstallerListener or some additional tasks?

Oliver Kersten

unread,
Mar 8, 2016, 7:43:24 AM3/8/16
to izpack-user
Hi Renè,
I'am not sure who need this. Perhaps it's because I'am using ant mkdir in my ant script.

Here is the stacktrace:

FEIN: Panel 'FinishPanel_3' can be shown
com.izforge.izpack.event.AntActionInstallerListener performAllActions
FEIN: Executing all beforepack Ant actions of pack mycore ...
Exception in thread "IzPack - Unpacker thread" java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
        at com.izforge.izpack.event.AntAction.createLogger(AntAction.java:519)
        at com.izforge.izpack.event.AntAction.performAction(AntAction.java:162)
        at com.izforge.izpack.event.AntAction.performInstallAction(AntAction.java:118)
        at com.izforge.izpack.event.AntActionInstallerListener.performAllActions(AntActionInstallerListener.java:310)
        at com.izforge.izpack.event.AntActionInstallerListener.beforePack(AntActionInstallerListener.java:200)
        at com.izforge.izpack.installer.event.InstallerListeners.beforePack(InstallerListeners.java:190)
        at com.izforge.izpack.installer.unpacker.UnpackerBase.unpack(UnpackerBase.java:429)
        at com.izforge.izpack.installer.unpacker.UnpackerBase.unpack(UnpackerBase.java:251)
        at com.izforge.izpack.installer.unpacker.UnpackerBase.run(UnpackerBase.java:236)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 10 more

René Krell

unread,
Mar 8, 2016, 8:15:29 AM3/8/16
to izpack-user
Oops. I'd claim this is a bug.
Normally, there should be all classes built-in needed by the Ant action execution functionality except dependencies that Ant and native or additional Ant tasks need.

Thus... good catch, Oliver :-)
I'll create an issue for this.


Dne úterý 8. března 2016 13:43:24 UTC+1 Oliver Kersten napsal(a):

René Krell

unread,
Mar 8, 2016, 9:07:32 AM3/8/16
to izpack-user
Here it is: https://izpack.atlassian.net/browse/IZPACK-1376

Dne úterý 8. března 2016 14:15:29 UTC+1 René Krell napsal(a):

René Krell

unread,
Mar 10, 2016, 6:55:22 AM3/10/16
to izpack-user
This issue is fixed by the following pull request: https://github.com/izpack/izpack/pull/482.
From 5.0.8 you can remove the explicit definition of commons-io.jar, it will be built-in automatically.


Dne úterý 8. března 2016 11:12:25 UTC+1 Oliver Kersten napsal(a):
Reply all
Reply to author
Forward
0 new messages