Currently i do some runitime compilation from a src file to a jar with following steps:
First: generate source files in a dir and subdirs
/main
/submain1
/submain2
Second: Compile code (currently all in .class files go into this directory)
/builddir
Third: Generate jar from .class file into target folder
/target
compilation is done by Java ToolProviders Javacompiler
ArrayList<File> files1 = getSourceFiles();
Iterable<? extends JavaFileObject> compilationUnits1 = fileManager.getJavaFileObjectsFromFiles(files1);
JavaCompiler.CompilationTask task = compiler.getTask(null ,fileManager , null, optionList, null, compilationUnits1 );
boolean compiled = task.call();
Now my first question is, would it be better to separate all .class files into different compilation units and rebuild the same directory structure as the source files have?
And if so, how can it be done?