Spring Boot uses all defined dependencies (including the ones that are "optional" and "provided").
There is a special cases that Spring Boot supports: annotation processors, one for improving the performance of auto-configuration and the other to generate the meta-data for custom keys. While the former should not land in a final artifact, the latter is a bit more frequent.
There is a way to exclude them using the exclude
option of the plugin but perhaps it would be nice to detect them (like we do for devtools). That way, they would be excluded automatically as we know those are definitely not required at runtime.
Comment From: filiphr
Have you thought to provide different suggestions in how the users should use the annotation processors?
The maven compiler plugin has annotationProcessorPaths
where you can put the maven coordinates of the annotation processor and it will pull all the required things and you won't have then in your dependencies.
There is on downside in IntelliJ though. That is: IDEA-150621. However, I think that you would have bigger chances to make Jetbrains pick up the issue and resolve it :).
Comment From: philwebb
@filiphr The annotationProcessorPaths
option certainly looks like the best long-term solution, but I'm worried that IDEs won't have caught up before we want to release 2.0. We also have Gradle to consider (I'm not sure if they have an equivalent feature or not). If you'd like to raise a new issue we can look into it for a later release.
Comment From: philwebb
@snicoll I can't see any downside to adding the excludes. I think we should do it.
Comment From: filiphr
Only IntelliJ with Maven does not support that. All the others do.
- Netbeans redirects to Maven to do the build (I am not sure what they do with Gradle)
- Eclipse supports it for Maven by using m2e-apt and it's
<m2e.apt.activation>jdt_apt</m2e.apt.activation>
. (I am not entirely sure what they do for Gradle) - IntelliJ has issues with maven as I already linked in the issue and for Gradle if it redirects the build to Gradle all is OK (see plugin for Gradle).
For Gradle there is the gradle-apt-plugin that adds new configurations and you add the processors with that configuration.
I can certainly open a new issue if you prefer like that. Just wanted to share my knowledge and give an idea about a possible way of solving this on the long term
Comment From: philwebb
@filiphr Yes please to a new issue. We can keep this one for the quick exclude fix and then work on the new issue in the longer term.
Comment From: snicoll
Only IntelliJ with Maven does not support that.
@filiphr that's the exact reason why it's not referenced that way. Usability in the IDE trumps anything else so I don't see ourselves recommending an approach that doesn't work OOB in an IDE.
Comment From: filiphr
@snicoll I completely agree with you with this. I wanted to mention an alternative (that might be better for the users), when the IDE things are cleared up of course. I also thought that if a request comes from the Spring Boot team, IntelliJ might have a bigger incentive to fix the issue 😉.
In any case, I am going to open a new issue for my suggestion for the future.
Comment From: snicoll
I also thought that if a request comes from the Spring Boot team, IntelliJ might have a bigger incentive to fix the issue
Perhaps. I did ask them if they could higher the priority of the issue you've referenced.
Comment From: filiphr
Perhaps. I did ask them if they could higher the priority of the issue you've referenced.
That is great. It would actually help us in the Annotation Processor Project that I am involved in 😄.
I've also created #10645 as a separate issue to track the progress as we said that we don't want to use this one for changing the approach
Comment From: OrangeDog
IntelliJ supports annotationProcessorPaths
now. However, there's no dependency management for them in Maven. Versions will have to be specified via properties, and exclusions are not possible.
However, that appears to break some of lombok's processing, and lombok doesn't appear to work at all when added to annotationProcessorPaths
.
Comment From: OrangeDog
Further to annotationProcessorPaths
not being great:
Comment From: snicoll
Superseded by #22036
Comment From: OrangeDog
The superseding solution doesn't account for other annotation processors, which won't have the Spring Boot manifest entry?
Comment From: snicoll
Correct but this issue wasn't about those either. We can't do anything smart/out-of-the-box for the things we don't know about.
Comment From: OrangeDog
Ah yes, I was thinking of the similar issues (e.g. #13289). Is #16563 the latest plan for solving it?
Comment From: snicoll
We don't have any plans to workaround this problem further as it's induced by Maven in the first place. If you can't use annotationProcessorPath
you'll have to exclude the artifact by configuration for now I am afraid.