I'm going to stick my neck out and say that it isn't possible. As you know, there is a strict relationship between the package name and the underlying directory structure.
If you have a class defintion:
package org.acme.myproject;
public class MyClass { ... }
Then the source should be in "{$src}/org/acme/myproject/MyClass.java" and the compiled results will always go to "{$build}/org/acme/myproject/MyClass.class". I don't think there is any way in
Java to flatten out the resultant directory structure.
My advice is to un-flatten out your source directories and then
ANT will be happy.