我终于通过使用go-offline-maven-plugin找到了解决方案。
<plugin> <groupId>de.qaware.maven</groupId> <artifactId>go-offline-maven-plugin</artifactId> <version>1.0.0</version> <configuration> <dynamicDependencies> <DynamicDependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-junit4</artifactId> <version>2.20.1</version> <repositoryType>PLUGIN</repositoryType> </DynamicDependency> </dynamicDependencies> </configuration> </plugin>
并尝试使用以下方法获取所有依赖项:
mvn de.qaware.maven:go-offline-maven-plugin:resolve-dependencies



