Maven throws an ArrayIndexOutOfBoundsException

Maven throws an error as shown below. I am trying to get the repository from remote to mine.

mvn package Could not transfer metadata org.symplifier.adk:symplifier- adk:1.0.3-SNAPSHOT/maven-metadata.xml from/to a-repository (sftp://git.a.com.np/home/git/gitlab/public/repo/): Cannot connect. Reason: java.lang.ArrayIndexOutOfBoundsException: 0 [WARNING] Failure to transfer org.symplifier.adk:symplifier-` adk:1.0.3-SNAPSHOT/maven-metadata.xml from sftp://git.a.com.np/home/git/gitlab/public/repo/ was cached in the local repository, resolution will not be reattempted until the update interval of a-repository has elapsed or updates are forced. Original error: Could not transfer metadata org.symplifier.adk:symplifier-adk:1.0.3-SNAPSHOT/maven-metadata.xml from/to a-repository (sftp://git.a.com.np/home/git/gitlab/public/repo/): Cannot connect. Reason: java.lang.ArrayIndexOutOfBoundsException: 0 

My version of maven

 mvn -version Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:42:37+05:45) Maven home: /usr/local/apache-maven Java version: 1.8.0_45, vendor: Oracle Corporation Java home: /usr/lib/jvm/jdk1.8.0_45/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.2.0-4-amd64", arch: "amd64", family: "unix" 

Edit1 :

I tried to get maven to update all repositories using pom.xml

 <repositories> <repository> <id>a-repository</id> <url>sftp://git.a.com.np/home/git/gitlab/public/repo/</url> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> </repository> </repositories> <dependency> <groupId>org.symplifier.adk</groupId> <artifactId>symplifier-adk</artifactId> <version>1.0.3-SNAPSHOT</version> </dependency> 

Forced update.

 mvn -U package 

Edit2 : Try deleting the pom.lastUpdated file. Also delete the repository and try again.

Another difference is my machine username, and the username in the remote repository is different. But that doesn’t matter, since my public key is in a remote repo and will be used for authentication.

In addition, there is only one package facing this error. Let me know what is wrong.

Update : This is a file .

+6
source share
1 answer

From stack trace

 ... Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 at com.jcraft.jsch.IdentityFile.<init>(IdentityFile.java:367) ... 

I would venture to suggest that you are using a public / private key to connect, and Maven cannot find the location of the specified key file. Take a look at your settings.xml and see if it is different from your peers, for example.

 <server> <id>a-repository</id> <username>sraddhanjali</username> <privateKey>${user.home}/.ssh/id_dsa</privateKey> ... 

+2
source

Source: https://habr.com/ru/post/987926/


All Articles