How to deploy local maven repo to remote repo - maven

I've a valid local maven repo which is generated by a closed-source tool. I'd like to deploy the full repo to a remote maven repo.
Any clues how to do this ?

If you can't scp or transfer up the repo another way, then I assume you'd have to write a script that would walk your local repo and put them all up using the deploy plugin.
https://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html
If you're moving the whole repo up, I'd suggest to put it to an isolated repo so that it doesn't mix with other upstream repos like central.

Related

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.

Setup artifactory so that it's used for both caching an upstream Hadoop/HBase project & also provide build artifacts to our CI?

I'm getting started with Artifactory and am getting confused by all the terminology. What I'm trying to accomplish is the following:
$ git clone https://github.com/apache/hbase.git
$ cd hbase
$ git checkout branch-1.2
$ mvn clean install -DskipTests assembly:single
I'd like the git clone of this upstream project to live in Artifactory along with the components that Maven is pulling down. Additionally the final product zip file that mvn builds, hbase-assembly/target/hbase-1.1.6-bin.tar.gz, I want to store that in Artifactory too so that we can use it downstream in several CI jobs.
Questions
Is this approach correct?
How do I accomplish this?
Artifactory provides you with the Remote Repository functionality which you can also use to proxy various VCS services although I fail to see the point in just storing a clone of a git repo in Artifactory -
The VCS remotes are mainly used for cases where you directly include source code that you don't need to influence in your own code (i.e you can't git push changes back into Artifactory - they will not be persisted in the upstream git repo).
If you're aiming to have your CI job clone a certain branch, run tests, build it and then deploy build artifacts back to artifactory, I would suggest configuring your job to clone the git repo (using git not Artifactory) and then deploying the build artifacts back to Artifactory for downstream jobs to use.
Artifactory provides very extensive integration with popular build servers through which you can achive what's discussed here, your build artifacts should go into a Maven repository and the downstream jobs should reference it with their own pom files - you can quickly setup any Maven client to work with Artifactory using the Set Me Up dialog.

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.

Sharing dependencies not in central repo with the project

I understand how to add local JARs not in Maven's central repo to allow them to be used in my project as per this SO answer.
However, I'm not sure how I'm going to distribute the project for others to use like this. In the past, I merely had an Eclipse project that included local JARs and those JARs were distributed with the project (in its git repo).
If I use Maven, I'd have to add these local JARs to the local repository, which is in a different location from the project.
So how do I make my project easy to build with these local JARs in mind? Do I just tell the user how to add them to the local repo? Is there a better solution?
Ideally, users would clone my git repo and merely have to run mvn install without having to do ANYTHING with dependencies. The dependencies should be my problem, not my users.
Yeah. You could do that, by creating local repo and adding this repo to git repository.
I guess it's better than ask user to install it by themselves.
For concrete example take a look on my project with local repo - https://github.com/MysterionRise/mavenized-jcuda

Can i move local maven repository to internal repository when i set the internal repo for the first time?

i wanted to setup artifactory as internal repo after i had actually used maven and populated my local repository during various builds. Before I set up artifactory on my machine, my local repository has already downloaded various libraries on to my local machine under .m2. Now I am setting up internal repo using Artifactory. Is there a quick way to move my local repository under .m2 to artifactory so that i don't have to again download all the libraries to get my artifactory up with the required libs.
Currently what i have to do is remove all folders under local repo (.m2\repository) and then allow my maven build to download on to artifactory. I am looking for a more efficient way to do this.
You've got a number of options:
Assuming that you would like to push all artifacts into one repository and keep the same folder structure as in your file-system, Artifactory's got a number of good import utilities in its administration UI at:
Admin->Import & Export->Repositories->Import Repository from Path.
For more flexibility, you can write a simple script that iterates over the .m2 folder and sends an HTTP PUT command for every artifact and thus be able to customize the paths and target repositories, for example:
curl -X PUT -u username:password -T path/to/file.jar "http://myhost:8080/artifactory/my-target-repo/path/to/file.jar"

Resources