How to set up maven repository on a local windows server to remotely access using pom.xml - maven

I have a windows server running with maven installed, I need to create an environment where if an artefact is not found on my local repository maven will search the server repository which is in an internal network, and if its not found there to look at the central repository.
And once found the artefact would be downloaded to both the local and networked repositories.

Related

Nexus repo not accessible through proxy in maven settings

I have a maven project.
when I build using cmd prompt- It downloads the maven repos, only when the proxy is configured in settings.xml file.
But this proxy is blocking the nexus repos. I do have two nexus repos required for this project. and I get build error -- return code:503 reason phrase: service unavailable for nexus repo contents
If I follow the stack overflow answer Nexus Repo gives 503 with Maven but not with browser
and added proxy to nexus instance and mirrored the nexus in my settings file. Still maven repo works and nexus repos or not accessible.
my settings.xml
Any help would be appreciated.
Thanks in advance

Replicate nexus repository in my local server

I work in an organisation and we use nexus repositories. I want a simple approach of how can I replicate few groups from nexus repository in to local server so that maven downloads the dependencies from local server and not from nexus.
If you use local server in the sense of base machine then you use clean install as a maven goal. The build code will be available under .m2/repository folder.
Install Nexus locally, create Proxy Repository for each of the repo or group that you want to have locally. In Proxy Repository you'd need to set up URLs to the remote repos.
Now point Maven to this local Nexus (e.g. with <mirrors> in settings.xml). First time Maven downloads a dependency it will go to Local Nexus which would grab the dependency from the remote one. This file is going to be cached in Local Nexus and further downloads won't hit the Remote Nexus.
PS: don't know why you would do this.

Directly transferring a .pom file from local maven repo to remote repo

I have a maven "pom-only" artifact in my local repository (which is not built by me or my company , It was an very old one ). I want to transfer this to remote repository (our companies snapshot repository) . How do i do that .
I have following in my local repo under the version folder
****-1.8-SNAPSHOT.pom
****-1.8-SNAPSHOT.pom.sha1
How can i push both to remote repo. One of our project is dependent on this parent/Pom only artefact ?
The Web UI of your remote repository manager should provide functionality to upload/deploy artifacts manually. For Artifactory and Nexus I know for sure that they provide such.

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.

Deploy jboss client jars to local maven repository

I have a local jboss installation on my box and I would like to deploy the jars in the client directory to my local Artifactory server.
Is there are way do it in one single command, or should I deploy each single file individually?
What I don't want:
Using the JBoss nexus maven repository.
Add a proxy to JBoss nexus maven repo from my Artifactory.
Thanks.
Prepare the jar files to be uploaded in a local repository folder layout, like:
repository/org/jboss/logging/jboss-logging-spi/2.2.0-CR1/jboss-logging-spi-2.2.0.CR1.jar
repository/org/jboss/javaee/jboss-javaee/5.0.1.GA/jboss-javaee-5.0.1.GA.jar
Use the pom.xml from here to batch upload them to maven repository by a single command mvn install.
Read my blog post for detail.

Resources