With javac, it is possible to implicitly compile java files to class files from a particular source tree. In other words, it’s possible to point at a given source tree and only compile the java files that are required by the explicitly mentioned java files. Is it possible to get this same functionality when building with maven. And, if so, how would I go about doing this?
Edit: I am not speaking of defining a specific list of java source files. The standard java compiler allows for a switch which causes the compiler itself to determine the dependencies based upon the imports. If the imported classes cannot be found in the classpath, then the source path is examined to see if there is a java file for the given class. If there is, then that java file is added to the compilation.
You will have to configure the maven compiler to set which files to include/exclude:
You could also do this for different maven profiles if you wanted to include/exclude different sets of files.