In this tutorial, we will learn how to configure SSL/TLS with tomcat7-maven-plugin.
Follow the step (1) from the last tutorial to generate a self-signed certificate.
We are reusing our last servlet example, with following changes in pom.xml:
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <path>/</path> <httpsPort>8443</httpsPort> <keystoreFile>C:\my-cert-dir\localhost-rsa.jks</keystoreFile> <keystorePass>123456</keystorePass> </configuration> </plugin>
To try examples, run embedded tomcat (configured in pom.xml of example project below):
mvn tomcat7:run-war
Access application at https://localhost:8443/hello
Note that, chrome shows 'Not secure' warning with self signed certificate. Check out last tutorial's step (3) for more info.
Dependencies and Technologies Used: