simpligility / maven-repository-tools

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

Error when migrating from Nexus 2 FS repo #36

Closed seboudry closed 6 years ago

seboudry commented 6 years ago

There is an issue when using maven-repository-provisioner:1.2.1 to migrate from filesystem inside Nexus2 repository directory.

Using this command:

java -jar maven-repository-provisioner-*-jar-with-dependencies.jar \
     -cd "/sonatype-work/storage/releases" \
     -t "http://nexus3.company.com/repository/maven-releases" \
     -u admin -p admin123

Full log:

Provisioning artifacts: null
Source: https://repo1.maven.org/maven2
Target: http://nexus3.company.com/repository/maven-releases/
Username: admin
Password: ************************
IncludeSources: true
IncludeJavadoc: true
IncludeProvidedScope: false
IncludeTestScope: false
Check target: true
Verify only: false
Local cache or source repository directory: /sonatype-work/storage/releases

09:25:01.121 [main] INFO  MavenRepositoryProvisioner -  Absolute path: /sonatype-work/storage/releases
09:25:01.123 [main] INFO  MavenRepositoryProvisioner - Detected local cache directory '/sonatype-work/storage/releases'.
09:25:01.124 [main] INFO  MavenRepositoryProvisioner - No artifact coordinates specified - using cache directory as source.
09:25:01.126 [main] INFO  MavenRepositoryProvisioner - Artifact retrieval skipped.
09:25:01.127 [main] INFO  MavenRepositoryProvisioner - Artifact deployment starting.
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1967)
    at com.simpligility.maven.GavUtil.getGavFromRepositoryPath(GavUtil.java:18)
    at com.simpligility.maven.provisioner.MavenRepositoryDeployer.deployToRemote(MavenRepositoryDeployer.java:140)
    at com.simpligility.maven.provisioner.MavenRepositoryProvisioner.main(MavenRepositoryProvisioner.java:120)

Content of source directory:

root@nexus-654873208-1546f nexus]# ls -la /sonatype-work/storage/releases
total 36
drwxr-xr-x  6 root root 4096 Dec 15 07:16 .
drwxrwxrwx 26 root root 4096 Jul  3 14:36 ..
drwxr-xr-x  2 root root 4096 Dec 14 17:12 .index
drwxr-xr-x  2 root root 4096 Dec 15 07:16 .meta
drwxr-xr-x  5 root root 4096 Jul  5 12:41 .nexus
-rw-r--r--  1 root root   25 Dec 15 07:16 archetype-catalog.xml
-rw-r--r--  1 root root   32 Jul  5 12:42 archetype-catalog.xml.md5
-rw-r--r--  1 root root   40 Jul  5 12:42 archetype-catalog.xml.sha1
drwxr-xr-x  3 root root 4096 May  3  2017 com
hhulwath commented 6 years ago

I did 2 things: removed dot prefixes dirs (.index,.meta,.nexus) and found and removed an empty subdir found somewhere in the content dir then pass

mosabua commented 6 years ago

Implementing a fix for this atm.

mosabua commented 6 years ago

Thats now in master