Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven Throws ArrayIndexOutOfBoundsException

Tags:

java

maven

Maven throws error as posted below. I am trying to get a 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 maven version is

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 forcing maven to update all repositories with my 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>

Force update.

mvn -U package

Edit2: Have tried deleting the pom.lastUpdated file as well. Also, deleting the repository and retrying.

One thing different is my machine's username and the username on the remote repository is different. But it should not matter as my public key is in the remote repo and that will be used for authentication.

More so, only one package is facing this error. Let me know what is wrong.

Update: This is the log file.

like image 256
hlkstuv_23900 Avatar asked May 26 '15 11:05

hlkstuv_23900


1 Answers

From your stack trace

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

I'd venture the guess that you're using a public/private key setup to connect and Maven can't find the location of said key-file. Have a look at your settings.xml and see if it differs from your coworkers', eg.

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

like image 142
Anders R. Bystrup Avatar answered Oct 22 '22 17:10

Anders R. Bystrup