Eclipse で SSHJ をテストすると、すべて問題ないようです。しかし、Maven shade プラグインを使用して SSHJ をパッケージ化すると、次のエラーが発生します。
Exception in thread "main" net.schmizz.sshj.userauth.UserAuthException: Exhausted available authentication methods
at net.schmizz.sshj.SSHClient.auth(SSHClient.java:217)
at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:316)
at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:365)
at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:295)
at no.f12.SshRepository.executeTaskOnHost(SshRepository.java:23)
at no.f12.SshService.serviceCommand(SshService.java:22)
at no.f12.App.main(App.java:29)
追加する
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
エラーメッセージを次のように変更します。
Exception in thread "main" net.schmizz.sshj.transport.TransportException: Unable to reach a settlement: [] and [aes128-ctr, aes192-ctr, aes256-ctr, arcfour256, arcfour128, aes128-gcm@openssh.com, aes256-gcm@openssh.com, aes128-cbc, 3des-cbc, blowfish-cbc, cast128-cbc, aes192-cbc, aes256-cbc, arcfour, rijndael-cbc@lysator.liu.se]
at net.schmizz.sshj.transport.Proposal.firstMatch(Proposal.java:165)
at net.schmizz.sshj.transport.Proposal.negotiate(Proposal.java:147)
at net.schmizz.sshj.transport.KeyExchanger.gotKexInit(KeyExchanger.java:239)
at net.schmizz.sshj.transport.KeyExchanger.handle(KeyExchanger.java:364)
at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:478)
at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:127)
at net.schmizz.sshj.transport.Decoder.received(Decoder.java:195)
at net.schmizz.sshj.transport.Reader.run(Reader.java:72)
これを回避する方法はありますか?
なぜshadeを使用したいのかについての背景...私は、Javaの使用と小さなユーティリティの配布が非常に簡単になるところまで到達しようとしています。だから私はこれを使って本当に実行可能なjarを作成します: https://github.com/brianm/really-executable-jars-maven-plugin。これにより、1 つの実行可能ファイルを作成して配布し、ユーザーのパスに追加することができます。Go がすべての依存関係を含む 1 つのバイナリ ファイルを持っているのと少し似ています。