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


I want to use SSL / https as

The JT-Maven plugins are described, but I do not know about configuring the plugin. Any indications, examples, tutorials, walkthroughs?

In addition to this, I wonder how the 3b of the above tutorial should be taken, where it is necessary to manipulate the jettie server ( java-classpath $ jetty_home / lib /jetty-util-6.1 -SNAPSHOT.jar: $ JETTY_HOME / lib / jetty-6.1-SNAPSHOT.jar org.mortbay.jetty.security.PKCS12Import jetty.pkcs12 Keystore ).

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

  & lt; Plugin & gt; & Lt; Group & gt; Org.codehaus.mojo & lt; / Group & gt; & Lt; ArtifactId & gt; Keytool-Maven-plugin & lt; / ArtifactId> & Lt; Hanging & gt; & Lt; Execution & gt; & Lt; Step & gt; Generated resources & lt; / Step & gt; & Lt; ID & gt; Clean & lt; / Id & gt; & Lt; Goals & gt; & Lt; Goal & gt; Clean & lt; / Target & gt; & Lt; / Targets & gt; & Lt; / Execution & gt; & Lt; Execution & gt; & Lt; Step & gt; Generated resources & lt; / Step & gt; & Lt; ID & gt; Genkey & lt; / Id & gt; & Lt; Goals & gt; & Lt; Goal & gt; Genkey & lt; / Target & gt; & Lt; / Targets & gt; & Lt; / Execution & gt; & Lt; / Hanging & gt; & Lt; Configuration & gt; & Lt; Keystore & gt; $ {Project.build.directory} /jetty-ssl.keystore</keystore> & Lt; Dname & gt; Cn = my.hostname.tld & lt; / Dname & gt; & Lt ;! - Put your CN here - & gt; & Lt; KeyPass & gt; Jetty6 & lt; / KeyPass & gt; & Lt; Storepass & gt; Jetty6 & lt; / Storepass & gt; & Lt; Aka & gt; Jetty6 & lt; / Aka & gt; & Lt; Keyalg & gt; RSA & lt; / Keyalg & gt; & Lt; / Configuration & gt; & Lt; / Plugin & gt;  

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

  & lt; Plugin & gt; & Lt; Group & gt; Org.mortbay.jetty & lt; / Group & gt; & Lt; ArtifactId & gt; Maven-Ferries-plugin & lt; / ArtifactId> & Lt; Version & gt; 6.1.10 & lt; / Version & gt; & Lt; Configuration & gt; & Lt; ContextPath & gt; / References & lt; / ContextPath & gt; & Lt; ScanIntervalSeconds & gt; 5 & ​​lt; / ScanIntervalSeconds & gt; & Lt; Connectors & gt; & Lt; Connector implementation = "org.mortbay.jetty.nio.SelectChannelConnector" & gt; & Lt; Harbor & gt; 8080 & lt; / Port & gt; & Lt; MaxIdleTime & gt; 60000 & lt; / MaxIdleTime & gt; & Lt; / Connector & gt; & Lt; Connector implementation = "org.mortbay.jetty.security.SslSocketConnector" & gt; & Lt; Harbor & gt; 8443 & lt; / Port & gt; & Lt; MaxIdleTime & gt; 60000 & lt; / MaxIdleTime & gt; & Lt; Keystore & gt; $ {Project.build.directory} /jetty-ssl.keystore</keystore> & Lt; Password & gt; Jetty6 & lt; / Password & gt; & Lt; KeyPassword & gt; Jetty6 & lt; / KeyPassword & gt; & Lt; / Connector & gt; & Lt; / Connectors & gt; & Lt; / Configuration & gt; & Lt; / Plugin & gt; Run  

run mvn jetty: run and open.


Comments