What's wrong with Jsch and Maven?
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开发者_Python百科 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?
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>
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 forjsch
or the the version only. It will be reloaded again. - Perhaps you has misconfigured your remote repository for
jsch
, andjsch
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.
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>
精彩评论