Skip to content

Conversation

fjalvingh
Copy link
Contributor

This updates the plexus-compiler-eclipse to use the the formal API for compilation (BatchCompiler) instead of the internal "Compiler" and the other internal classes used.
This was needed to properly implement support for annotation processors in Maven; the plugin now accepts annotation processors and configures the eclipse compiler to properly use them.

The tests in the module succeed, and I was able to compile a large project with it without trouble.

INameEnvironment env = new EclipseCompilerINameEnvironment( sourceCodeLocator, classLoader, errors );

IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.proceedWithAllProblems();
//URL[] urls = new URL[1 + classpathEntries.size()];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove if it's not needed anymore

{
settings.put( CompilerOptions.OPTION_MethodParametersAttribute, CompilerOptions.GENERATE );
}
if(config.isShowDeprecation()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you using tabs or spaces? we use spaces here in this project

args.add(value);
}

//settings.putAll( extras );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove if it's not needed anymore

@fjalvingh
Copy link
Contributor Author

I have removed all obsolete code and tabs should be fixed. I also changed some extra things:

  • passing compiler options was fixed. The BatchCompiler requires options to start with a dash, so the code that removed dashes was removed because that would fail with certainty.
  • I mostly removed the Java version number checks as it depended on non public API, and it is a better plan to let the compiler itself check the version number. Java releases will come once each half year, and having to release just to add a version number is wasteful. Passing an incorrect version number will still nicely give an error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project to.etc.domui.demo: Fatal error compiling: java.io.IOException: Failed to run the ECJ compiler:
[ERROR] source level should be comprised in between '1.3' and '1.9' (or '5', '5.0', ..., '9' or '9.0'): 1.18

@fjalvingh
Copy link
Contributor Author

btw: one thing that is missing is writing compiler stdout/stderr output and the invocation to the screen when maven is started with -X. I tried to do that with getLogger().debug() but that apparently does not work. I cannot find how to do this proper so if anyone knows I would gladly fix that.

@olamy olamy merged commit 63b5fa6 into codehaus-plexus:master Apr 3, 2018
@fjalvingh
Copy link
Contributor Author

Thanks a lot for merging! Please feel free to contact me if someone has trouble with the new version.

BTW: when would the new version be published to the repo's?

@olamy
Copy link
Member

olamy commented Apr 4, 2018

done & dusted release!

@fjalvingh
Copy link
Contributor Author

That is great!!! Thanks a lot, I just built my production version with the new release!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants