Maven private internal repository - maven

I have create a maven local depository using "Artifactory". I want to add project dependencies to this local repository(all dependencies in my local .m2 folder), can I do that with Artifactory?. If can, how can I do it?

The dependencies will be added to Artifactory on the first run of your maven project (they will be fetched from one of the remote repositories Artifactory come preconfigured with).

Related

how to copy all the dependencies of a Mave project and transfer to another development host?

I want to work (remotely) on a maven project that I have no access to some of the maven repositories that the project is configured with (company local). I want a way to clone all necessary dependencies and transfer to my personal machine such that I can build the project without the company local repositories (I have SSH access to the project development host).
I know about Maven dependency:copy-dependencies but I want to merge these dependencies with my local .m2 directory. in fact, what I want is to clone a minimum portion of a .m2 directory that has all the dependencies of the project and then merge this to my local .m2 and can compile and build the project. is this possible?

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.

Backup Maven dependencies to repository

I am frequently using maven artifacts as dependencies from external repositories which go (permanently) offline surprisingly often. I'd like to save all dependencies a given project has and save them in a local repository - just like using maven deploy -DaltDeploymentRepository=... for a single project. This repository should then be usable like any other maven repo when put on an HTTP server.
I tried using mvn dependency:copy-dependencies -Dmdep.useRepositoryLayout=true, but it does not create files like maven-metadata.xml or copy .pom files.
I do not want to use any repository managers like Artifactory, I just have a static file server.
Thanks in advance.

What is meant by local repository and remote repository in Maven?

I am reading up Maven - The complete reference and came across this
Maven assumes that the parent POM is available from the local repository, or available in the parent directory (../pom.xml) of the current project. If neither location is valid this default behavior may be overridden via the relativePath element.
What exactly is meant by local and remote repository for a Maven installation and a project?
A local repository is a local directory structure that caches artifacts downloaded from remote repositories, or those that are manually installed (eg from the command line option).
A remote repository is a web service (defined by a URL) that contains versioned artifacts. This might be as simple as an Apache server, or a full-blown Maven repository, such as Artifactory, that allows uploading, permissions based on a user directory, etc.
http://maven.apache.org/guides/introduction/introduction-to-repositories.html
By default, Maven will source dependencies from, and install dependencies to, your local .m2 repository. This is a precedence rule, and your .m2 acts like a cache where Maven can source dependencies before downloading them remotely. You can bypass this behaviour like so: mvn -U ... (see mvn --help).
Your local .m2 can be found under C:\Users\{user}\.m2 on Windows, or /home/{user}/.m2 on Linux. If you do a mvn install, your project will be locally installed under the said .m2 repository.
A remote repository is a Maven repository, just like your local .m2 repository, hosted for you to source dependencies from, e.g. Maven Central.
Local repository is a repo. Into your local system, when you compile or install project all required dependencies downloaded into your local repo.
When you're working with your project, then Maven first tries to get dependencies from local. If it's not available, then Maven will try to download the dependency from a central repository.
central repo. is a online repo, which is provided by maven itself.

maven artifacts for local repository

I want to create a local repository for maven. For that, I have to download all required artifacts. Is there any direct download link available for all artifacts to be downloaded once?
The local repository will be automatically be created during your first call of Maven in relationship with a project. The default location for the local repository is $HOME/.m2/repository.
You don't need to download dependencies etc. cause Maven will do that automatically.

Resources