Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MPOM-453] Disable annotation processing by compiler #157

Merged
merged 3 commits into from
Jan 27, 2024

Conversation

slawekjaranowski
Copy link
Member

No description provided.

@cstamas
Copy link
Member

cstamas commented Jan 14, 2024

This can be a problem, as no way to override this later (only in java 20? "full"?) @bmarwell will tell 😄

@slawekjaranowski
Copy link
Member Author

We use sisu-maven-plugin for generating list of components, so should be ok.

@cstamas
Copy link
Member

cstamas commented Jan 15, 2024

With a grain of salt... I'd rather define compiler.proc=none property and allow that property to be changed, than this. As if project DOES need annotation processing, and is below Java 21 (see https://bugs.openjdk.org/browse/JDK-8309870) then there is no way to override it.

@kwin
Copy link
Member

kwin commented Jan 15, 2024

I think it is best practice to only enable annotation processors by their fully qualified class name. This is possible by setting https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#annotationProcessors. This should IMHO take precedence (but I haven’t checked) over proc being none.

@slawekjaranowski
Copy link
Member Author

I need more tests ... like possibility to override

@slawekjaranowski slawekjaranowski marked this pull request as draft January 16, 2024 09:08
@bmarwell
Copy link
Contributor

We could introduce a property, eg maven.compiler.apt.default or similar. Easy to override per project via .mvn/jvm.options.

I think the way to go is to introduce a new default lifecycle in the compiler plugin in both the compile and test compile Mojos.

This means running a new execution default-process in generate-sources with -proc:only and running a new execution default-test-process in generate-test-sources.

I do this in all of my projects like this.

However, not sure how incremental works with this proposal.

@slawekjaranowski
Copy link
Member Author

  • m-compiler-p proc parameter doesn't have a property
  • we can use property which can be overridded by empty value, to achieve default behavior, in child project

@slawekjaranowski slawekjaranowski marked this pull request as ready for review January 20, 2024 11:17
Copy link
Contributor

@bmarwell bmarwell left a comment

Choose a reason for hiding this comment

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

Works for me as of now. Maybe we can look into a project using an annotation processor to make use of the two phases I mentioned and see what we get from it.

Copy link
Member

@kwin kwin left a comment

Choose a reason for hiding this comment

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

LGTM, but would appreciate some comment in the code for the property

pom.xml Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants