IntelliJ Import Dependencies - SBT Dependencies And Maven
In this tutorial, we will provide some additional information with regards to importing third party libraries or dependencies in our Scala application.
In the previous tutorial 10, we showed how to update our build.sbt file to import a logging utility named Scala Logging. But from where did IntelliJ download the Scala Logging external library? Well the answer is Maven Central.
1. What is Maven Central?
Maven Central is a repository where you can find external libraries! Maven in itself provides a set of tools and utilities to help with pretty much everything regarding building and deploying our software.
2. How can I search Maven Central?
Fortunately, the Maven Central repository comes with a nice search functionality which allows you to find particular libraries and utilities (more commonly known as artifacts).
- The results are categorized by GroupId, ArtifactId and Latest Version as shown above.
If you recall from the previous tutorial on importing dependencies from SBT, we've used the GroupId, Artifactid and version in our build.sbt as shown below:
- Our build.sbt dependencies for Scala Logging matches the above Maven Central search:
- Groupid was com.typesafe.scala-logging
- Artifactid was scala-logging. We did not include the Scala version which was displayed from the Maven search results. This is because we added the %% which tells SBT to pull down the artifact which matches our Scala version.
- Version was 3.4.0
3. GitHub and open source
So as shown in Step 2 above, we can easily find artifacts by doing a search from Maven Central. But what if we wanted to find more details about the Scala Logging artifact? Well the answer is GitHub!
If you have never heard of GitHub, please visit the GitHub homepage.
- GitHub is yet another popular repository where you can view and contribute to a wide variety of open source projects.
- GitHub should not be confused with Git version control. As per wikipedia, GitHub is a web-based Git repository hosting service, while Git is a version control similar to SVN, CVS or Perforce.
We could spend a whole chapter on Git, but for now let us search for our Scala Logging utility on GitHub:
- Each project on GitHub comes with a page where you can access the source code, as well as read any other details regarding the artifact itself.
This concludes our tutorial on IntelliJ Import Dependencies - SBT Dependencies And Maven and I hope you've found it useful!
Don't forget to like and share this page :)
In this article, we went over the following:
- What is Maven Central Repository?
- How can I search Maven Central Repository?
- A brief introduction to GitHub
- You can find the list of default resolvers for SBT from its documentation.
The source code is available on the allaboutscala GitHub repository.
In the next tutorial, I will show you IntelliJ's Settings screen which is important to get familiar with as it will help you with every aspect of building Scala applications.
Share this article on