{"id":2004,"date":"2017-05-12T10:46:47","date_gmt":"2017-05-12T08:46:47","guid":{"rendered":"http:\/\/blog.rabahi.net\/?page_id=2004"},"modified":"2017-05-12T10:51:10","modified_gmt":"2017-05-12T08:51:10","slug":"jetty-maven-plugin","status":"publish","type":"page","link":"https:\/\/blog.rabahi.net\/?page_id=2004","title":{"rendered":"jetty-maven-plugin"},"content":{"rendered":"<p>Jetty maven plugin allows you to deploy your webapp in jetty.<br \/>\nHere is an example that shows how to deploy your webapp in jetty and launch integration tests.<\/p>\n<h1>Add jetty maven plugin<\/h1>\n<p>We ask maven to fire the goal &#8216;deploy-war&#8217; at the phase &#8216;pre-integration-test&#8217; to deploy the webapp in jetty.<br \/>\nThis will have the benefit to be able to launch integration tests at the phase &#8216;integration_test&#8217;.<br \/>\nThen we will fire the goal &#8216;stop&#8217; at the phase &#8216;post-integration-test&#8217; to stop the container.<\/p>\n<pre lang=\"xml\">\r\n<plugins>\r\n(...)\r\n\r\n  <plugin>\r\n\t<groupId>org.eclipse.jetty<\/groupId>\r\n\t<artifactId>jetty-maven-plugin<\/artifactId>\r\n\t<version>${jetty-maven.version}<\/version>\r\n\r\n\t<configuration>\r\n\t\t<webApp>\r\n\t\t\t<contextPath>\/<\/contextPath>\r\n\t\t<\/webApp>\r\n\t\t<httpConnector>\r\n\t\t\t<port>8080<\/port>\r\n\t\t<\/httpConnector>\r\n\t\t<scanIntervalSeconds>10<\/scanIntervalSeconds>\r\n\t\t<stopPort>9005<\/stopPort>\r\n\t\t<stopKey>STOP<\/stopKey>\r\n\t<\/configuration>\r\n\r\n\t<executions>\r\n\r\n\t\t<execution>\r\n\t\t\t<id>start-jetty<\/id>\r\n\t\t\t<phase>pre-integration-test<\/phase>\r\n\t\t\t<goals>\r\n\t\t\t\t<goal>deploy-war<\/goal>\r\n\t\t\t<\/goals>\t\t\t\t\t\t\t\r\n\t\t<\/execution>\r\n\t\t<execution>\r\n\t\t\t<id>stop-jetty<\/id>\r\n\t\t\t<phase>post-integration-test<\/phase>\r\n\t\t\t<goals>\r\n\t\t\t\t<goal>stop<\/goal>\r\n\t\t\t<\/goals>\r\n\t\t<\/execution>\r\n\r\n\t<\/executions>\r\n    <\/plugin>\r\n\r\n(...)\r\n<\/plugins>\r\n<\/pre>\n<h1>Launch integration tests<\/h1>\n<p>When the container is started, we launch maven-failsafe-plugin goal &#8216;integration-test&#8217; at phase &#8216;integration-test&#8217;.<\/p>\n<pre lang=\"xml\">\r\n<plugins>\r\n(...)\r\n\r\n  <plugin>\r\n    <groupId>org.apache.maven.plugins<\/groupId>\r\n    <artifactId>maven-failsafe-plugin<\/artifactId>\r\n    <version>${maven-failsafe.version}<\/version>\r\n    <executions>\r\n      <execution>\r\n\t<id>integration-test<\/id>\r\n\t<goals>\r\n\t  <goal>integration-test<\/goal>\r\n\t<\/goals>\r\n     <\/execution>\r\n     <execution>\r\n       <id>verify<\/id>\r\n         <goals>\r\n\t   <goal>verify<\/goal>\r\n\t <\/goals>\r\n     <\/execution>\r\n   <\/executions>\r\n   <configuration>\r\n     <encoding>UTF-8<\/encoding>\r\n   <\/configuration>\r\n <\/plugin>\r\n\r\n(...)\r\n<\/plugins>\r\n<\/pre>\n<h1>Read More<\/h1>\n<ul>\n<li><a href=\"http:\/\/www.eclipse.org\/jetty\/documentation\/9.4.x\/jetty-maven-plugin.html\">jetty-maven-plugin documentation<\/a><\/li>\n<li><a href=\"https:\/\/maven.apache.org\/guides\/introduction\/introduction-to-the-lifecycle.html#Built-in_Lifecycle_Bindings\">maven build lifecycle<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Jetty maven plugin allows you to deploy your webapp in jetty. Here is an example that shows how to deploy your webapp in jetty and launch integration tests. Add jetty maven plugin We ask maven to fire the goal &#8216;deploy-war&#8217; at the phase &#8216;pre-integration-test&#8217; to deploy the webapp in jetty. This will have the benefit [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":884,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2004","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/2004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2004"}],"version-history":[{"count":5,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/2004\/revisions"}],"predecessor-version":[{"id":2010,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/2004\/revisions\/2010"}],"up":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/884"}],"wp:attachment":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}