Monthly Archives: July 2014

Access to Ant properties from IzPack XML

Inside the installation XML the access to Ant properties per

@{ant.property.name}

will only work, if you insert the whole XML content as CDATA into the build.xml

<IzPack output="${dist.dir}/IzPack-install.jar"
        installerType="standard"
        basedir="${dist.dir}"
        IzPackDir="${dist.dir}/">
        <config><![CDATA[
<installation version="1.0">
   <info>
      <appname>@{my.app.name.defined.in.build.xml}</appname>
      ...
   </info>
...
        ]]></config>
</IzPack>

If you use different files, the properties are unknown within the IzPack file. But there is a simple solution: Copy the install.xml into a temporary file and expand the properties during this step.

<target name="installer" depends="jar" description="compiles the IzPack installer">
	<copy overwrite="yes" verbose="yes" file="${dir.install}/izpack/install-definition.xml" tofile="${java.io.tmpdir}/install-definition.xml">
		<filterchain>
			<expandproperties />
		</filterchain>
	</copy>
	<IzPack input="${java.io.tmpdir}/install-definition.xml" output="${dir.dest}/${app.name}-install.jar" installerType="standard" basedir="${basedir}" />
</target>

So you can use ${app.name} inside the install.xml (don’t use @{app.name}). But you shouldn’t use Ant properties, which are redefined by IzPack itself or in a <variable> tag section. These properties are expanded before Ant calls IzPack and could contain the wrong values.

Special characters within IzPack XML

If you need some defined XML entities like é within the IzPack installation XML, you can’t use it there. The reason: they aren’t defined. But you can define a subset within your XML:

  <?xml version="1.0" encoding="iso-8859-1" ?>
  <!DOCTYPE installation [
  <!ENTITY % iso-lat1 PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN//XML"
                    "http://www.oasis-open.org/docbook/xmlcharent/0.3/iso-lat1.ent">
  %iso-lat1;
  ]>
  <installation version="1.0">
    <!-- start here -->
  </installation>

These additional lines include the usual entities. It is now possible to use:

  <authors>
    <author name="Andr&eacute; Rothe" email="andre.rothe@domain.local" />
  </authors>

Safe copy of directories

Use


rsync -avx --progress /source/ /dest

to copy the complete content of /source into /dest, the source folder itself wont be copied (trailing /). Remove the slash and you will copy the /source folder and its content into /dest.

Use


rsync -avx --progress /source/ user@remote-host:port/dest

for syncronization between workstations.

Code Formatter Eclipse

Today I had the problem, that I had installed a new Eclipse on my workstation, but I forgot the code style configuration at home. I tried to connect per SSH, but I have no X server on the machine at home. So I cannot run Eclipse to export the configuration as XML. But there is a simple solution for that, copy the information from the right configuration file.

You can find the formatter profiles in the file

/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs

There is a very long line starting with org.eclipse.jdt.ui.formatterprofiles, which you can copy to your local installation. Close your Eclipse and restart it after the change and you will find the new formatter in the drop-down-list within the preferences.

The better way would be to export the formatter definitions as XML within Eclipse and check-in the file into your Subversion/Git.