如何在没有提供 jar 的情况下使用 Maven 将所有必需的 jar 放在最终 jar 内的 lib 文件夹中?

How to put all required jars in a lib folder inside the final jar with Maven without provided jars?

我已阅读问题 How do I put all required JAR files in a library folder inside the final JAR file with Maven? 和答案

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <id>copy-dependencies</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>copy-dependencies</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
                <overWriteReleases>false</overWriteReleases>
                <overWriteSnapshots>false</overWriteSnapshots>
                <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
        </execution>
    </executions>
</plugin>

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
                <!-- <classpathPrefix>lib</classpathPrefix> -->
                <!-- <mainClass>test.org.Cliente</mainClass> -->
            </manifest>
            <manifestEntries>
                <Class-Path>lib/</Class-Path>
            </manifestEntries>
        </archive>
    </configuration>
</plugin>

提供了 OP 所质疑的内容。

是否可以在不包含声明为提供的依赖项的情况下做到这一点?

<overWriteIfNewer>true</overWriteIfNewer>下添加<excludeScope>provided</excludeScope>