2026-08-22 15:11
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>shade-classes</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>jakarta</shadedClassifierName>
<createSourcesJar>true</createSourcesJar>
<shadeSourcesContent>true</shadeSourcesContent>
<relocations>
<relocation>
<pattern>javax.servlet</pattern>
<shadedPattern>jakarta.servlet</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
这段 Maven 配置是 maven-shade-plugin 的一个执行项,核心作用是将 javax.servlet 包重定位为 jakarta.servlet,并生成一个带 jakarta 分类器的附加 JAR 包
@杜福忠 这个我的方案无需改任何代码