HowTo use https / ssl with Maven/Mortbay Jetty Plugin?

后端 未结 3 1476
终归单人心
终归单人心 2020-12-13 03:06

I would like to use ssl / https as described in

http://docs.codehaus.org/display/JETTY/How+to+configure+SSL

using jetty-maven-plugin, but I don\'t know how t

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-13 03:44

    You can use Maven to create a development certificate and use it when starting Jetty. First, configure the keytool-maven-plugin to create a development certificate:

    
      org.codehaus.mojo
      keytool-maven-plugin
      
        
          generate-resources
          clean
          
            clean
          
        
        
          generate-resources
          genkey
          
            genkey
          
        
      
      
        ${project.build.directory}/jetty-ssl.keystore
        cn=my.hostname.tld
        jetty6
        jetty6
        jetty6
        RSA
      
    
    

    Change the CN as you wish. Then configure the maven-jetty-plugin to use the development certificate:

    
      org.mortbay.jetty
      maven-jetty-plugin
      6.1.10
      
        /context
        5
        
          
            8080
            60000
          
          
            8443
            60000
            ${project.build.directory}/jetty-ssl.keystore
            jetty6
            jetty6
          
        
      
    
    

    Run mvn jetty:run and open https://localhost:8443/context.

提交回复
热议问题