Index: applications/editors/josm/plugins/geotools/build.xml
===================================================================
--- applications/editors/josm/plugins/geotools/build.xml	(revision 35959)
+++ applications/editors/josm/plugins/geotools/build.xml	(revision 36015)
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
-  <project name="geotools" default="dist" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
+  <project name="geotools" default="dist" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">
     <!-- enter the SVN commit message -->
     <property name="commit.message" value="Commit message"/>
@@ -29,4 +29,20 @@
         <!--<include name="jackson.jar"/>-->
     </fileset>
+    <macrodef name="merge-text-files">
+      <attribute name="mergefile"/>
+      <attribute name="targetdir"/>
+      <sequential>
+        <concat destfile="@{targetdir}/@{mergefile}">
+          <restrict>
+            <rsel:name name="@{mergefile}"/>
+            <archives>
+                <zips>
+                    <fileset dir="${plugin.lib.dir}" includes="*.jar" excludes="*-sources.jar, *-javadoc.jar" erroronmissingdir="no"/>
+                </zips>
+            </archives>
+          </restrict>
+        </concat>
+      </sequential>
+    </macrodef>
 
     <target name="merge-geotools-services" depends="fetch_dependencies">
@@ -40,8 +56,12 @@
             </fileset>
         </merge-services>
-    <echo>Check the updated files in jar/META-INF/services for lines where two
-    services got merged. Example:
-    org.geotools.coverage.util.FilterFunction_isCoverageorg.geotools.filter.AreaFunction
-    </echo>
+        <echo>Check the updated files in jar/META-INF/services for lines where two
+        services got merged. Example:
+        org.geotools.coverage.util.FilterFunction_isCoverageorg.geotools.filter.AreaFunction
+        </echo>
+
+        <merge-text-files mergefile="META-INF/javax.media.jai.registryFile.jai" targetdir="jar"/>
+        <merge-text-files mergefile="META-INF/registryFile.jai"                 targetdir="jar"/>
+        <merge-text-files mergefile="META-INF/registryFile.jaiext"              targetdir="jar"/>
     </target>
 
