You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given the age of that bug and the lack of activity, I was thinking about possible workarounds via plexus-compiler-eclipse.
What if EclipseJavaCompiler would delete target/generated-sources/annotations (or .../generated-test-sources/...) before calling ECJ?
Maybe controlled by a flag?
I would really like to use ECJ in my Maven projects because it's so much faster than javac and it also minimizes the risk of differences between IDE (Eclipse) and command line, but not being able to compile without clean (when e.g. mapstruct is involved) is a showstopper.
After digging deeper, I think the issue actually lies within this module (plexus-compiler) and not within ECJ!
When I patch EclipseJavaCompiler to use AbstractCompiler.getSourceFiles(CompilerConfiguration) (instead of it's own logic) to gather allSourcesthen the problem vanishes! This is due to the fact that then the explicit CompilerConfiguration.sourceFiles are preferred over CompilerConfiguration.sourceLocations.
The crucial thing at this point is that target/generated-sources/annotationsis a sourceLocation, but none of its files are part of the sourceFiles (which I suppose are coming from maven-compiler-plugin).
Now, what's very interesting and revealing: When I patch AbstractCompiler.getSourceFiles(CompilerConfiguration) to ignore sourceFiles and use sourceLocations instead, then javac fails the same way ECJ is failing!
For me this is enough proof that the problem is in how this module is passing sources to ECJ (and potentially also Javac).
I'll create a PR changing EclipseJavaCompiler to use AbstractCompiler.getSourceFiles(CompilerConfiguration).
But as I outlined above, if (for whatever reason) CompilerConfiguration.sourceFiles is empty, then the problem will kick in again, for both compilers!
Ignoring files in target/generated-sources/annotations and only setting it via -sourcepath would solve this, but what if some "standalone" annotation processor is writing to this directory? Are there even such processors/plugins in 2022? Processors are usually run via the compiler these days...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi!
Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=542090#c43 for the general problem.
Given the age of that bug and the lack of activity, I was thinking about possible workarounds via
plexus-compiler-eclipse.What if
EclipseJavaCompilerwould deletetarget/generated-sources/annotations(or.../generated-test-sources/...) before calling ECJ?Maybe controlled by a flag?
I would really like to use ECJ in my Maven projects because it's so much faster than javac and it also minimizes the risk of differences between IDE (Eclipse) and command line, but not being able to compile without
clean(when e.g. mapstruct is involved) is a showstopper.WDYT?
Cheers,
Falko
All reactions