如何使用Eclipse的maven-jetty-plugin设置SSL? [英] How to setup SSL with Eclipse's maven-jetty-plugin?

查看:277
本文介绍了如何使用Eclipse的maven-jetty-plugin设置SSL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够使用最新的Eclipse maven-jetty-pluginkeytool-maven-plugin使用SSL启动Jetty,如

I would like to be able to launch Jetty with SSL using the latest Eclipse maven-jetty-plugin and the keytool-maven-plugin as seen here. However, those two plugins are now quite outdated.

有人可以使用最新版本的插件说明一个有效的示例吗?谢谢!

Could somebody please illustrate a working example of this using the latest versions of the plugins? Thanks!

推荐答案

Carlspring,诀窍是SSL连接器的实现:包和类名在更新后被修改.

Carlspring, the trick is the implementation of the SSL connector: package and class name are modified after updates.

在6.1.x版中,实现为: org.mortbay.jetty.security.SslSocketConnector

At version 6.1.x, the implementation was: org.mortbay.jetty.security.SslSocketConnector

在8.x之后是: org.eclipse.jetty.server.ssl.SslSocketConnector

After 8.x, is: org.eclipse.jetty.server.ssl.SslSocketConnector

请注意,还需要在pom.xml中包括jetty-ssl依赖项.

Note that is also needed to include jetty-ssl dependency in your pom.xml.

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>7.0.0.pre5</version>
  <configuration>
    <connectors>
      <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
        <port>8080</port>
      </connector>
      <connector implementation="org.eclipse.jetty.server.ssl.SslSocketConnector">
        <port>8443</port>
        <keystore>src/test/resources/server.keystore</keystore>
        <keyPassword>123456</keyPassword>
        <password>123456</password>
      </connector>
    </connectors>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty-ssl</artifactId>
      <version>7.0.0.pre5</version>
    </dependency>
  </dependencies>
</plugin>

这篇关于如何使用Eclipse的maven-jetty-plugin设置SSL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