在Maven阴影罐中使用SSHJ进行远程连接

时间:2014-04-02 19:11:25

标签: java maven bouncycastle maven-shade-plugin sshj

我使用SSHJ连接到远程计算机,从IntelliJIDEA执行此操作时效果很好。然而,当我尝试使用maven-shade-plugin构建一个“uberjar”时,我得到如下所示的堆栈跟踪。

我在阴影罐中有org.bouncycastle.bcprov-jdk16,我的程序明确地将其添加为提供者:Security.addProvider(new BouncyCastleProvider());

我试图根据此处提供的答案签署jar:SSHJ and the Maven shade plugin 使用'maven-jarsigner-plugin'和'maven-gpg-plugin'进行测试,但没有运气。

非常感谢任何帮助!谢谢!


net.schmizz.sshj.transport.TransportException: Unable to reach a settlement: [] and [aes128-ctr, aes192-ctr, aes256-ctr, arcfour256, arcfour128, 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) ~[integration-tests-1.0-SNAPSHOT.jar:na]
at net.schmizz.sshj.transport.Proposal.negotiate(Proposal.java:147) ~[integration-tests-1.0-SNAPSHOT.jar:na]
at net.schmizz.sshj.transport.KeyExchanger.gotKexInit(KeyExchanger.java:239) ~[integration-tests-1.0-SNAPSHOT.jar:na]
at net.schmizz.sshj.transport.KeyExchanger.handle(KeyExchanger.java:364) ~[integration-tests-1.0-SNAPSHOT.jar:na]
at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:478) ~[integration-tests-1.0-SNAPSHOT.jar:na]
at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:127) ~[integration-tests-1.0-SNAPSHOT.jar:na]
at net.schmizz.sshj.transport.Decoder.received(Decoder.java:195) ~[integration-tests-1.0-SNAPSHOT.jar:na]
at net.schmizz.sshj.transport.Reader.run(Reader.java:72) ~[integration-tests-1.0-SNAPSHOT.jar:na]

1 个答案:

答案 0 :(得分:0)

我终于放弃了试图把所有东西放在一个大的“uberjar”中。

相反,我使用maven-assembly-plugin组装了所有的jar,然后提取并将它们添加到类路径中以便执行,例如, 'java -cp all-needed-libs / * com.company.MainClass'。