Jersey + Swagger + Swagger-UI + Maven configuration
<p>I am trying swagger for the first time with Jersey and Maven, and I am wondering if I am going down the right path. I have jersey, maven, and swagger working on my local computer. Soon, I want to deploy it to different environments and include swagger-ui.</p>

<ol>
<li><p>If I configure my web.xml file to <code>&lt;param-value&gt;http://localhost:8080/api&lt;/param-value&gt;</code> then I see that swagger works on my local computer. But will I need to change this address every time I want to deploy my code to different environments (for example going from a Dev environment, to QA environment, to Production environment), and if so how would I go about doing that or is it not possible/not what swagger is meant for?</p></li>
<li><p>I want to incorporate swagger-ui with my project. I see online suggestions of downloading the file manually from git and placing it in my project. But what I am wondering is if there is a maven dependency that I can use instead so that I can use maven to get the necessary code to use swagger-ui and configure it to work with jersey. If so what is the dependency and how do I use it to deploy the code through multiple environments?</p></li>
</ol>

<p>Please give guidance and links to tutorials if possible seeing as I am new to this technology. Also if I am way off in my thought process of using jersey/swagger/swagger-ui/maven without manually downloading code from git and being able to deploy the code through multiple environments please let me know so I can look for another way to use REST in my application. </p>

<p>Thank you for your help.</p>

<p>pom.xml:</p>

<pre><code>    &lt;repositories&gt;
      &lt;repository&gt;
          &lt;id&gt;maven2-repository.java.net&lt;/id&gt;
          &lt;name&gt;Java.net Repository for Maven&lt;/name&gt;
          &lt;url&gt;http://download.java.net/maven/2/&lt;/url&gt;
          &lt;layout&gt;default&lt;/layout&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;

  &lt;properties&gt;
      &lt;jersey2.version&gt;2.19&lt;/jersey2.version&gt;
      &lt;jaxrs.version&gt;2.0.1&lt;/jaxrs.version&gt;
  &lt;/properties&gt;

  &lt;!-- Dependencies --&gt;
  &lt;dependencies&gt;


    &lt;!-- JAX-RS --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
        &lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt;
        &lt;version&gt;${jaxrs.version}&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;!-- Jersey 2.19 --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
        &lt;artifactId&gt;jersey-container-servlet&lt;/artifactId&gt;
        &lt;version&gt;${jersey2.version}&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
        &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
        &lt;version&gt;${jersey2.version}&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
        &lt;artifactId&gt;jersey-client&lt;/artifactId&gt;
        &lt;version&gt;${jersey2.version}&lt;/version&gt;
    &lt;/dependency&gt;

     &lt;!-- Servlet Library --&gt;
     &lt;!-- http://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --&gt;
     &lt;dependency&gt;
         &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
         &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
         &lt;version&gt;3.1.0&lt;/version&gt;
         &lt;scope&gt;provided&lt;/scope&gt;
     &lt;/dependency&gt;

     &lt;!-- Spring dependencies --&gt;
     &lt;!-- http://mvnrepository.com/artifact/org.springframework/spring-core --&gt;
     &lt;dependency&gt;
         &lt;groupId&gt;org.springframework&lt;/groupId&gt;
         &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
         &lt;version&gt;4.1.4.RELEASE&lt;/version&gt;
     &lt;/dependency&gt;

     &lt;!-- http://mvnrepository.com/artifact/org.springframework/spring-web --&gt;
     &lt;dependency&gt;
         &lt;groupId&gt;org.springframework&lt;/groupId&gt;
         &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
         &lt;version&gt;4.1.4.RELEASE&lt;/version&gt;
     &lt;/dependency&gt;

     &lt;!-- http://mvnrepository.com/artifact/org.springframework/spring-webmvc --&gt;
     &lt;dependency&gt;
         &lt;groupId&gt;org.springframework&lt;/groupId&gt;
         &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
         &lt;version&gt;4.1.4.RELEASE&lt;/version&gt;
     &lt;/dependency&gt;

    &lt;!-- Junit --&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;3.8.1&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;io.swagger&lt;/groupId&gt;
        &lt;artifactId&gt;swagger-jersey2-jaxrs&lt;/artifactId&gt;
        &lt;version&gt;1.5.0&lt;/version&gt;
    &lt;/dependency&gt;
  &lt;/dependencies&gt;
</code></pre>

<p>web.xml</p>

<pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://java.sun.com/xml/ns/javaee"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  id="WebApp_ID" version="3.0"&gt;

  &lt;display-name&gt;HelloWorldSpring&lt;/display-name&gt;

  &lt;servlet&gt;
      &lt;servlet-name&gt;spring-mvc&lt;/servlet-name&gt;
      &lt;servlet-class&gt;
          org.springframework.web.servlet.DispatcherServlet
      &lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;    

  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;spring-mvc&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;

  &lt;servlet&gt;
      &lt;servlet-name&gt;jersey-serlvet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt;
      &lt;init-param&gt;
           &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
           &lt;param-value&gt;
           io.swagger.jaxrs.listing, 
           com.jer.rest
           &lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;

  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;jersey-serlvet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;


   &lt;servlet&gt;
      &lt;servlet-name&gt;Jersey2Config&lt;/servlet-name&gt;
      &lt;servlet-class&gt;io.swagger.jersey.config.JerseyJaxrsConfig&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;api.version&lt;/param-name&gt;
          &lt;param-value&gt;1.0.0&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;swagger.api.basepath&lt;/param-name&gt;
          &lt;param-value&gt;http://localhost:8080/HealthTracker/rest&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
  &lt;/servlet&gt;

   &lt;!-- Other XML Configuration --&gt;
  &lt;!-- Load by Spring ContextLoaderListener --&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/root-context.xml&lt;/param-value&gt;
  &lt;/context-param&gt;


   &lt;!-- Spring ContextLoaderListener --&gt;
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;

&lt;/web-app&gt;
</code></pre>