I believe Java will behave sanely with regard to source directories. If you have a file Foo.java declaring itself as "package x.y.z", then it can happily live as "src/Foo.java".
It's only when you try to run the thing that the JVM will complain (with the rather unhelpful error message "wrong name: x/y/z/Foo"). So if your build process builds the correct folders and stores the .class files there, it's going to work. (Not that it's very useful; after all, your build system would have to know where to put everything.)