0

I am trying to get my Ant build to run the granite DS Actionscript code generation task and am running into some problems. At the moment I am getting this error:

BUILD FAILED
C...\build.xml:62: Could not load Java class file: SampleDTOOne.class

So the .class files are obviously being found. I am not however sure if this error means that the it cannot load the .class file or that it cannot find the actual java source code.

My Ant task definition looks like this:

        <classpath>
            <pathelement location="C.../src/packages/" />    
        </classpath>

        <fileset dir="${base.build.dir}/jc/classes/gpbit/packageName">
            <include name="*.class" />
        </fileset>

    </gas3>

I have tried many different values for the classpath but cannot get anythign to work. I do not like the path that I am using to find the .class files but again at the moment this is the only one I can get to work. None of the variables seem to make it any easier to get to this location. The fileset is definitely working as it definitely found the .clas files to include the name in the error message.

More detailed error message:

 [gas3] Using output dir: C...trunk\plugin\build/etc/src/as3
 [gas3] Using classpath: C...\trunk\plugin\src\packages
 [gas3] Loading all Java classes referenced by inner fileset(s) {
 [gas3] java.lang.ClassNotFoundException: SampleDTOOne
 [gas3]     at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1361)

any help much appreciated

Roaders
  • 4,373
  • 8
  • 50
  • 71

1 Answers1

1

Just have a look at the documentation here. Basic usage sample is as follow:

<gas3 outputdir="as3">
    <classpath>
        <pathelement location="classes"/>
    </classpath>

    <fileset dir="classes">
        <include name="com/myapp/entity/**/*.class"/>
    </fileset>
</gas3>

Note that the class files for which you want Gas3 to process the generation (in the fileset section) must be also in the classpath section (so they can be loaded through a class loader configured with this classpath).

Hence, your configuration should look like that:

<gas3 outputdir="as3">
    <classpath>
        <pathelement location="${base.build.dir}/jc/classes"/>
    </classpath>

    <fileset dir="${base.build.dir}/jc/classes">
        <include name="gpbit/packageName/*.class"/>
    </fileset>
</gas3>

If your classes use third party jars, include them as well in the classpath.

PS: Gas3 never uses Java source code, it is only based on Java reflection.

Franck Wolff
  • 341
  • 2
  • 5