Nexus Suggested Repositories - maven

I setup an internal Nexus Maven repo and I had a question about which additional Maven repos I should include from the initial setup. What are some suggested Maven repos? So far I have added JBoss, Apache Releases, and Codehaus Releases.

As far as I know , all of these repos are synced with Central. You can verify this by looking up Apache or JBoss artifacts using the maven central search engine.

Related

To create a repository for 3rd party jars using Maven in Nexus

I am new to Maven.
I need to create a repository in Nexus for all 3rd party jars used in our project. These 3rd party jars should be pushed to Nexus repository from the maven repository.
When compiling the java code the 3rd party jars should be downloaded to the .m2 folder (local repository) and the code should be complied.
Could you share the sample pom.xml?
I think you are misunderstanding how things are working. Nexus can proxy the Central Repository and others. When configured correctly Maven will download all needed plugins and jar dependencies via Nexus into the local Maven repository and make them available on the classpath during the build as needed.
See more in the documentation. Esp check out the concepts and the Maven section:
http://books.sonatype.com/nexus-book/reference/concepts.html
http://books.sonatype.com/nexus-book/reference/config.html
You can also try it with the eval guide and the example projects.
http://books.sonatype.com/nexus-book/reference/eval.html

Maven internal Repository

I have internal nexus repository. I want to install plugins from internal repository, having the dependencies which I want to download from the central maven repository. I am new to maven and really struggling to do the required configuration.
Once you deployed your own plugins into a nexus repository (say "releases") add that repository into the Nexus Group that contains both maven central and your releases repository. Usually developers will only use one url (mirror configured in settings.xml) from nexus and deploy artifacts into a specific repository.
In addition you need to make sure to add the maven group id of your plugins into settings.xml in the pluginGroups section: https://maven.apache.org/settings.html#Plugin_Groups
That should already work.

Does the maven central repo need to be added to %USER%/.m2/settings.xml?

I'm trying to build a project with maven and I have a repository I'm pulling packages from which I've configured in the %USER%/.m2/settings.xml file. The problem is it's pulling the packages from that repository but not from the maven central repository.
My question is if I create a settings.xml file and add my own repository to it, do I then also need the maven central repo?
It's possible to configure Maven to retrieve from both a private Maven repository manager (Like Nexus, Artifactory or Achiva) and also download from Maven Central.
Personally I prefer to confgure my Maven repository manager to proxy Maven Central. Within Nexus I create a repository group that combines the Maven Central Proxy with my hosted repositories. In this way a single URL gives me all my project dependencies. This simplifies Maven client configuration.

How to get Sonatype Nexus to download the latest version of jar?

I'm using Sonatype Nexus 1.5.0 and a particular jar has a newer version in the Public Maven Central while my Nexus doesn't have it.
Assume that only the server where the Nexus is installed has the internet connection and my local laptop is not allowed to connect to internet directly, how to let the Nexus the download the newer version of the jar so that my local build can download the newer version from Nexus?
The settings.xml of my local Maven is configured with the URL of the Nexus to download the jars.
Please advise.
Here is a summary of how your local repository, remote repo (Nexus), and Maven Central work together. If you have requested the new version of the jar in your POM, then it should end up in Nexus and your local artifact repo. If it doesn't, something is not configured correctly, and #khmarbaise gave you some good starting points for troubleshooting in his comment.

How to deploy JAR to Maven remote repository

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?
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)
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
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
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.

Resources