我在我的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