How to deploy JAR to Maven remote repository

2019-02-26 10:18发布

问题:

Is there any way to put my JAR file in remote repository, so my maven project can get this JAR file from any place via Internet?

I have downloaded and did some fixes in the ReportNG project: https://github.com/dwdyer/reportng . Using ANT I have compiled this project into JAR, now I want to put it into remote Maven repository, but don't know how I can do that.

Could somebody please suggest me the way, how I can perform that?

回答1:

If it is a released version you want to make available in maven central follow this guide: http://maven.apache.org/guides/mini/guide-central-repository-upload.html

I'm no github professional but since a maven repo is just a file structure with some meta-data you can put it anywhere maven can read it (ftp, http, ...). so you could create a git repo to host your maven artifacts. see http://cemerick.com/2010/08/24/hosting-maven-repos-on-github/ for an example. (it may be outdated - github may have something like maven repo hosting, I just dont know)



回答2:

A lightweight way to create your own maven repository is to store it on github. See Hosting a Maven repository on github for more details



回答3:

I followed sonatype open source project maven deployment guide https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide and successfully deployed the latest version of reportNG into maven central repository. Now maven have both 1.1.3 and 1.1.4

http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.uncommons%22%20AND%20a%3A%22reportng%22



回答4:

You should do a pull request to the github project. If the maintainer likes your fix he will put it in the next version.

If you need your fix in a remote repo NOW then you'll have to setup your own maven repository.