ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject In AntLib defined type not accessible
Date Wed, 10 Jan 2007 14:17:33 GMT
I have an AntLib for which I wrote a FileNameMapper.
I cant use that mapper from inside the antlib.xml:


antlib.xml
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<------
-8-<----
<antlib>
    <macrodef name="mask">
        <attribute name="dir"/>
        <sequential>
            <move todir="@{dir}">
                <fileset dir="@{dir}"/>
                <!--
			public String[] mapFileName(String filename) {
				return new
String[]{filename.replaceAll(from, to)};
			}
                -->
                <mapper 
 
classname="org.apache.tools.ant.taskdefs.optional.ccm.ReplaceAllMapper"
                	from="-" 
                	to="__"
                />
            </move>
        </sequential>
    </macrodef>
</antlib>
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<------
-8-<----



build.xml
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<------
-8-<----
<project xmlns:ccm="antlib:org.apache.tools.ant.taskdefs.optional.ccm"
default="menu">
    <taskdef uri="antlib:org.apache.tools.ant.taskdefs.optional.ccm"
 
resource="org/apache/tools/ant/taskdefs/optional/ccm/antlib.xml"
             classpath="../../build/antlib_ccm.jar"/>

	<target name="mapper.prepare">
		<mkdir dir="testdir/dir-1/dir-2/dir-3"/>
		<echo
file="testdir/dir-1/dir-2/dir-3/one-two-three-four-five.txt" message="a
file"/>
	</target>
	<target name="mapper.mask">
		<ccm:mask dir="testdir"/>
	</target>

</project>
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<------
-8-<----


When running normally I get "ClassNotFoundException"

The following error occurred while executing this line:
 
jar:file:/C:/ant/rzf/CCM_AntLib/build/antlib_ccm.jar!/org/apache/tools/a
nt/taskdefs/optional/ccm/antlib.xml:180:   
  java.lang.ClassNotFoundException:
org.apache.tools.ant.taskdefs.optional.ccm.ReplaceAllMapper

When invoking with -lib that works. But I dont want our developers
always to type "-lib ......" or to disrupt the "clean" Ant installation.

Any ideas with that classloader issue? (best on Java1.4+Ant 1.6.5)


Jan


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message