4

I try to use Jsch 0.1.44 together with Maven.

I have the following dependency in my pom.xml.

<dependency>
    <groupId>com.jcraft</groupId>
    <artifactId>jsch</artifactId>
    <version>0.1.44</version>
    <scope>compile</scope>
</dependency>

If I run mvn compile maven looks normal and tells me that Jsch has been successful downloaded.

But when it comes to compile, the Jsch classes could not be found. If I look into my local repository I can see that the Jsch-jar has only a size of 3kb. If I open the jar file I can also see that there is only the META-INF folder.

So what is wrong here, how can I fix this?

flash
  • 6,730
  • 7
  • 46
  • 70

3 Answers3

4

0.1.44 version is broken (it's only 3KB)

http://mvnrepository.com/artifact/com.jcraft/jsch/0.1.44

use http://mvnrepository.com/artifact/com.jcraft/jsch/0.1.44-1 Instead

update your POM to this:

<dependency>
  <groupId>com.jcraft</groupId>
  <artifactId>jsch</artifactId>
  <version>0.1.44-1</version>
</dependency>
Eric Martinez
  • 406
  • 5
  • 16
4

There are different possibilities:

  • You have used the correct Maven repository for jsch (seems to be this one: http://mvnrepository.com/artifact/com.jcraft/jsch/0.1.44-1), but the download stopped for whatever reason. This happens, and you have just to clear your local repository by deleting the directory for jsch or the the version only. It will be reloaded again.
  • Perhaps you has misconfigured your remote repository for jsch, and jsch is hold somewhere, but not the library, only the meta data. I do not know if it is possible to see from which location you got the wrong library.

You should look at your settings.xml (for Maven or your user) and see if the repository is specified correctly.

You should check if the command

mvn dependency:get -DrepositoryUrl=http://mvnrepository.com/artifact/ \
                   -DgroupId=com.jcraft -DartifactId=jsch -Dversion=0.1.44 \
                   -Dtransitive=false

works properly.

mliebelt
  • 15,345
  • 7
  • 55
  • 92
  • 1
    +1 and thanks for your answer. One comment on your last command. It doesn't work. Gives me `[ERROR] Could not find goal 'download' in plugin org.apache.maven.plugins:maven-plugin-plugin:2.9` – flash Sep 28 '11 at 05:39
  • Thanks for the feedback. I got the download wrong (Maven 1 only), and have corrected it, hope it works now. Seems like the fault was that the original did not contain the content :-) – mliebelt Sep 28 '11 at 05:56
4

For some reason the jar file in the central repository seems to be broken. The solution is to add another repository for Jsch to the pom.xml.

<repository>
    <id>Jsch</id>
    <url>http://jsch.sf.net/maven2/</url>
</repository>
flash
  • 6,730
  • 7
  • 46
  • 70