Intellij not recognizing autoconfiguration classes in maven dependencies
When importing a project from maven that uses Spring Boot 2.0 (and maybe other versions of spring boot) IntelliJ fails to find (or even recognize) most maven dependencies that have autoconfiguration classes in them. Most (but not all) of the core spring boot libraries (the starters) seem to function more or less, but any of the third party libraries, or any our company has written don't seem to be found. Going into the module configuration and trying to add them to the spring facet as configuration sources also fails as they aren't recognized by IntelliJ and therefore aren't available in the list of source files to pick from. So far the only way we've found to make this work is to generate a project IML file, and then manually insert a reference to the maven repo, jar, and class like so:
<file>jar://$MAVEN_REPOSITORY$/com/our/project/library/1.2.3/library-1.2.3.jar!/com/our/project/library/autoconfiguration/OurProjectLibraryAutoConfiguration.class</file>
Just to be clear, IntelliJ finds the libraries as dependencies, it just fails to recognize them as having anything at all to do with spring boot. Consequently any beans that are autowired by libraries get flagged as not being found in the context, and unless we manually inject the specific jar/class it's impossible to get IntelliJ to recognize those autoconfigured classes as being in the application context.
Has anyone else run into this problem, and does any have a better solution than what we've come up with. It's very labor intensive to do, particularly as every time one of our dependencies changes in maven we need to manually update all of our project files which isn't sustainable long term.
Please sign in to leave a comment.
Please check https://youtrack.jetbrains.com/issue/IDEA-139669 and the linked issues for the features that are already supported and for the list of the currently not supported configurations.
Yes, I already looked at that issue, but it doesn't seem to apply in this case. It isn't the beans in the autoconfigured class are being skipped, it's that IntelliJ isn't finding the autoconfigured classes at all. Even using an autoconfiguration class that uses no conditional annotations, IntelliJ still fails to find it.
Please report a new bug at https://youtrack.jetbrains.com/issues/IDEA and attach a small sample project to reproduce it: https://stackoverflow.com/help/mcve.