Váš košík je aktuálně prázdný!
SSL in Jetty plug-in
Yesterday I had a chat with my colleague. We talked about how the Maven Jetty plug-ins enable SSL. In my last article I described how to enable SSL in Tomcat, so now let’s see how to achieve the same result in the Jetty plugin.
It is a few simple steps.
At first we have to create a keystore with a server certificate:
keytool-genkey-alias-jetty6 keyalg RSA-keystore target / jetty-ssl.keystore-storepass changeit-keypass changeit-DNAME "CN = Your Domain Name"
Then modify the configuration of the Maven pom.xml:
org.mortbay.jetty
maven-jetty-plugin
/context
5
8080
60000
8443
60000
${project.build.directory}/jetty-ssl.keystore
changeit
changeit
In the previous configuration, we defined the connection on port 8080 and port 8443 for SSL connections.
If we did not want to manually generate a server certificate, you can use other Maven plugin as shown below.
org.codehaus.mojo
keytool-maven-plugin
generate-resources
clean
clean
generate-resources
genkey
genkey
${project.build.directory}/jetty-ssl.keystore
cn=localhost
changeit
changeit
jetty6
RSA
Now, when we invoke mvn jetty: run
command, plug-in automatically creates a certificate that is then used in Jetty.
Categories:
Leave a Reply