• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

help needed in ant

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to use ant to be able to compile java files.
Installed ant in d:\ant
set ant_home and path.

Copied my source files to d:\ant\src (it contains packages)

Made build.xml file in ant folder

<?xml version="1.0" encoding="UTF-8"?>

<project name="M" default="release" basedir=".">
<description>simple example build file
</description>

<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="release" location="release"/>

<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>

<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>

<target name="release" depends="compile"
description="generate the release" >
<!-- Create the release directory -->
<mkdir dir="${release}/lib"/>

<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${release}/lib/M.jar" basedir="${build}">
<manifest>
<attribute name="Implementation-Title" value="com.p1.p2.main"/>
<attribute name="Implementation-Vendor" value="Me Inc."/>
<attribute name="Implementation-Version" value="1.0"/>
<attribute name="Main-Class" value="com.p1.p2.main.App"/>
</manifest>
</jar>
</target>

<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${release} directory trees -->
<delete dir="${build}"/>
<delete dir="${release}"/>
</target>
</project>

wrote ant on prompt
got the following error message

Buildfile: build.xml does not exist!
Build failed
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I presume you are running ant from the directory your build.xml is in?
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also use the "-buildfile [path to the build script]" argument if you don't want to run Ant from where your build.xml is located.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic