在一个maven项目中,如果存在编译需要而发布不需要的jar包,可以用scope标签,值设为provided。如下: <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version>