ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <co...@cortexebusiness.com.au>
Subject Re: mapper under JavaC - patch
Date Sun, 10 Feb 2002 01:21:04 GMT
Vadim Zaliva wrote:

> Hi!
> 
> The project I am working at have some old code which does not respect
> common java source code organization with directory per package: some
> top level packages are skipped. So for example class
> com.somecompany.somepackage.someclass is located in
> src/somepackage/somclass.java not
> src/com/somecompany/somepackage/someclass.java.
> 
> This indeed confuse JavaC task, since it could not find appropriate
> .class files. I know the right way to handle this problem would be to
> reorganize the code to use right directory structure, but it is
> impossible to do yet because of some organisational issues.
> 
> I've modified JavaC task. Now you can specify <mapper> element
> within it which will control how .java files are mapped to .class files.
> If one it ommited it behaves exactly like it was behaving before:
> mapping *.java to *.class.
> 
> So for example the problem I've described above is solved by following 
> construct:
> 
> <javac debug="on" deprecation="on" srcdir="${src}" destdir="${dst}">
> <mapper type="glob" from="*.java" to="${dst}/com/somecompany/*.class"/>
> 
> The problem seems to be pretty common. It is even mentioned in ANT FAQ 
> under "why my .class files are always recompiled" and I've seen some
> similar questions in mailing lists.
> 
> The patch is attached. I think this is pretty generic modification which
> I suggest to include into future versions of JavaC task. Meanwhile, for
> internal use, I am going to make custom task, extending JavaC with this
> new syntax.
> 
> Sincerely,
> Vadim
> 


Vadim,

I have thought about doing that once or twice. Once problem is that the 
compiler itself also uses the directory layout convention when searching 
for classes to build.

An alternative solution I saw once was to copy the source to a temporary 
build location and map the compilation error messages back to the 
original source files :-)

Conor



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


Mime
View raw message