今天一個傳遞依賴問題搞了我半天,終於搞明白緣由了。一個jar包A依賴了httpclient,而後另外一個jar包B引入A,在IDEA裏面只能看到依賴A,無論咋樣都看不到依賴httpclient。spring
我在IDEA的項目B裏面,打包後在控制檯發現一個告警:bash
the POM for A is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
原來是jar包A的pom依賴有問題。maven
在應用B的根目錄打印依賴樹:spring-boot
mvn dependency:tree>tree.txt
應用依賴樹中出現以下警告。警告顯示:應用引入的依賴包無效,依賴包中傳遞依賴項不可用,能夠經過開啓debug獲取更多信息。ui
[WARNING] the POM for A is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details...
而後我開啓debug功能,從新打印依賴樹:debug
mvn -X dependency:tree>tree.txt
開啓maven debug功能後,警告後緊跟了一條錯誤信息,以下。code
[WARNING] The POM for com.huawei.dc.security:security-sdk-https:jar:1.0-SNAPSHOT is invalid, transitive dependencies (if any) will not be available: 2 problems were encountered while building the effective model for com.huawei.dc.security:security-sdk-https:1.0-SNAPSHOT [ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-configuration-processor:jar is missing. @ [ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-autoconfigure:jar is missing. @ ...
原來是A包中引入的另外的spring-boot-autoconfigure沒加版本號,這個我覺得能繼承父pom的版本號,發現這裏不生效。具體緣由我再分析。繼承
在A中把版本號補上從新發布,則一切正常。ci