IntelliJ Scala Plugin 2021.2 EAP: Package Search Integration
Package Search is a service developed by JetBrains that supports searching for libraries from multiple repositories such as Maven Central, Google Maven, and others.
Since its introduction at the end of 2019, the Package Search plugin has made searching for and managing dependencies for Maven and Gradle projects more convenient. Starting with the Scala plugin 2021.2 release, the Package Search plugin features will also be available for sbt projects. In addition, the Package Search APIs are integrated to help users manage library dependencies directly from the IntelliJ IDEA editor.
From the Package Search plugin window, we can see the list of the library dependencies being used by an sbt main project and its subproject(s):
Add a new dependency
Follow these three simple steps to add a new dependency to your project:
- Select the desired module.
- Search for the new dependency using the Package Search plugin’s search bar.
- After finding the suitable dependency in the Search Results list, click Add to open the pop-up window that allows you to select where to add the dependency.
Another (much simpler) way to add a new dependency to a project is to use the auto-completion feature from IntelliJ IDEA’s code editor (the data used for this feature comes from the Package Search APIs):
Newer stable version suggestions
When newer stable versions are available for your library dependencies, an inspection will underline your older version string and give you the option to update it with just one click:
Scala version auto-completion
With the help of the Package Search APIs, it is now easy to look up the list of available Scala versions when filling in scalaVersion:
As these features are still under development, you need to be using IntelliJ IDEA 2021.2 EAP and have the Scala plugin’s update channel set to EAP in order to try them out. In addition, the Package Search plugin, which comes bundled with IntelliJ IDEA 2021.2, needs to be enabled.