蚂蚁build.xml不存在.构建失败



我是ANT和GWT的初学者,我正在GWT中创建一个新的ANT项目,通过遵循此GWT页面上提到的步骤:下的WebAppCreator在下创建Ant项目部分。我能够成功创建此项目,但是在命令提示符日志中,我发现了错误 build.xml!。即使在此处提到的所有步骤之后,我也无法解决此问题:ant build.xml文件不存在。

这是我的命令提示符日志:

C:UsersTEST>webAppCreator -junit D:SELENIUMjunit-4.10.jar -out foo com.example.foo.Foo
Generating from templates: [sample, eclipse, readme, _eclipse-test, _sample-test, ant]
Created directory foo
Created directory foosrc
Created directory foosrccomexamplefoo
Created directory foosrccomexamplefooclient
Created directory foosrccomexamplefooserver
Created directory foosrccomexamplefooshared
Created directory footest
Created directory footestcomexamplefoo
Created directory foowar
Created directory foowarWEB-INF
Created directory footestcomexamplefooclient
Created file foosrccomexamplefooFoo.gwt.xml
Created file foosrccomexamplefooclientGreetingService.java
Created file foosrccomexamplefooclientGreetingServiceAsync.java
Created file foosrccomexamplefooclientFoo.java
Created file foosrccomexamplefooserverGreetingServiceImpl.java
Created file foosrccomexamplefoosharedFieldVerifier.java
Created file foowarWEB-INFweb.xml
Created file foowarFoo.css
Created file foowarFoo.html
Created file foowarfavicon.ico
Created file foo.classpath
Created file foo.project
Created file fooFoo.launch
Created file fooREADME.txt
Created file fooFooSuite-dev.launch
Created file fooFooSuite-prod.launch
Created file footestcomexamplefooFooJUnit.gwt.xml
Created file footestcomexamplefooFooSuite.java
Created file footestcomexamplefooclientFooTest.java
Created file foobuild.xml
C:UsersTEST>ant build
Buildfile: build.xml does not exist!
Build failed
C:UsersTEST>ant devmode
Buildfile: build.xml does not exist!
Build failed

这是我的build.xml文件:

