Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile GWT via Ant

Tags:

java

build

ant

gwt

Is it possible to run the GWT compiler (Java to JavaScript) and perhaps run other GWT tools (such as compile reports, run in dev mode, etc.) from an Ant buildfile? If so, where are these Ant tasks defined? I don't see anything in the SDK.

I can't imagine Google would make something as powerful as GWT and force developers to only run builds out of their local Eclipse instances...how do CI builds kick this stuff off?

like image 447
IAmYourFaja Avatar asked Aug 25 '12 03:08

IAmYourFaja


People also ask

What is GWT compiler?

The heart of GWT is a compiler that converts Java source into JavaScript, transforming your working Java application into an equivalent JavaScript application. The GWT compiler supports the vast majority of the Java language. The GWT runtime library emulates a relevant subset of the Java runtime library.

How to debug GWT?

Debugging a GWT application in development mode is easy. In this case you can just debug the Java code. Put a breakpoint into your code and start the debugger via selecting your project, right-click → debug as → Web Application. You can then use standard Eclipse debugging capabilities.

Which language do you use to program in GWT?

It is important to remember that the target language of your GWT application is ultimately JavaScript, so there are some differences between running your application in dev-mode, superdev-mode, and production mode.


2 Answers

Right there in the docs, Google tells you the command-line arguments for the Compiler, DevMode, JUnit, etc.

  • Development Mode Options
  • GWT Compiler Options
  • Starting the code server (Super Dev Mode)
  • Running JUnit test cases (search for TestRunner)

And of course, there's Command-line Tools, and it talks about the webAppCreator tool that generates an Ant build file. That tools is also presented in the Getting Started page (and goes on straight with using Ant as a build tool, not even talking about Eclipse) and the tutorial.

like image 137
Thomas Broyer Avatar answered Oct 16 '22 17:10

Thomas Broyer


Is something like this you are looking for ?

   <target name="gwt-compile" depends="compile" description="GWT compile to JavaScript">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
    <classpath>
        <pathelement location="${src.dir}" />
        <pathelement location="${build.classes}" />
        <path refid="compile.classpath" />
        <path refid="gwt-dev.classpath" />
    </classpath>
    <jvmarg value="-Xmx256M" />
    <arg value="com.xxxx.xxx.xxx.xxx" />
</java>  
</target>

 <target name="devmode" depends="" description="Run development mode">
<java fork="true" classname="com.google.gwt.dev.DevMode" 
    dir="${basedir}/war" spawn="true">
    <classpath>
        <pathelement location="src" />
        <path refid="project.class.path" />
        <path refid="tools.class.path" />
    </classpath>
    <jvmarg value="-Xmx512M" />
    <jvmarg value="-javaagent:${appengine.folder}/lib/agent/appengine-agent.jar" />
    <jvmarg value="-Duser.dir=${basedir}/war" />
    <arg line="-war" />
    <arg value="${basedir}/war" />
    <arg line="-logLevel" />
    <arg value="INFO" />
    <arg value="-server" />
    <arg value="com.google.appengine.tools.development.gwt.AppEngineLauncher" />
    <arg value="net.bookedin.bam.BAM" />
</java>
</target>
like image 20
AnujKu Avatar answered Oct 16 '22 18:10

AnujKu