Remove javax.annotation:javax.annotation-api #54
Merged
+100
−88
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because of historical reasons, grpc-generated Java classes have the javax.annotation.Generated annotation. This annotation was part of JDK, but after JDK 9, it moved to
javax.annotation:javax.annotation-api
(Java EE, now called Jakarta EE). So, if the JDK version is higher than 9, you need to manually addjavax.annotation:javax.annotation-api
to fix this problem. Now, Java EE has become Jakarta EE, and the package name has changed to jakarta. Many libraries have moved from javax to jakarta, but it seems this is not the goal for the grpc-java library (see grpc/grpc-java#9179). So, if you use grpc with other libraries (like Spring Boot), you will find two Generated annotations, one in the javax package and one in the jakarta package. This can be very confusing, especially for people who do not know this history well, and they might use the wrong annotation from the javax package.grpc 1.64 provides a
@generated=omit
option to configure whether the generated code includes thejavax.annotation.Generated
annotation, removing the need for thejavax.annotation:javax.annotation-api
dependency.To prevent both javax and jakarta package Generated annotations from appearing on the classpath, grpc-starter will remove the
javax.annotation:javax.annotation-api
dependency. Users can manually add this dependency or use the@generated=omit
option when generating code.Close #53