Search code examples
javaeclipseapimavenspotify

Importing Spotify API Client Library through Maven / Eclipse


I want to use this wrapper to access the Spotify Web API using Java, via an Eclipse IDE : https://github.com/thelinmichael/spotify-web-api-java

However, I have zero knowledge of Maven and working with external libraries. I imported this project using "File > Import > Existing Maven Projects..." and that seemed to work fine. However, I am not sure how to actually use the library / project in my code. Do I make a new user library and put the jar files into it? And if I do that, how does the Maven part of it work?

Thanks so much. I'm really struggling here.


Solution

  • Just like any maven dependency, you simply add

    <!-- https://mvnrepository.com/artifact/se.michaelthelin.spotify/spotify-web-api-java -->
    <dependency>
        <groupId>se.michaelthelin.spotify</groupId>
        <artifactId>spotify-web-api-java</artifactId>
        <version>6.4.0</version>
    </dependency>
    

    to your dependencies in your pom.xml. Maven will automatically import the jars into your .m2 directory when you build, and you can use import them into our code the regular way