我在Mac上的Eclipse中创建了这个Maven项目。以下两个工件在我的pom中。在MAC上没有问题。
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.14</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.14</version>
</dependency>
但是,当我最近在PC上将代码移至Eclipse时,出现了这个奇怪的错误“缺少工件org.apache.poi:poi:jar:3.14”。它既指向依赖块,又指向pom的第一行(请参见屏幕截图)
我建立了两个存储库,一个是公共的,另一个是机构的。
<repositories>
<repository>
<id>JBoss repository</id>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>repo</name>
<url>http://risdevtool01p.mdanderson.edu:8081/artifactory/repo</url>
</repository>
</repositories>
当我执行“mvn clean install -U”时,看起来它正在尝试从两个不同的存储库下载poi和poi-ooxml。
Downloading:http://repository.jboss.org/nexus/content/groups/public/org/apache/poi/poi-ooxml-schemas/3.14/poi-ooxml-schemas-3.14.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/poi/poi/3.14/poi-3.14.jar
Downloading: http://risdevtool01p.mdanderson.edu:8081/artifactory/repo/org/apache/poi/poi/3.14/poi-3.14.jar
Downloading: http://risdevtool01p.mdanderson.edu:8081/artifactory/repo/org/apache/poi/poi-ooxml-schemas/3.14/poi-ooxml-schemas-3.14.jar
最佳答案
问题出在JBoss
的关系中,没有正确删除工件,确实我们在可用版本列表中拥有该版本,但是该版本在http://repository.jboss.org/nexus/content/groups/public/org/apache/poi/poi/3.14/的预期位置不可用
404 - Path /org/apache/poi/poi/3.14/ not found in group repository "Public Repository Group" [id=public].
Path /org/apache/poi/poi/3.14/ not found in group repository "Public Repository Group" [id=public].
但是,显然,他们确实已正确删除了此版本,实际上此版本已不再是可用版本的一部分,因为您可以在此处http://repository.jboss.org/nexus/content/groups/public/org/apache/poi/poi/看到,所以如果您删除本地存储库并使用
mvn clean install
类型的命令再试一次,它将起作用