如何使我的依赖对其他开发者可用?

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

How to make my dependency available to other developers?

问题

我最近在Maven中创建了自己的API,并且需要将依赖项提供给其他人使用。我尝试在另一个项目中使用这个依赖项,但它找不到它。我需要做什么才能将它发布出去?
我的依赖项:

<dependency>
    <groupId>org.dec4234</groupId>
    <artifactId>JavaDestinyAPI</artifactId>
    <version>1.0</version>
</dependency>

GitHub上可用。

英文:

I recently created my own API in maven, and I need to make the dependency available to others. I have tried using the dependency in another project, but it can't find it. What do I need to do in order to publish it?
My dependency:

&lt;dependency&gt;
&lt;groupId&gt;org.dec4234&lt;/groupId&gt;
&lt;artifactId&gt;JavaDestinyAPI&lt;/artifactId&gt;
&lt;version&gt;1.0&lt;/version&gt;
&lt;/dependency&gt;

Available on GitHub

答案1

得分: 1

你需要将你的库上传到Maven存储库。默认情况下,每个Maven项目都使用Maven Central存储库,其中包含大多数常见的公共可用库的副本,你可能习惯了只需在你的pom.xml<dependencies>部分中添加一个条目。

这是一个上传库到Maven Central的指南 - https://central.sonatype.org/pages/ossrh-guide.html。我之前亲自使用过它,虽然需要一些工作,但这可能是你最好的选择。

你也可以托管自己的Maven存储库,但我将详细说明这一路线留给其他人的回答。

英文:

You need to upload your library to a Maven repository. By default, every Maven project uses the Maven Central repository - which contains copies of most common publicly available libraries that you are probably used to using by just putting an entry in the &lt;dependencies&gt; section of your pom.xml.

Here is a guide to uploading a library to Maven Central - https://central.sonatype.org/pages/ossrh-guide.html. I've personally used it previously and whilst it does take some work, its probably your best option.

You can also host your own Maven repository, but I'll leave detailing that route to someone else's answer.

huangapple
  • 本文由 发表于 2020年8月12日 09:30:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/63368478.html
匿名

发表评论

匿名网友

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

确定