Configure both central and third party repositories in pom.xml - maven

I have maven project which downloads jars from nexus central repository.But i am using some oracle jars which are not getting downloaded from central repository because of licensing.so i have downloaded them in nexus thirdparty repository.So when jar is not getting downloaded from central, it should download it from thirdparty repository.
What configurations needs to be done in settings.xml and pom.xml?

found answer in below link
https://blog.sonatype.com/2008/11/adding-a-jar-to-a-maven-repository-with-sonatype-nexus/
configured settings.xml as mentioned above

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

How to download specific jar from company repository, remaining jars from Maven repository

Our company is having own jar like retail.jar in our local repository, URL is http://localoff.com/public/releases. I want to download only/this specific retail.jar from our local repository. Remaining all other jars like spring.jar, commons.jar from maven central repository. How to configure in my maven settings.xml. All I want is my company jar(Only one jar) should download from local repository URL not from system, all other jars should download from Maven. Please help me.
Thanks in Advance
Rekha

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.

Maven repository usage to download artifacts

I have added a repository to download artifacts and I have seen maven using that repository to download artifacts, but only for particular artifacts of that repository maven tries to download from mvn central repository. When I chek that artifact on added repository it's available. What could be the issue ? In which situations maven tries to download from central repository ?
Specific issues is highlighted in ,
Magnolia Demo project mvn build failed due to not able to fetch magnolia-setproperty-maven-plugin
All the Maven dependencies are first downloaded from your local repository, then if they are not found, Maven will try in any remote repository that you define in your POM file or the settings.xml and for last it will try to download from Maven Central.

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.

Resources