convert maven local repository to remote repository - maven-2

I have a repository directory under .m2 that I want to use as a remote repository (-Dmaven.repo.remote=http://remotehostname/repo) to other hosts. I tried just to expose the directory .m2/repository/ under Apache as http://remotehostname/repo, the directory is fully visible via HTTP, but Maven doesn't seem to be reading from the exposed repo. For various reasons, I do not want to add this new remote repo to settings.xml; limit it to -Dmaven.repo.remote
What do I need to do to convert a local repo under .m2 as a remote repo?

Further to #Perception's answer, you can look at Nexus Command Line tool, which can help convert your local repo to nexus repo

I haven't heard of any maven repository manager that can simply mirror your .m2 folder (which is just a local repository). You need to install and configure repository management software ... there are many free, open source ones, I recommend Artifactory or Nexus.
Nexus does fit very closely with your requirements since it uses a file based repository, and the file layout matches with the local repo layout.

Related

Upload node modules to nexus

I would like to create a private npm repo on our nexus.
So i guess i need to take the current node_modules folder on my machine and put it in Nexus, right?
I cant proxy npm, because on our jenkins machine we don't have internet access.
So how do i put all my node modules (lots of folders) onto Nexus?
and in what structure and format?
See https://github.com/DarthHater/nexus-repository-import-scripts for uploading a lot of files into NXRM3.
If that doesn't work for you, likely you can modify that script for your needs.

Clone multiple existing Gerrit repositories to Gitlab

we are migrating from Gerrit Code Review to GitLab in our office. I know how to clone one repository from Gerrit to GitLab. But in our office server we have around 50 or so repositories. I have tried transferring the repositories manually to GitLab's 'repositories' directory and then importing, but it only creates bare repositories. I'd like to know if there's a way to clone all the repositories in one go. Please help...
but it only creates bare repositories
That is what GitLab manages, as a Git Hosting service: bare repos that you can clone locally.
You could move those non-bare repo by:
moving only the .git of your existing repo to GitLab repo folder, where each .git is renamed after the repo it was in:
repo1/.git => /home/git/repositories/repo1.git
repo2/.git => /home/git/repositories/repo2.git
repo2/.git => /home/git/repositories/repo3.git
If you are talking about two different servers (hopefully both with the same OS), I would recommend tar cpvf repo1.git.tar /tmp/repo1.git: move in /tmp and rename first, then tar, and copy over that tar to the new server.
transform those repos into bare one:
cd /tmp/repo1.git && git config --bool core.bare true
Try the Import process of GitLab (but there seems to be a bug in progress on that: issue/pull 5005
bundle exec rake gitlab:import:repos RAILS_ENV=production
While the import process command is correct, the OP redmoses mentions in the comments:
If I just copy the repositories to /home/git/repositories, then the repositories appear in GitLab with no source files or no record of previous commits done in Gerrit.
To make this work this is what I did:
Created a new directory inside the repositories directory
Copied all the repos from Gerrit (was located in /usr/local/gerrit2/git) to the new directory.
Then just simply ran GitLab's import process GitLab then created a group called "Dev" and imported the existing repositories perfectly.
And I didn't need to convert the repositories to bare.

maven artifact repository directory structure specs

I would like to know the specs for the maven repository structure.
I know I could use archiva or nexus to create a repository. I am not interested in those information.
I have tried searching apache's maven website and google with the phrase
"maven artifact repository structure specs", and I mostly get the development directory structure expected on the maven client.
I would like someone to explain the structure here or point me to a comprehensive single document (i.e. one that does not explain the directory structure by making me follow a never ending trail of links) that explains for example,
How to create a simple maven repository using a static file system directory, deployed to apache http server.
or how to create a directory structure on googlecode that would appear as a maven repository.
Here is the specification (long overdue for documenting in Maven itself):
https://cwiki.apache.org/confluence/display/MAVENOLD/Repository+Layout+-+Final
That said, I wouldn't refer to that for creating the repository in the way you've described. The best thing to do is to use mvn deploy:deploy-file with appropriate parameters to upload the files that you want to, as it can write appropriate metadata and structure for you. This can be done to a filesystem location and synced to the location you want to.
Another alternative is to run a repository manager, like Archiva, and upload using the web interface until you are happy, then sync the directory structure to the location that you want to.

Nexus sonatype: Incomplete repository when adding a proxy repository

We've installed the Nexus Sonatype open-source software, version 1.8.0.1 .
When we log in as an administrator and try to add a remote repository (proxy repository), the repository gets added but is incomplete and missing artifacts.
When we click on "Browse Index", we only see one artifact branch "de" when there should be multiple ones.
However, if we paste the repo url in a browser (http://oss.sonatype.org/content/groups/public/), there is a lot more content and also a .index directory which, by our understanding, should download a remote index of everything available in this repository.
The only error we see in the log is the following:
Aborted walking on repository ID='liferay-repository' from path='/.index',
cause: Item not found on path "/.index" in repository "liferay-repository"!
If my understanding is right, the proxy repository downloads and caches the artifacts that it is requested. It would not attempt to download the entire contents of the remote repository that is configured.
Could you try downloading artifacts in this remote repository using the configured Nexus proxy and see if the artifacts are present in Nexus after the operation?

Nexus supports Mass upload of artifacts?

I wanted to know if we can have mass upload of artifacts to the repository in Nexus.
You can do it in a variety of ways:
Use the Nexus artifact upload page (note this only works for multiple artifacts with the same groupId and artifactId).
Set up a script, with multiple invocations of the maven-deploy-plugin's deploy-file goal, one for each artifact.
If you have access to the file system, you can copy the files directly into [sonatype-work]/storage/[repository-name]. If you do this, set up scheduled tasks to rebuild the metadata and reindex the repository.
Use the Nexus Repository Conversion Tool to create Release and Snapshot folders based on your local .m2 folder and then move the contents of those folders into [sonatype-work]/storage/[repository-name].