我正在嘗試開發Eclipse插件。這個插件使用jgit通過ssh使用ubuntu的用戶名和密碼加密git倉庫。 (Clone git repository over ssh with username and password by Java)使用jgit與NetbBeans一起工作得很好。沒有問題,它可以克隆,提交和推送項目。但是,當我將相同的代碼片段移動到jgit插件的Eclipse jsch和添加到項目衝突中的jsch時。如果我刪除了我添加的那個,那麼我無法編譯代碼(我需要在一個類中導入com.jcraft.jsch.Session)。另一方面,如果它被添加我有以下錯誤使用JGit和Jsch進行Eclipse插件開發時發生java.lang.LinkageError
java.lang.LinkageError:
loader constraint violation: loader
(instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader)
previously initiated loading for a different type with name
"com/jcraft/jsch/Session"
有沒有辦法擺脫這混亂?
我正在使用jgit-3.2.0和jsch-0.1.5.0 Eclipse版本是開普勒。
我的插件清單
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ****
Bundle-SymbolicName: ****;singleton:=true
Bundle-Version: 1.1.0513
Bundle-Activator: ****.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.browser;bundle-version="3.4.100",
org.eclipse.core.resources;bundle-version="3.8.100",
org.eclipse.ui.ide;bundle-version="3.9.0",
org.eclipse.jdt.core;bundle-version="3.9.0",
org.eclipse.core.filesystem;bundle-version="1.4.0",
org.eclipse.team.core;bundle-version="3.7.0",
org.eclipse.jgit;bundle-version="3.2.0",
org.eclipse.jdt.launching;bundle-version="3.7.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
lib/commons-io-2.4.jar,
lib/zip4j_1.3.2.jar,
lib/jsch-0.1.50.jar
不要使用Require-Bundle。使用導入包。 – 2014-09-29 17:20:01