ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim White <>
Subject Re: How to javac *only* the .java file I am currently editting?
Date Fri, 14 Sep 2001 03:11:00 GMT
It is done thusly:

<?xml version="1.0"?>
<project name="javac" default="compile" basedir=".">
    <property file="" />

    <property name="src" value="${basedir}"/>
    <property name="build.classes" value="${basedir}/build/classes"/>
    <property name="build.debug" value="off"/>
    <property name="build.optimize" value="off"/>

    <target name="prepare">
       <mkdir dir="${build.classes}" />

    <target name="compile" depends="prepare">
       <javac srcdir="${src}"
              debug="${build.debug}" optimize="${build.optimize}">
          <include name="${file}"/>

Invoke with:

ant -Dfile=blah/


At 10:57 PM 9/13/2001 -0400, Eryq wrote:
>Conor MacNeill wrote:
> > It cannot be done unless you are prepared to put support for this into 
> the buildfile. Typically this could be accomodated by having a new 
> target, which is only run if a property is defined. That property would 
> be set to the file name to be compiled and would be used to adjust the 
> include pattern for javac. The normal compile target would set this 
> pattern to compile all files. You would then need to configure emacs to 
> ask for the special target and pass the property specifiying the file to 
> be compiled.
>Ummm... given that "make" has had pattern-based targets
>for *decades*, doesn't this strike you as kind of a glaring
>omission for a tool that seeks to replace "make", and
>whose documentation talks about "make"'s shortcomings?
>If I'm using an editor to edit a single file,
>the most typical action is to rebuild the thing I'm editting,
>particularly in the rapid compile-oops_a_typo-edit-recompile
>loop.  The second-most-typical action is to rebuild all
>files in that same directory.  Rebuilding the world
>comes in third because it takes so darn long.
>I don't mind having to tell "ant" something like:
>         ant compile -class com.zeegee.Foo.class
>but not having this be part of the core functionality
>is irritating from a developer standpoint.
>Is there any plan to add pattern-based targets to
>"ant", along the lines of make's typical "here's
>how to build a target which looks like X"?

James P. White                 Netscape DevEdge Champion for IFC
IFC Exchange   *   Insanely great Java   * Pagesmiths' home is
View raw message