0
votes

I have problem with build path in ant build file. due to bug in gwt. I created 1 gwt package(com.google.gwt.user.client.ui) into my project & copied MenuBar class, I modified the Menubar class code to solve our problem. its work great. even i can compile it from eclipse too.

But problem is that when i run ant build file. Menu Bar class taking from gwt jar & throws exception that "unresolved methods". I want to ant builds takes MenuBar class from my project package instead of gwt jar.

Please help me out what to do for that.

Below is the build.xml file content

--> --> -->

<property name="main-class" value="com.my.project.main.Main" />
<!-- defbizserver libraries
<path id="libraries">
    <fileset dir="./libs">
        <include name="*.jar"/>
    </fileset>
</path>-->
<!-- accounter server libraries-->
<!--<path id="acclibraries">
    <pathelement location="${gwt.sdk}/gwt-user.jar"/>
    <fileset dir="${gwt.sdk}" includes="gwt-dev*.jar"/>
    <fileset dir="${acc.dir}">
        <include name="**/*.jar"/>
    </fileset>
    <pathelement location="${acc.dir}/src"/>

</path>-->
<!-- gwt  libraries-->
<path id="gwtlibraries">

    <fileset dir="${bizantragui.dir}">
        <include name="**/**.jar" />
    </fileset>
    <fileset dir="./libs">
        <include name="*.jar" />
    </fileset>
    <fileset dir="${acc.dir}">
        <include name="**/*.jar" />
    </fileset>
    <pathelement location="${src.dir}" />
    <pathelement location="${acc.dir}/src" />
    <pathelement location="${gwt.sdk}/gwt-user.jar" />
    <fileset dir="${gwt.sdk}" includes="gwt-dev*.jar" />
    <pathelement location="${bizantragui.dir}/src" />
    <!--<pathelement location="${comet.dir}/src" />-->

    <!--<pathelement location="${network.dir}/src" />-->
</path>
<fileset file="webapp" id="webapp">
    <exclude name=".svn" />
</fileset>


<target name="clean">
    <delete dir="${build.dir}" />
    <delete defaultExcludes="false">
        <fileset dir="./webapp/myprouject" />
    </delete>

</target>

<!--Compiling-->
<target name="compile" depends="check-gwtpath" if="gwt.present">
    <mkdir dir="${classes.dir}" />
    <mkdir dir="${libs.dir}" />
    <copy todir="${classes.dir}">
        <fileset dir="${acc.dir}/war/WEB-INF/classes">
            <include name="**/**" />
        </fileset>
    </copy>
    <!--<javac srcdir="${comet.dir}/src" destdir="${classes.dir}" classpathref="gwtlibraries" debug="true" />-->
    <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="gwtlibraries" debug="true" />
    <!--<javac srcdir="${network.dir}" destdir="${classes.dir}" classpathref="gwtlibraries" debug="true" />-->
    <!--<javac srcdir="${acc.dir}/src" destdir="${classes.dir}" classpathref="gwtlibraries" debug="true" />-->

</target>
<target name="gwtcompile" description="GWT COMPILATION">
    <mkdir dir="./webapp" />
    <java classpathref="gwtlibraries" fork="true" classname="com.google.gwt.dev.Compiler">
        <classpath>
            <pathelement location="${bizantragui.dir}/src" />
            <pathelement location="${acc.dir}/src" />
        </classpath>
        <jvmarg value="-Xmx1024m" />
        <arg line="-war ./webapp/" />
        <arg line="-style OBF" />
        <arg line="com.bizantra.Bizantra">
        </arg>
        <arg line="-localWorkers 2" />
    </java>
</target>


<target name="makewebapp">
    <foreach target="compress_file" param="file">
        <path>
            <fileset dir="./webapp/bizantra" id="outputhtml">
                <include name="*.cache.js" />
                <include name="**/*.js" />
            </fileset>
        </path>
    </foreach>
</target>

<target name="compress_file" description="Compress file and make gz file">
    <gzip src="${file}" zipfile="${file}.gz" />