<?xml version="1.0" encoding="utf-8" ?>
<project name="Foo" default="build" basedir=".">
  <!-- Arguments to gwtc and devmode targets -->
  <property name="gwt.args" value="" />
  <!-- Configure path to GWT SDK -->
  <property name="gwt.sdk" location="D:/GWT/gwt-2.8.1/gwt-2.8.1" />
  <path id="project.class.path">
    <pathelement location="war/WEB-INF/classes"/>
    <pathelement location="${gwt.sdk}/gwt-user.jar"/>
    <pathelement location="${gwt.sdk}/gwt-dev.jar"/>
    <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar"/>
    <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar"/>
    <fileset dir="war/WEB-INF/lib" includes="**/*.jar"/>
    <!-- Add any additional non-server libs (such as JUnit) here -->
  </path>
  <target name="libs" description="Copy libs to WEB-INF/lib">
    <mkdir dir="war/WEB-INF/lib" />
    <copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet.jar" />
    <copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet-deps.jar" />
    <!-- Add any additional server libs that need to be copied -->
  </target>
  <target name="javac" depends="libs" description="Compile java source to bytecode">
    <mkdir dir="war/WEB-INF/classes"/>
    <javac srcdir="src" includes="**" encoding="utf-8"
        destdir="war/WEB-INF/classes"
        source="1.7" target="1.7" nowarn="true"
        debug="true" debuglevel="lines,vars,source">
      <classpath refid="project.class.path"/>
    </javac>
    <copy todir="war/WEB-INF/classes">
      <fileset dir="src" excludes="**/*.java"/>
    </copy>
  </target>
  <target name="gwtc" depends="javac" description="GWT compile to JavaScript (production mode)">
    <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler" maxmemory="512m">
      <classpath>
        <pathelement location="src"/>
        <path refid="project.class.path"/>
      </classpath>
      <arg line="-war"/>
      <arg value="war"/>
      <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
      <arg line="${gwt.args}"/>
      <arg value="com.example.foo.Foo"/>
    </java>
  </target>
  <target name="devmode" depends="javac" description="Run development mode (pass -Dgwt.args=-nosuperDevMode to fallback to classic DevMode)">
    <java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode" maxmemory="1g">
      <classpath>
        <pathelement location="src"/>
        <path refid="project.class.path"/>
        <pathelement location="${gwt.sdk}/gwt-codeserver.jar"/>
      </classpath>
      <arg value="-startupUrl"/>
      <arg value="Foo.html"/>
      <arg line="-war"/>
      <arg value="war"/>
      <!-- Additional arguments like -style PRETTY, -logLevel DEBUG or -nosuperDevMode -->
      <arg line="${gwt.args}"/>
      <arg value="com.example.foo.Foo"/>
      <arg value="com.example.foo.Foo"/>
    </java>
  </target>
  <target name="javac.tests" depends="javac" description="Compiles test code">
    <javac srcdir="test" includes="**" encoding="utf-8"
      source="1.7" target="1.7" nowarn="true"
      destdir="war/WEB-INF/classes"
      debug="true" debuglevel="lines,vars,source">
      <classpath location="D:SELENIUMjunit-4.10.jar"/>
      <classpath refid="project.class.path"/>
    </javac>
  </target>
  <target name="test.dev" depends="javac.tests" description="Run development mode tests">
    <mkdir dir="reports/htmlunit.dev" />
    <junit fork="yes" printsummary="yes" haltonfailure="yes" maxmemory="256m">
      <sysproperty key="gwt.args" value="-devMode -logLevel WARN -war www-test" />
      <sysproperty key="java.awt.headless" value="true" />
      <classpath>
        <pathelement location="src" />
        <pathelement location="test" />
        <path refid="project.class.path" />
        <pathelement location="D:/GWT/gwt-2.8.1/gwt-2.8.1/validation-api-1.0.0.GA.jar" />
        <pathelement location="D:/GWT/gwt-2.8.1/gwt-2.8.1/validation-api-1.0.0.GA-sources.jar" />
        <pathelement location="D:SELENIUMjunit-4.10.jar" />
      </classpath>
      <batchtest todir="reports/htmlunit.dev" >
        <fileset dir="test" >
          <include name="**/*Suite.java" />
        </fileset>
      </batchtest>
      <formatter type="plain" />
      <formatter type="xml" />
    </junit>
  </target>
  <target name="test.prod" depends="javac.tests" description="Run production mode tests">
    <mkdir dir="reports/htmlunit.prod" />
    <junit fork="yes" printsummary="yes" haltonfailure="yes" maxmemory="256m">
      <sysproperty key="gwt.args" value="-logLevel WARN -war www-test" />
      <sysproperty key="java.awt.headless" value="true" />
      <classpath>
        <pathelement location="src" />
        <pathelement location="test" />
        <path refid="project.class.path" />
        <pathelement location="D:/GWT/gwt-2.8.1/gwt-2.8.1/validation-api-1.0.0.GA.jar" />
        <pathelement location="D:/GWT/gwt-2.8.1/gwt-2.8.1/validation-api-1.0.0.GA-sources.jar" />
        <pathelement location="D:SELENIUMjunit-4.10.jar" />
      </classpath>
      <batchtest todir="reports/htmlunit.prod" >
        <fileset dir="test" >
          <include name="**/*Suite.java" />
        </fileset>
      </batchtest>
      <formatter type="plain" />
      <formatter type="xml" />
    </junit>
  </target>
  <target name="test" description="Run development and production mode tests">
    <antcall target="test.dev" />
    <antcall target="test.prod" />
  </target>
  <target name="build" depends="gwtc" description="Build this project" />
  <target name="war" depends="build" description="Create a war file">
    <zip destfile="Foo.war" basedir="war"/>
  </target>
  <target name="clean" description="Cleans this project">
    <delete dir="war/WEB-INF/classes" failonerror="false" />
    <delete dir="war/foo" failonerror="false" />
  </target>
</project>

有人可以帮我解决这个问题吗?

看来您的build.xml是在FOO文件夹中创建的。查看此输出:

创建的文件foo build.xml

转到FOO目录,然后运行ant

c: users test&gt; ant build

buildfile:build.xml不存在!

构建失败

这意味着TEST目录中没有构建文件。检查您的日志您在:UsersTESTfoo中有一个。因此,您应该导航到foo,而不是再通过终端尝试命令。

如果您在Mac上:

  1. 酿造安装蚂蚁;
  2. 啤酒安装常春藤;
  3. ant Ivy-bootstrap;然后进入蚂蚁项目的顶部;运行蚂蚁

相关内容

  • 没有找到相关文章

最新更新