当前位置: 首页 > 知识库问答 >
问题:

引用旧Poi版本的Maven依赖关系

吕扬
2023-03-14
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>3.8</version>
    <type>jar</type>
</dependency>
    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);

这将打印:

Core POI came from file:/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 dependency:tree的输出

 [INFO] Building SCD-common [INFO]    task-segment: [dependency:tree]
 [INFO]
 ------------------------------------------------------------------------ 
 [WARNING] While downloading xmlbeans:xmlbeans:2.3.0   This artifact has been relocated to 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:compile 
 [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:compile 
 [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:spring-asm:jar:3.0.5.RELEASE:compile 
 [INFO]  +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile

共有1个答案

段坚
2023-03-14

看起来像是

org.apache:poi:jar:3.2

是的编译依赖项

com.idc.worldwide.keystones:service-single-signon-dynamo-database-impl

(虽然我觉得你可能剪了什么东西)

org.apache.poi:poi:jar:3.8
 类似资料:
  • 问题内容: 我正在与Maven项目一起工作,并且有两个项目,并且。我是一个maven库,其pom如下所示: 在我上面的POM,带来的是各种Spring框架依赖喜欢的旧版本,。它带来了版本,我想使用这两个spring框架的最新版本,即。排除旧版本和来自最新版本并使用最新版本的正确方法是什么? 我需要使用最新版本,因为某些类仅在最新版本中存在。 问题答案: 依赖项要求的库版本与要使用的库版本之间可能存

  • 我写了一个库,它依赖于Guava版本20.0(与JDK 1.7兼容的最后一个版本) 然后,我编写了一个使用该库的应用程序,还uk.org.lidalia: slf4j-test: 1.2.0(带有测试范围)。slf4j-test依赖于Guava的14.0.1版本。 我的问题是,我的应用程序将两个不同版本的Guava视为可传递依赖项,并选择较旧的版本。现在,当我调用库中的某些方法时,我会得到类或方法

  • 问题内容: 最近,我一直在研究前一段时间开发的项目中的一些改进,这就是我所发现的。pom文件中的许多依赖项都没有指定版本,但是已经解决了。该项目包含1个根模块和2个子模块。使用了Aggregator模式,这意味着根本没有dependencyManagement部分。上层项目仅聚合了2个模块,仅此而已。子项目并不将其称为父项。他们有不同的父母。我无法理解的是,子项目本身或它们的父项(事实上,它也没有

  • 我想知道是否有办法从maven依赖中删除版本号。 假设对于我的项目,我想使用maven依赖插件获取commons-lang3: 我的pom配置说,它正在获取对<代码>的依赖关系/我的项目中的lib目录 我想实现的是从commons-lang3-3.4动态删除版本号。jar。它看起来像: ./lib/commons-lang3.jar 问:有没有办法做这样的事情? 在这里指定finalName没有帮

  • 我正在尝试编译一个名为web server的Maven项目,该项目依赖于指定依赖版本范围[2.0,3.0]内的搜索客户端。但是,由于“没有可用的版本”,编译失败 以下是我将遵循的步骤: 进行更改并在本地构建搜索客户端 这将在我的本地m2存储库中为这个客户端pom构建一个2.0-SNAPSHOT jar。 如果出现以下错误,则无法编译: [错误]未能在项目通用上执行目标:无法解决项目com.test