ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakub.Vale...@Deio.net
Subject Re: (javac task): Compiling depedencies doesn't work...
Date Mon, 28 Oct 2002 10:04:52 GMT
Hi Mika,

I use ant just for build so I compile the code with it not more then once 
a day, and I just delete all .class files so everything gets recompiled 
every time whatever happens. So just add <delete dir="" /> to the 
"compile" target and that's it. Probably not the best way but id proved to 
be enough for me.


br,

jakub





Mika Moilanen <mikmoila@stybba.ntc.nokia.com>
10/28/2002 11:17 AM
Please respond to "Ant Users List"

 
        To:     ant-user@jakarta.apache.org
        cc: 
        Subject:        (javac task): Compiling depedencies doesn't work...


Hello!

This is a very novice question, since I've been playing with Ant only
few days now.

I'm interested to find out how Ant works, what is the fundamendal
relationship with javac? In order to find this out, I set up a dummy
project with two classes: 

                 com.foo.Foo
                 com.bar.Bar

Foo calls a method of com.bar.Bar thus has a dependency towards it.

I set up a project with directories

/vob/tms-os/experimental/java/dep/com/foo
 Foo.java
  build.xml

/vob/tms-os/experimental/java/dep/com/bar
  Bar.java

Here's my primitive build.xml:

----------------------------------------------------------
<project name="Dummy project" default="compile">
  <property name="build.sysclasspath" value="ignore"/>
  <path id="project.class.path">
    <pathelement location="/vob/tms-os/experimental/java/dep"/>
  </path>

  <target name="init" description="ultimate dependency of all other 
targets">
    <tstamp/> 
  </target>

  <target name="compile" description="ultimate Javac compilation target" 
    depends="init">
    <javac
      sourcepath=""
      srcdir="/vob/tms-os/experimental/java/dep/com/foo"
      includes="*.java"
      classpathref="project.class.path"
    />
  </target>
</project>
----------------------------------------------------------

Now, when I say "ant" on .../com/foo, it let javac to compile both
classes. But to my surprise, when I change .../com/bar/Bar.java,
Bar.class is not reproduced....Of course, if I use plain javac

                   javac -classpath /vob/tms-os/experimental/java/dep 
Foo.java

Bar.class get correctly recompiled. 

This way of using Ant would be in line with the way my project works
-- one developer is working with one package. One way to achieve
correct recompilation would be to add .../dep/com/bar also to javac
task's "srcdir", but it would cause lots of unnecessary
recompilations. 

Are there any other ways to achieve correct compilation of Foo/Bar
classes?

-- 
Best Regards, 
                 Mika
----------------------------------------------------------
mikmoila@shire.ntc.nokia.com  phone: +358-0-511-23587
Nokia Networks, PO box 320, FIN-00045 NOKIA GROUP, Finland
----------------------------------------------------------


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message