如何将自定义 jar 文件部署到 Maven 中央存储库以在 pom.xml 中用作依赖项

How to deploy a custom jar file into maven central repository to use in pom.xml as a dependency

我想知道如何将自定义 jar 文件部署到 Maven 中央存储库中以在 pom.xml 中用作其他开发人员在其 Maven 项目中的依赖项。为此,我遵循了几个文档。但是我无法将它部署到 Maven 中央存储库。

移动到您的 pom.xml 所在项目的顶级目录,然后按照 these basics -

In a build environment, use the following call to cleanly build and deploy artifacts into the shared repository.

mvn clean deploy

The same command can be used in a multi-module scenario (i.e. a project with one or more subprojects). Maven traverses into every subproject and executes clean, then executes deploy (including all of the prior build phase steps).