Maven's jetty plugin SSL configuration issue

后端 未结 4 1185
鱼传尺愫
鱼传尺愫 2020-12-09 22:44

I\'m using Jetty\'s plugin for Maven, version 7.0.0.pre5, but I have issues configuring it to have a SSL Connector. Whenever I start the application, it fails stating that t

相关标签:
4条回答
  • 2020-12-09 23:16

    Actually same as answered by Pascal Thivent with conjunction of an gnuf answer but valid one (ver. 6.1.26).

    <plugin>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty-maven-plugin</artifactId>
      <version>6.1.26</version>
      <configuration>
        <connectors>
          <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
            <port>8080</port>
          </connector>
          <connector implementation="org.mortbay.jetty.security.SslSelectChannelConnector">
            <port>8443</port>
            <keystore>server.keystore</keystore>
            <keyPassword>password</keyPassword>
          </connector>
        </connectors>
      </configuration>
      <dependencies>
        <dependency>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>jetty-sslengine</artifactId>
          <version>6.1.26</version>
        </dependency>
      </dependencies>
    </plugin>
    
    0 讨论(0)
  • 2020-12-09 23:19

    Not sure this is normal but the jetty-maven-plugin doesn't have jetty-ssl as dependency in its pom. So please update your pom like this:

    <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.mortbay.jetty.ssl.SslSelectChannelConnector">
            <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>
    

    And the plugin will succeed to load org.mortbay.jetty.ssl.SslSelectChannelConnector.

    0 讨论(0)
  • 2020-12-09 23:31

    For the current version of jetty-maven-plugin, 8.0.0.M2, the class names have been moved into org.eclipse.*, and no additional dependencies are needed.

    <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>8.0.0.M2</version>
        <configuration>
            <webAppConfig>
                <contextPath>/</contextPath>
            </webAppConfig>
            <connectors>
                <connector implementation="org.eclipse.jetty.server.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>
    </plugin>
    

    See: http://wiki.eclipse.org/Jetty/Starting/Porting_to_Jetty_7

    0 讨论(0)
  • 2020-12-09 23:33

    For anyone using Jetty 6.x, the artifact to include in the dependencies for the plugin is jetty-sslengine.

    0 讨论(0)
提交回复
热议问题