Handling java projects that don't compile
JSAbrahams opened this issue · comments
Currently java-maven-project-compiler
simply throws an exception if a project can not compile: ProjectCompilationException
. Whilst this is good, we currently don't catch this exception in the pipline.
I propose that we catch it in the pipeline, and simply log that it could not be compiled. Since we should expect to find projects which cannot compile, we should ensure that the pipeline keeps functioning even if we find such a non-compilable project, and should simply move onto the next project.
That would mean we'd have to add a logger, right? While fixing #95 isn't necessary for this issue, I think it would help.
@FWDekker I think that that addresses most of the concerns of this isssue. I think that for now it is best to see how the tool works in practice as well and see what breaks.
MavanJavaProject
should just ignore projects that don't compile and log this. At the moment however, if maven install fails an exception is thrown. This is not wrong perse but it does break the pipeline.
Perhaps we could also rewrite the next
function in the Pipeline
to catch RuntimeException
s and log these. Furthermore, every time such an exception occurs the object being mapped should probably be discarded. So next
, which functions as a mapping function, can in that case return an empty list even if the input was not empty.
This has been pretty much addressed in #198
The pipeline should now catch CompilationException
s when a library cannot be compiled so the pipeline doesn't break even if a single project doesn't compile in a list of projects.
It should however be noted that modules which implement the ProjectCompiler
interface should then actually throw CompilationException
s if compilation failed and the exception is non-critical, or else the pipeline will still break.