Is there a way in maven to specify which files in src/main/java belong
to a particular module? I do not feel much for setting up different
src/main/java (etc) folders for each module...


There should be one pom.xml per artifact (module).  The documentation says one could configure in a pom file where sources/resources/tests/etc are, instead of using standard layout.  We have to try, I don't have experience with such configuration.

The code I just mentioned handles all this.  For an example of a generated pom see:

https://maven.ch.cam.ac.uk/m2repo/org/openscience/cdk/cdk-smiles/1.2.3/cdk-smiles-1.2.3.pom

Sam

-- 
Unilever Centre for Molecular Science Informatics
Cambridge University Chemical Laboratories             Tel: 01223 763073
Lensfield Road                                    email: sea36@cam.ac.uk
Cambridge CB2 1EW