解决jar包依赖冲突:Found Banned Dependency

使用eclipse的maven构建项目的时候出现了依赖冲突

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building zdttb-core 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ zdttb-core ---
[INFO] Deleting D:\workspace-asiabao\zdttb-core\target
[INFO] 
[INFO] --- debug-plugin:1.0-SNAPSHOT:clean-local (default) @ zdttb-core ---
[INFO] ${clean.local.disabled}为true,跳过clean-local Mojo。
[INFO] 
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-banned-dependencies) @ zdttb-core ---
[WARNING] Rule 2: org.apache.maven.plugins.enforcer.BannedDependencies failed with message:
Found Banned Dependency: commons-logging:commons-logging:jar:1.2
Use 'mvn dependency:tree' to locate the source of the banned dependencies.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.875 s
[INFO] Finished at: 2019-03-26T10:18:56+08:00
[INFO] Final Memory: 21M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce (enforce-banned-dependencies) on project zdttb-core: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

--------------------- 

各种mvn clean, update项目都不好使,最主要的是前两天还正常使用,突然就好不使了

根据错误提示,首先找到该项目的目录:

进行命令:

mvn dependency:tree 查看项目依赖树:

根据项目中的提示

Found Banned Dependency: commons-logging:commons-logging:jar:1.2

查找到

是在这个包下 org.jxls:jxls-poi:jar:1.0.11

或者根据命令查找: mvn dependency:tree -Dverbose -Dincludes=“xxx”

找到以后,在项目中去除该包,再重新mvn clean install

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章