Intellij Fail with Maven Provided Dependencies

Categories: Java

For Java development, I use either Intellij or Eclipse. Both have strengths and weaknesses. I did encounter one very annoying issue with Intellij recently, and apparently it is one that JetBrains have been aware of for over two years, and haven’t shown the slightest interest in fixing. Given that my employer pays for Intellij licences, I feel justified in feeling rather disappointed.

The Intellij/maven integration is generally excellent - much faster and more stable than with Eclipse. However when running Java code from within the IDE, Intellij completely ignores any dependencies declared in the Maven pom with scope=provided. This particularly bites people who (like me) are trying to use Spring Boot, which provides tools that generate maven poms with all necessary dependencies declared. The resulting code compiles fine from the Maven commandline, and can be started via Spring-boot-specific commands. But running the code from the IDE doesn’t work - some required dependencies are not loaded.

This has been reported but is not being taken at all seriously at JetBrains.

It’s a rather tricky problem to work around; a few useful suggestions are made in the above issue-report, but none are perfect.