</target>
<target name="setup" depends="compile,gwtcompile,makewebapp">
    <mkdir dir="${classes.dir}" />
    <!--    <copy todir="${classes.dir}">
        <fileset dir="./">
            <exclude name="*xml" />
            <exclude name="build.xml" />
        </fileset>
        <fileset dir="${acc.dir}/src">
            <exclude name="*xml" />
        </fileset>
    </copy>-->
    <!--<copy todir="${classes.dir}/webapp/images">
        <fileset dir="${bizantragui.dir}/war/images">
            <include name="**/*.*" />
        </fileset>
        <fileset dir="${acc.dir}/war/images">
            <include name="**/*.*" />
        </fileset>

    </copy>-->
    <!--<copy todir="${classes.dir}/webapp">
        <fileset dir="${network.dir}/war">

            <include name="**/*.html" />
            <include name="**/*.jsp" />
        </fileset>
    </copy>-->

    <mkdir dir="${classes.dir}/webapp" />

    <mkdir dir="${classes.dir}/mapping" />
    <copy todir="${classes.dir}/mapping">
        <fileset dir="./mapping">
        </fileset>
    </copy>
    <!--<copy todir="${classes.dir}/networkmapping">
        <fileset dir="./networkmapping">
        </fileset>
    </copy>-->
    <copy todir="${classes.dir}">
        <fileset dir="src/">
            <include name="**/*.properties" />
        </fileset>
        <fileset dir="${acc.dir}/src">
            <include name="**/*.properties" />
        </fileset>
    </copy>
    <copy todir="${libs.dir}">
        <fileset dir="./">
            <include name="*.jar" />
        </fileset>
    </copy>
    <jar destfile="${libs.dir}/${ant.project.name}.jar" basedir="${classes.dir}" index="true">
        <manifest>
            <attribute name="Main-Class" value="${main-class}" />
        </manifest>
    </jar>
    <delete dir="${classes.dir}">
    </delete>
</target>
<!--tar Setup-->
<target name="linux-setup-tar" depends="setup">
    <copy todir="${setup.dir}/tar">
        <fileset dir="./">
            <include name="config/**" />
            <include name="libs/**" />
        </fileset>
    </copy>
    <copy todir="${linuxtar-lib.dir}">
        <fileset dir="${libs.dir}">
        </fileset>
    </copy>
    <mkdir dir="${tmp.dir}" />
    <copy todir="${tmp.dir}">
        <fileset dir="${setup.dir}/tar">
            <exclude name=".svn/*" />
        </fileset>
    </copy>
    <chmod file="${tmp.dir}/collaberserver" perm="+x" />
    <chmod file="${tmp.dir}/collaberserverd" perm="+x" />
    <tar destfile="${output.dir}/bizantra-1.0.tar" basedir="${tmp.dir}" />
    <gzip destfile="${output.dir}/bizantra-1.0.tar.gz" src="${output.dir}/bizantra-1.0.tar" />
    <delete dir="${tmp.dir}" />
    <delete file="${output.dir}/bizantra-1.0.tar" />
</target>

<!--Windows Setup-->
<target name="win-setup" depends="setup">
    <copy todir="${setup.dir}/windows">
        <fileset dir="./">
            <include name="libs/**" />
        </fileset>
    </copy>
    <copy todir="${win-lib.dir}">
        <fileset dir="${libs.dir}">
            <include name="*.jar" />
        </fileset>
    </copy>
    <exec command="makensis ${setup.dir}/windows/BizantraSetup.nsi">
    </exec>
    <copy todir="${output.dir}">
        <fileset dir="${setup.dir}/windows">
            <include name="BizantraSetupWithJRE.exe" />
        </fileset>
    </copy>
    <delete>
        <fileset dir="${setup.dir}/windows">
            <include name="BizantraSetupWithJRE.exe" />
        </fileset>
    </delete>

    <move todir="${output.dir}">
        <fileset dir="${setup.dir}/windows">
            <include name="Bizantra.exe" />
        </fileset>
    </move>
</target>

<target name="clean-setup" depends="clean,setup" />
<target name="setupandclean" depends="clean-setup,linux-setup-tar,win-setup" />

1
Please some one help me......................kumar kasimala
Is your com.google.gwt.use.client.ui package inside your /src path? Can you copy&paste your ANT build.xml file? Can you copy&paste the stacktrace from the ANT build? That would help to find the problem ;)Carlos Tasada
Yeah sure. I will update my question with ant build xml file. stracktrace from ant build is CloseAll() method is not found in the MenuBar. it is compiler exception just because I modified Menu bar class & added CloseAll Method for my purpose. Ant Builds take Menu bar class from GWT jar instead of my project src/gwtpackge/MenuBarkumar kasimala
I don't know if you were able to solve this question (if so maybe you can answer your own question) but if you weren't able I can tell you that I saw two similar questions in SO regarding how to get ant to use your sources before an external jar. Can't find it now but just search for +ant +javac +jarIttai

1 Answers

0
votes

You need to have your source earlier in the classpath than the GWT source so that your version of MenuBar is found first.

It looks like you're using both a classpathref attribute and nested classpath element in your GWT compilation task. The nested classpath appears redundant. I'm not saying that's necessarily the cause of your problem, but I would suggest that you spend some time tidying up the classpath declarations. I would guess that you'll fix the problem in the process. If not, it will at least be easier to see what's going on in your classpath.