title: Spring repackage is adding a duplicate copy of all spring jars in BOOT-INF/classes
body: <p>I recently upgraded my project to <code>spring-boot</code> version 2.7.0. After this upgrade, when I run the jar of my maven profile, it gives me an <code>invocationTargetException</code>:</p>
  <pre><code>Caused by: java.lang.reflect.InvocationTargetException
          at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
          at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
          at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
          at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
  </code></pre>
  <p>I noticed that my built jar now contained a duplicate copy of all <code>org/springframework/boot/loader/</code> libraries inside the <code>BOOT-INF/classes</code> directory. This is what I see when I look inside the jar file by running <code>jar tvf jarfile</code>:</p>
  <pre><code>0 Wed Jun 29 20:06:28 PDT 2022 META-INF/
     492 Wed Jun 29 20:06:28 PDT 2022 META-INF/MANIFEST.MF
       0 Fri Feb 01 00:00:00 PST 1980 org/
       0 Fri Feb 01 00:00:00 PST 1980 org/springframework/
       0 Fri Feb 01 00:00:00 PST 1980 org/springframework/boot/
       0 Fri Feb 01 00:00:00 PST 1980 org/springframework/boot/loader/
    5871 Fri Feb 01 00:00:00 PST 1980 org/springframework/boot/loader/ClassPathIndexFile.class
    7675 Fri Feb 01 00:00:00 PST 1980 org/springframework/boot/loader/ExecutableArchiveLauncher.class
    2551 Fri Feb 01 00:00:00 PST 1980 org/springframework/boot/loader/JarLauncher.class
    1483 Fri Feb 01 00:00:00 PST 1980 org/springframework/boot/loader/LaunchedURLClassLoader$DefinePackageCallType.class
    1535 Fri Feb 01 00:00:00 PST 1980 org/springframework/boot/loader/LaunchedURLClassLoader$UseFastConnectionExceptionsEnumeration.class
   11154 Fri Feb 01 00:00:00 PST 1980 org/springframework/boot/loader/LaunchedURLClassLoader.class
    5932 Fri Feb 01 00:00:00 PST 1980 org/springframework/boot/loader/Launcher.class
  
  ...
  
       0 Wed Jun 29 20:06:28 PDT 2022 BOOT-INF/
       0 Wed Jun 29 20:06:28 PDT 2022 BOOT-INF/classes/
       0 Fri Feb 01 00:00:00 PST 1980 BOOT-INF/classes/org/
       0 Fri Feb 01 00:00:00 PST 1980 BOOT-INF/classes/org/springframework/
       0 Fri Feb 01 00:00:00 PST 1980 BOOT-INF/classes/org/springframework/boot/
       0 Fri Feb 01 00:00:00 PST 1980 BOOT-INF/classes/org/springframework/boot/loader/
    5871 Fri Feb 01 00:00:00 PST 1980 BOOT-INF/classes/org/springframework/boot/loader/ClassPathIndexFile.class
    7675 Fri Feb 01 00:00:00 PST 1980 BOOT-INF/classes/org/springframework/boot/loader/ExecutableArchiveLauncher.class
    2551 Fri Feb 01 00:00:00 PST 1980 BOOT-INF/classes/org/springframework/boot/loader/JarLauncher.class
    1483 Fri Feb 01 00:00:00 PST 1980 BOOT-INF/classes/org/springframework/boot/loader/LaunchedURLClassLoader$DefinePackageCallType.class
    1535 Fri Feb 01 00:00:00 PST 1980 BOOT-INF/classes/org/springframework/boot/loader/LaunchedURLClassLoader$UseFastConnectionExceptionsEnumeration.class
   11154 Fri Feb 01 00:00:00 PST 1980 BOOT-INF/classes/org/springframework/boot/loader/LaunchedURLClassLoader.class
    5932 Fri Feb 01 00:00:00 PST 1980 BOOT-INF/classes/org/springframework/boot/loader/Launcher.class
  </code></pre>
  <p>In my <code>pom.xml</code>, I have a repackage step for a particular profile:</p>
  <pre><code>&lt;profile&gt;
              &lt;id&gt;profileName&lt;/id&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;id&gt;repackage&lt;/id&gt;
                      &lt;configuration&gt;
                         &lt;classifier&gt;someName&lt;/classifier&gt;
                      &lt;/configuration&gt;
                    &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
  &lt;/profile&gt;
  </code></pre>
  <p>This profile gives me the corrupted jar. Before the spring upgrade, it was working even with the repackage step so something must have changed. How can I avoid the duplicate spring boot libraries in my jar?</p>