title: spring-boot : Exclude dependencies on packaging
body: <p>I am working on a spring boot project ( Project A ) that would be included in other projects ( Project B, Project C ... ) . I have several dependencies in Project A, but in the project importing Project A, some or only one may be required. 
  I am trying to find a way to exclude the jar dependencies while packaging Project A so that the required ones will be provided by Project B during run time. I would like to have the dependencies available when the Project A is run independently for testing purposes. </p>
  
  <p><strong>Already tried the following</strong></p>
  
  <p>I have tried using:</p>
  
  <pre><code>&lt;scope&gt;provided&lt;/scope&gt;
  &lt;optional&gt;true&lt;/optional&gt;
  </code></pre>
  
  <p>Still the jars end up in the final artifact.</p>
  
  <p>Also  tried adding the following to the spring-boot-maven-plugin</p>
  
  <pre><code>           &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;repackage&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;excludeArtifactIds&gt;spring-boot-starter-redis&lt;/excludeArtifactIds&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
  </code></pre>
  
  <p>This would just remove the spring-boot dependency , but the jars for the children of this dependency would still end up in the final artifact.</p>