0

I'm trying to run GWT through an ant build, because I want to implement it in my java project. My build.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<project name="test-exporter" default="devmode">

<property name="lib" location="war/WEB-INF/lib"/>

<path id="gwt.classpath">
    <fileset dir="${lib}">
        <include name="*.jar"/>
    </fileset>
</path>

<target name="devmode">
    <java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
        <classpath refid="gwt.classpath"/>
        <jvmarg value="-Xmx1024M"/>
        <jvmarg value="-XX:MaxPermSize=256m" />
        <jvmarg value="-XX:+UseCompressedOops" />
        <arg value="-startupUrl"/>
        <arg value="Test.html"/>
        <arg line="-bindAddress" />
        <arg line="0.0.0.0" />
        <arg value="com.test.Test"/>
    </java>
</target>

</project>

But when I'm trying to run this, GWT says that it can't find my /com/test/Test.gwt.xml. The Test.gwt.xml file is located in package com.test so it should be able to find it. Do I have to add the .xml to the classpath aswell? Running it with the Eclipse plugin works, but I'm really looking to run it through ant build

4

2 回答 2

1

您没有指定<pathelement location="src"/>. 请参阅下面正确的 build.xml。

 <?xml version="1.0" encoding="UTF-8"?>
    <project name="test-exporter" default="devmode" >

    <property name="lib" location="war/WEB-INF/lib"/>

    <path id="gwt.classpath">
        <fileset dir="${lib}">
            <include name="*.jar"/>
        </fileset>
    </path>

    <target name="devmode">
        <java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
            <classpath>
            <pathelement location="src"/>
            <path refid="gwt.classpath" />
            </classpath> 
            <jvmarg value="-Xmx1024M"/>
            <jvmarg value="-XX:MaxPermSize=256m" />
            <arg value="-startupUrl"/>
            <arg value="Test.html"/>
            <arg line="-bindAddress" />
            <arg line="0.0.0.0" />
            <arg />
            <arg value="com.test.Test"/>
        </java>
    </target>

    </project>
于 2013-01-06T16:47:10.393 回答
0

这是一个有效的devmode目标:

  <target name="devmode" depends="javac" description="Run development mode">
   <java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
     <classpath>
       <pathelement location="src"/>
       <path refid="project.class.path"/>
       <pathelement location="../../validation-api-1.0.0.GA.jar" />
       <pathelement location="../../validation-api-1.0.0.GA-sources.jar" />
     </classpath>
     <jvmarg value="-Xmx256M"/>
     <arg value="-startupUrl"/>
     <arg value="Showcase.html"/>
     <arg line="-war"/>
     <arg value="war"/>
     <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
     <arg line="${gwt.args}"/>
     <arg value="com.google.gwt.sample.showcase.Showcase"/>
   </java>
 </target>

您没有指定 GWT 参数,您必须根据您的项目对其进行修改。还有一些很好的 GWT 项目samples在 GWT 分发 zip 文件的文件夹中配置了 ant。

于 2013-01-06T16:35:20.823 回答