解決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

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