I just started playing with ant to see if it meets my development staffs
needs.  Testing as many "unusual" things I could think of, I came across
something I couldn't get working.  (bug?)

I'm trying to create a java rule to kick off a static inner class.  The
source would be something like this:

class Testee {
    Testee( ) {
        System.out.println( "testee constructor" );
    }

    static class Test {
        public static void main( String args[] ) {
                Testee a = new Testee();
        }
    }
}

The java command line would be:

        java Testee$Test

My first problem was getting the string correct for the java classname
attribute because of the '$'.  Leaving it as classname="Testee$Test" ends up
removing the '$' from the string.  The "ds" property is included to address
this.

Here's the idea in ant build format (this may not be syntactically correct
as it's not from my real build file).

        ...snip...
    <property name="ds" value="$"/>
    <target name="run">
        <java classname="Testee${ds}Test"/>
    </target>
        ...snip...

The output is:

        Searching for build.xml ...
        Buildfile: C:\Development\projects\anttest\src\build.xml

        initialize:

        run:

        BUILD FAILED

        C:\Development\projects\anttest\src\build.xml:27:
java.lang.IllegalAccessException

        java.lang.IllegalAccessException
                at java.lang.reflect.Method.invoke(Native Method)
                at
org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:107)
                at org.apache.tools.ant.taskdefs.Java.run(Java.java:245)
                at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:122)
                at org.apache.tools.ant.taskdefs.Java.execute(Java.java:86)
                at org.apache.tools.ant.Target.execute(Target.java:142)
                at org.apache.tools.ant.Project.runTarget(Project.java:818)
                at org.apache.tools.ant.Project.executeTarget(Project.java:532)
                at org.apache.tools.ant.Project.executeTargets(Project.java:506)
                at org.apache.tools.ant.Main.runBuild(Main.java:420)
                at org.apache.tools.ant.Main.main(Main.java:149)

        Total time: 1 second


TIA.

-----------------------------------------------------------
 Todd J. Cosgrove                    [EMAIL PROTECTED]
-----------------------------------------------------------

Reply via email to