如何在pom中解决过时的存储库信息?

时间:2018-03-13 21:04:11

标签: maven maven-2

我有一个遗留应用程序,我试图使用maven 2构建。

目前,构建失败并显示消息

Unable to get dependency information: Unable to read the metadata file for artifact 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar': Cannot find parent: org.sonatype.oss:oss-parent for project: com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.2 for project com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.2
  com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.2

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)

该应用程序依赖于concurrentlinkedhashmap 1.2。但是,此工件在其pom.xml

中指定了以下内容
  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>3</version>
  </parent>
  ...
  <repositories>
    <repository>
      <id>sourceforge</id>
      <url>http://oss.sonatype.org/content/groups/sourceforge/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    ...
  </repositories>

现在,在查看指定的存储库时,依赖关系并未包含在其中。

但是maven central中可以使用父依赖项。

我需要做什么,依赖从maven中心下载?

1 个答案:

答案 0 :(得分:0)

如果工件现在包含在另一个仓库中,则可以在maven设置中定义mirror以将maven指向现在包含artificat的仓库。

<mirror>
  <id>sourceforge-mirror</id>
  <name>Sourceforge Mirror</name>
  <url>http://repo1.maven.org/maven2</url>
  <mirrorOf>sourceforge</mirrorOf>
</mirror>

然而,如果镜子的来源包含一些瑕疵,那么镜子的目标就不会有效。

相关问题