我在我的POM中使用了Apache Poi版本3.8。但由於某些內部依賴性,它仍然(隨着(可能))下載poi-3.2和poi-3.8。對我來說,奇怪的行爲是我的項目使用poi-3.2,即使我在POM中提到了3.8版本。我也一樣谷歌搜索了很多,但發現自己不吉利。 這是我的POM項:Maven Dependancy引用舊的Poi版本
ClassLoader classloader =
org.apache.poi.poifs.filesystem.POIFSFileSystem.class.getClassLoader();
URL res = classloader.getResource(
"org/apache/poi/poifs/filesystem/POIFSFileSystem.class");
String path = res.getPath();
System.out.println("Core POI came from " + path);
此打印:
核心POI從 來到
<dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.8</version> <type>jar</type> </dependency>
我已經通過代碼使用檢查POI罐子我的項目在類路徑文件:/ d:/Software/Softwares/apache-tomcat-6.0.33/webapps/scd-web/WEB-INF/lib/poi-3.2.jar /org/apache/poi/poifs/filesystem/POIFSFileSystem.class
在相同的文件夾中有一個poi-3.8.jar,但是類路徑拾取3.2。
我的問題是: 我應該怎麼做,以使我的項目使用POI-3.8.jar代替POI-3.2.jar。
很多感謝!
編輯: 輸出MVN依賴:樹
[INFO]大廈SCD-常見[INFO]任務段:[依賴性:樹] [INFO] ----- -------------------------------------------------- ----------------- [警告]下載xmlbeans時:xmlbeans:2.3.0這個神器 已被重新定位到org.apache.xmlbeans:xmlbeans:2.3.0。
[INFO] [dependency:tree] [INFO] com.idc:scd-common:jar:4.2.0.5 [INFO] + - org.springframework:spring-webmvc:jar:2.5.6:compile [ INFO] | + - commons-logging:commons-logging:jar:1.1.1:compile [INFO] | + - org.springframework:spring-beans:jar:2.5.6:compile [INFO] | + - org.springframework:spring-context-support:jar:2.5.6:compile [INFO] | - org.springframework:spring-web:jar:2.5.6:compile [INFO] + - com.idc.worldwide.keystones:service-single-signon-dynamo-api:jar:1.0:c ompile [INFO ] + - com.idc.worldwide.keystones:service-single-signon-dynamo-database-impl :jar:1.0.3:compile [INFO] | + - org.apache:commons-dbcp:jar:1.2.2:compile [INFO] | + - org.apache:commons-pool:jar:1.4:compile [INFO] | - com.idc.worldwide.webchannel:sage-core:jar:3.2.0.001:compile [INFO] | + - com.idc.webchannel.legacy.sage-dependencies:aspose-slides:jar:1。 0:編譯[INFO] | + - com.servlets:cos:jar:09May2002:compile [INFO] | + - com.sun:jai_codec:jar:1.1.3:compile [INFO] | + - com.sun:jai_core:jar:1.1.3:compile [INFO] | + - com.verity:k2:jar:5.00.3177.0:compile [INFO] | + - org.apache:poi:jar:3.2:compile [INFO] | + - org.apache:poi_contrib:jar:3.2:compile [INFO] | + - org.apache:poi_scratchpad:jar:3.2:compile [INFO] | - org.springframework:spring:jar:2.5.6:compile [INFO] + - org.springframework:spring-core:jar:3.0.5.RELEASE:compile [INFO] | - org。springframework的:彈簧ASM:罐子:3.0.5.RELEASE:編譯[INFO] + - org.springframework:彈簧AOP:罐子:3.0.5.RELEASE:編譯
「mvn依賴:樹」的輸出是什麼? – bowmore
@bowmore:它.. [INFO]掃描的項目... [INFO] Reactor生成順序: [INFO]服務合同數據庫 [INFO] SCD-共同 [INFO] SCD-WEB [INFO ]搜索知識庫的插件機智 下載: – manurajhada
你應該把這個輸出的問題,而不是評論:) – bowmore