0

I have the following Ant target:

<target name="gwtc" depends="main-compile">
    <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
        <classpath refid="gwtc.path"/>

        <!-- Provision GWT Compiler with necessary memory. -->
        <jvmarg value="-Xmx256M"/>

        <!-- Command-line arguments to the GWT Compiler. -->
        <!-- Log everything for debugging & auditing purposes. -->
        <arg line="-logLevel"/>
        <arg value="ALL"/>

        <!-- Maximize JavaScript optimization (range is [0,9]). -->
        <arg line="-optimize"/>
        <arg value="9"/>

        <!-- Generate a Story of Your Compile (SOYC) report for auditing purposes. -->
        <arg line="-compileReport"/>

        <!-- Specify the GWT Modules to compile -->
        <arg line="${src.dir}/com/myapp/WebModule"/>
    </java>
</target>

When I run this from the Ant command line I get the following error:

gwtc:
    [java] Checking for updates
    [java] [ERROR] Invalid module name: 'src/com/myapp/WebModule'
    [java]    First launch was 13ac843ee4b

BUILD FAILED
/home/myuser/sandbox/workbench/eclipse/workspace/myapp/build/targets.xml:243: Java returned: 1

And actually, there are several GWT modules I'd like to pass to the GWT compiler, not just WebModule. How do I tweak the Ant XML to give the GWT compiler what it's looking for? Preferably, there'd be a way to specify all the modules inside the com.myapp package, and then pass that as the parameter. That way, every time I add a module I don't need to remember to go back and change the build XML.

Thanks in advance.

  • Try adding `/src` at the end of your ant property `gwtc.path`. – rsp Nov 24 '12 at 17:44
  • Thanks @rsp but then I get a failed build for: `Reference gwtc.path/src not found`. –  Nov 24 '12 at 17:47
  • I meant to add it to the value of that property that should be declared elsewhere in the buildfile or passed on the commandline maybe. – rsp Nov 24 '12 at 17:53

2 Answers2

1

You have to pass the module name to the compiler, not a file path. I.e. com.myapp.WebModule. The ${src.dir} has to be in the classpath for the compiler so it can find the module and the Java source files.

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
0

After downloading GWT from http://code.google.com/p/google-web-toolkit/downloads/list, extract the content from zip folder. Please refer the build scripts "build.xml" provided by GWT team in "sample" folder projects like "Hello" .

For multi-module projects in GWT. Refer - http://turbomanage.wordpress.com/2009/11/19/tips-on-organizing-gwt-modules/


Also, the dev compiler takes only one "final" main module.

appbootup
  • 9,537
  • 3
  • 33
  • 65