ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mika Moilanen <mikmo...@stybba.ntc.nokia.com>
Subject (javac task): Compiling depedencies doesn't work...
Date Mon, 28 Oct 2002 09:17:28 GMT
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
View raw message