ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Boehle <jboe...@tidestone.com>
Subject RE: Possible bugs in task javac
Date Thu, 27 Jul 2000 13:30:43 GMT
In 1.1, Ant started printing out messages before the compiler messages to
tag them for easier readibility ("[javac]").  From what I understand, this
screwed up the output error parsing in emacs.  A big thread about this topic
has been running in the AntDev list, here is one suggestion for a
workaround:

> I use the following in my JDE setup in ~/.emacs:
> 
> (require 'compile)
> (setq compilation-error-regexp-alist
> (append (list 
> ;; works for jikes
>
'("^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):\\([0-9]+\\):[0-9]+:[0-9]+:"
1
> 2 3)
> ;; works for javac
> ;; thanks to Barrie Treloar <Barrie.Treloar@camtech.com.au>
> '("^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):" 1 2))
> compilation-error-regexp-alist))

Jason Boehle
jboehle@tidestone.com

-----Original Message-----
From: Anders Janmyr [mailto:anders.janmyr@movearound.com]
Sent: Thursday, July 27, 2000 4:46 AM
To: ant-user@jakarta.apache.org
Subject: Possible bugs in task javac


Hello,

I have just downloaded ant 1.1 and I have some problems.
When I use the deprecated option in javac it does not work. No deprecation
information is printed.
Also when I use ant from inside emacs I am not able to automatically move to
the next error in the erroneous file. Instead emacs is trying to look for
the build.xml file.

This did not happen before. Is this a bug or is it supposed to be like this?

Anders

-----Original Message-----
From: Conor MacNeill [mailto:conor@m64.com]
Sent: den 27 juli 2000 11:30
To: ant-user@jakarta.apache.org
Subject: RE: New user with cyclic dependencies


> At 12:55  27/7/00 -0500, you wrote:
> >I know that if I ask javac to compile some files, and I include
> the source
> >directory as part of the classpath then javac will automatically compile
> >the imported classes as it encounters them.  It seems that ant's
> javac is
> >not doing this.
>
> hmmm - that so. I never knew that. In that case it may be possible to use
> this hack by specifying classpath attribute in javac that includes
> alternate source directories.
>

Javac, the compiler, will try to resolve class dependencies. If a class file
cannot be found, javac will look for a .java file in the same location in
the sourcepath package space and compile it.

> >I guess one solution is to include all classes with cyclic
> dependencies as
> >a single target?  I am not sure how to specify multiple
> directories for a
> >single javac task.
>
> well you can't and that is a design choice. I have never had to specify
> multiple source directories and am not sure it is needed thou if you could
> describe a use case where it is needed it may be possible to alter javac
> task. Ant makes a few assumptions about layout - namely that all source
> comes from one directory and that they are all in their respective package
> directories. So if you have the class in package com.biz.a then the src
> directory layout should be

Peter, there is no such design choice (at least, not anymore). Ant supports
multiple source paths. It does not make any assumptions about source tree
layouts. There are two ways to specify the source paths

1. Use a path in the src attribute

<javac src="../blah:..\hello;goodbye/for\now">

As I have shown here you can use either : or ; for the path separators and
either / or \ as the file separators. Ant will work out the path for your
platform.

2. Use a nested <src> element - this would be the preferred way

  <javac destdir="${build}"
         classpath="xyz.jar"
         debug="on">
    <src path="${src}" />
    <src path="${src2}" />
  </javac>

All of this is included in the documentation for the javac task.

Also note that ant will compile a file even if it is not in its proper
package space location. It will place the resulting class file in the proper
package space location in the destination build directory. I strongly
recommend against this practice. It means ant will always recompile the file
even if it is not out of date. Javac will also  not be able to determine the
source file if it is necessary to compile the file for a missing class.

Conor

Mime
View raw message