simpligility / maven-repository-tools

Tools for interacting with Maven repositories
Eclipse Public License 1.0
137 stars 66 forks source link

Is it possible to migrate a wohle repository (without -a parameter)? #51

Closed gutschet closed 4 years ago

gutschet commented 4 years ago

Hi,

I am trying your tool to migrate a repository from my old nexus (2.X) server to a new one (3.Y). I want to migrate a whole repository, not only a singe artifact.

I was able to transfer single artifacts with the following call:

java -jar /tmp/maven-repository-provisioner-1.4.1-jar-with-dependencies.jar \
    -s "http://nexus2.domain.com/nexus/content/repositories/snapshots/" \
    ${N2CREDS} \
    -t "https://nexus3.domain.com/repository/snapshots/" \
    ${N3CREDS} \
    -a "de.example:my-app:0.0.1-SNAPSHOT"

But what I really want to do is transferring the whole repository with everything insinde, like that:

java -jar /tmp/maven-repository-provisioner-1.4.1-jar-with-dependencies.jar \
    -s "http://nexus2.domain.com/nexus/content/repositories/snapshots/" \
    ${N2CREDS} \
    -t "https://nexus3.domain.com/repository/snapshots/" \
    ${N3CREDS}"

But then, nothing happens, I only get a SUCCESS returncode but no artifacts are transferred. Any ideas? Or is it not possible to use your tool like this?

Kind regrads

gutschet commented 4 years ago

I made a copy of my Nexus2 Repository on filesystem, removed empty sub-directories (because they cause Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1) and tried to import that file system repo to my Nexus3 Repository with:

java -jar /tmp/maven-repository-provisioner-1.4.1-jar-with-dependencies.jar \
    -cd "/var/tmp/snapshots/" \
    -t "https://nexus3.domain.com/repository/snapshots/" \
    ${N3CREDS}"

This results in the same behaviour as above (SUCCESS returncode but nothing imported to my Nexus3).

gutschet commented 4 years ago

Ok, after further reading I found out that a snapshot repository is not in scope (see #42). I will try with the releases repo now.

mosabua commented 4 years ago

It is possible. You basically skip the download part and treat the repository that is local as the intermediary.

mosabua commented 4 years ago

Here is how you can do it in terms of the commands... https://github.com/simpligility/maven-repository-tools/blob/master/maven-repository-provisioner/test.sh#L76

gutschet commented 4 years ago

Thanks a lot. After understanding, that the tool is not mede for migrating SNAPSHOTS, I tried my releases repository and it worked perfectly. I will close this issue and try to convince my team, that SNAPSHOTS are temporary and should not be necessary to migrate at all.