通过Maven / Eclipse 导入 Spotify API 客户端库。

huangapple go评论124阅读模式
英文:

Importing Spotify API Client Library through Maven / Eclipse

问题

以下是您要的翻译内容:

我想使用这个包装器通过Eclipse IDE使用Java访问Spotify Web API:
<https://github.com/thelinmichael/spotify-web-api-java>

然而,我对Maven一点都不了解,也不知道如何使用外部库。我使用“File > Import > Existing Maven Projects...”导入了这个项目,似乎进展顺利。但我不确定如何在我的代码中实际使用这个库/项目。我是否需要创建一个新的用户库并将jar文件放入其中?如果是这样的话,Maven部分是如何工作的呢?

非常感谢。我真的很苦恼。

英文:

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.

答案1

得分: 1

就像任何Maven依赖一样,你只需在你的pom.xml文件的依赖部分添加以下内容:

<!-- 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>

在构建时,Maven会自动将这些JAR包导入到你的.m2目录中,然后你可以按照常规方式在你的代码中导入并使用它们。

英文:

Just like any maven dependency, you simply add

&lt;!-- https://mvnrepository.com/artifact/se.michaelthelin.spotify/spotify-web-api-java --&gt;
&lt;dependency&gt;
    &lt;groupId&gt;se.michaelthelin.spotify&lt;/groupId&gt;
    &lt;artifactId&gt;spotify-web-api-java&lt;/artifactId&gt;
    &lt;version&gt;6.4.0&lt;/version&gt;
&lt;/dependency&gt;

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

huangapple
  • 本文由 发表于 2020年10月23日 23:58:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/64503423.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定