代码之家  ›  专栏  ›  技术社区  ›  SpaceTrucker

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

  •  0
  • SpaceTrucker  · 技术社区  · 7 年前

    我有一个遗留应用程序,我正试图使用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 central下载依赖项?

    1 回复  |  直到 7 年前
        1
  •  0
  •   SpaceTrucker    7 年前

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

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

    但是,如果镜像的源包含一些工件,而镜像的目标不包含这些工件,那么这将不起作用。