Maven internal Repository - maven

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.

Related

Configure nexus repository to only store jars that are installed (selected by me)

I would like to configure a nexus repository to only manage jars that I install. Right now it also retrieves jars from maven central and stores them in the repository. I don't want that to happen.
Can anyone point me in the right direction how this can be achieved?
When you say to store the "jars that are installed" , if you are referring to the artifacts being created by your project, you can have a hosted maven repository snapshot/release and use maven deploy plugin to upload it on to your nexus repository.
You can either create a profile in your pom and activate in your install it on mvn install phase to upload the artifacts to your nexus repository.

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.

How to create the repository (role is repository manager)with nexus

i created a maven repository using nexus and upload the jars files.Same way how to upload the maven plugins to repository.i directly add the maven-complier-plugin,it is not working.it will gives some exception like org.apahce,parenet ,plexus ,codehaus required and org.apache.maven.lifecycle errors are geting..
i will not be maven central repository,only using commpany repository includes every in my repository jars and maven plug
plz help me i am first create the repository.
Did you specify a mirror in your settings.xml file? If you want to force all users to use your repo and not repo1.maven.org, you'll need to enforce that. Also, you probably want your nexus to proxy central so that any artifact you don't host will still be available once you setup the mirror to block all outside repos.

Why does Nexus repository doesn't download the required artifacts when using a group repository?

I use Nexus repository manager and configured the default .../nexus/content/groups/public/ repository and added maven central, codehaus snapshot and an internal respository that I created and have uploaded few artifacts to that.
Then added .../nexus/content/groups/public to mirror in settings.xml. When I do a maven build, maven looks in .../nexus/content/groups/public but does not update org.apache.maven.plugins:maven-site-plugin:pom:2.0-beta-6 and reports that it is not found.
But if I remove the mirror from settings.xml, then it looks in http://repo1.maven.org/maven2/ and it picks up all the artifacts correctly.
I have also changed publish url to true. What do I miss?
If you added the repositories as proxy repositories in Nexus do not forget to add the proxies to the Repository Group which you use as mirror for all Nexus requests (public/snapshot) - assumed you have this kind of configuration.

Resources