Introduction
jetty-maven-plugin
(formerly known as maven-jetty-plugin
)is a maven plugin which enables the jetty container in maven project. It is very convenient in development environment since you can start the web app by issue only one command mvn jetty:run
. By default it only supports http protocol. Additional configuration is necessary if https is required. Roughly we needs:
- A development certificate
- Instruct the jetty plugin to use the certificate
Besides jetty-maven-plugin
, another maven plugin called keytool-maven-plugin
is also needed to generate the certificate.
It should be noted that the plugin has evolved a lot since version 7. The configuration is different from different version.
V6
If you are still using the version 6 plugin, please refer to this blog: Configure Maven Jetty plugin for SSL communication. I tried it in my project, but it is unstable. Sometimes it works and sometimes it fails. So I have to upgrade the plugin to V8.
V8
Add following sections to the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
Every thing should be ready now. If you are using Postman as your test tool, please navigate to https://loocalhost:8443/context
to accept the certificate before you make further tests after running mvn jetty:run
.