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

Downgrade core processor dependency scope #96

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

alvarosanchez
Copy link
Member

This PR changes the scope of the Micronaut Core annotation processor from api to compileOnly.

Now that Validation is separated from Core, exposing the Core processor as an API dependency is causing trouble in Maven projects. If the Core version defined in the project and the one exposed by Validation are different, both will end up in the annotation processor classpath. This is because Maven doesn't enforce dependency management rules in annotation processor classpaths, as explained in MCOMPILER-391.

Once apache/maven-compiler-plugin#180 is merged and released, we may see a solution for this issue, but regardless of that, it is incorrect to expose a Core processor (which is already in the processor classpath for all Micronaut applications).

@alvarosanchez alvarosanchez added the type: bug Something isn't working label Apr 20, 2023
@sonarcloud
Copy link

sonarcloud bot commented Apr 20, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@graemerocher
Copy link
Contributor

Just want to point out that this seems like a workaround to a bug in Maven to me 🤷‍♂️

Do note that validation is only one processor and this kind of fix would have to be applied to all annotation processors across all modules (openapi, data, serde, spring etc.)

It also means that if you define a dependency on only the processor it will not transitively pull in its required dependencies and you will likely get weird compilation errors.

@alvarosanchez
Copy link
Member Author

Just want to point out that this seems like a workaround to a bug in Maven to me 🤷‍♂️

It certainly is, acknowledged and in progress. But meanwhile, this is our only choice.

Do note that validation is only one processor and this kind of fix would have to be applied to all annotation processors across all modules (openapi, data, serde, spring etc.)

Correct. I'll come across them as needed.

It also means that if you define a dependency on only the processor it will not transitively pull in its required dependencies and you will likely get weird compilation errors.

Incorrect. This PR only changes the exposure of Micronaut Core processor. Any other dependency will be pulled in.

Like I said, regardless of the Maven bug, there is no reason for the Validation processor to expose the Core processor.

@alvarosanchez alvarosanchez merged commit 5d227b8 into master Apr 20, 2023
5 checks passed
@alvarosanchez alvarosanchez deleted the fix_processor_classpath branch April 20, 2023 13:17
alvarosanchez added a commit to micronaut-projects/micronaut-serialization that referenced this pull request Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants