首页 > 解决方案 > Maven 不解决依赖关系 - 的 POM for ... 丢失

问题描述

我有两个包——一个叫 jhdf,另一个是 src。我的主要位于 src。但是我的 POM.XML 在我运行后一直给我错误mvn compileThe POM for jhdf is missing, no dependency information available

我很确定这就是我得到第二个错误的原因:Failed to execute goal on project test: Could not resolve dependencies for project edu.cs.test:0.3-SNAPSHOT: Could not find artifact edu.cs.jhdf:jhdf:jar:0.1-SNAPSHOT in osgeo (http://download.osgeo.org/webdav/geotools/)

这是我的 POM.XML 文件(如果您注意到我确实列出了我的 jhdf 依赖项):

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>edu.cs.test</groupId>
  <artifactId>test</artifactId>
  <version>0.3-SNAPSHOT</version>


  <repositories>

    <repository>
      <id>osgeo</id>
      <name>Open Source Geospatial Foundation Repository</name>
      <url>http://download.osgeo.org/webdav/geotools/</url>
    </repository>

  </repositories>

  <properties>
    <!--added new-->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <geotools.version>19-SNAPSHOT</geotools.version>

    <maven.compiler.source>1.6</maven.compiler.source>
    <maven.compiler.target>1.6</maven.compiler.target>
    <geotools.version>17.0</geotools.version>
    <hadoop.version>2.8.0</hadoop.version>
  </properties>


  <dependencies>

      <!--added new-->
    <!--<dependency>-->
      <!--<groupId>it.geosolutions.imageio-ext</groupId>-->
      <!--<artifactId>imageio-ext-jhdfaccess</artifactId>-->
      <!--<version>1.0.8</version>-->
    <!--</dependency>-->
    <!--<dependency>-->
        <!--<groupId>io.jhdf</groupId>-->
        <!--<artifactId>jhdf</artifactId>-->
        <!--<version>0.3.0</version>-->
    <!--</dependency>-->

    <dependency>
      <groupId>edu.cs.jhdf</groupId>
      <artifactId>jhdf</artifactId>
      <version>0.1-SNAPSHOT</version>
    </dependency>


    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-mapper-asl</artifactId>
      <version>1.9.13</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/org.geotools/gt-shapefile -->

    <dependency>
      <groupId>org.geotools</groupId>
      <artifactId>gt-shapefile</artifactId>
      <version>${geotools.version}</version>
    </dependency>

    <dependency>
      <groupId>org.geotools</groupId>
      <artifactId>gt-geotiff</artifactId>
      <version>${geotools.version}</version>
    </dependency>

    <dependency>
      <groupId>org.geotools</groupId>
      <artifactId>gt-image</artifactId>
      <version>${geotools.version}</version>
    </dependency>

    <dependency>
      <groupId>org.geotools</groupId>
      <artifactId>gt-epsg-hsql</artifactId>
      <version>${geotools.version}</version>
    </dependency>


    <!-- The following two artifacts are added to be able to read files directly from HDFS (in the future) -->
    <!-- https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-common -->
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <version>${hadoop.version}</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-hdfs -->
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-hdfs</artifactId>
      <version>${hadoop.version}</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/commons-cli/commons-cli -->
    <dependency>
      <groupId>commons-cli</groupId>
      <artifactId>commons-cli</artifactId>
      <version>1.4</version>
    </dependency>

    <dependency>
      <groupId>javax.media</groupId>
      <artifactId>jai_core</artifactId>
      <version>1.1.3</version>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
     </dependency>

  </dependencies>

</project>

我究竟做错了什么?我试图查看类似的问题,例如 [this] one - 但没有运气。任何事情都会有所帮助,谢谢!

标签: javapom.xml

解决方案


看起来您已经删除了https://repo1.maven.org/maven2/io/jhdf/jhdf/0.3.0的 maven 中央存储库中提供的依赖项“io.jhdf:jhdf:0.3.0” /

并将其替换为 osgeo 存储库中不可用的“edu.ucr.cs.jhdf:jhdf:jar:0.1-SNAPSHOT”,因此您正在寻找的工件尚未在那里发布。

我还注意到 osgeo 存储库没有 edu/ucr 路径,但确实有
http://download.osgeo.org/webdav/geotools/edu/ucar/

尝试像这样回到 Maven 中央工件

  <!--added new-->
<!--<dependency>-->
  <!--<groupId>it.geosolutions.imageio-ext</groupId>-->
  <!--<artifactId>imageio-ext-jhdfaccess</artifactId>-->
  <!--<version>1.0.8</version>-->
<!--</dependency>-->

<dependency>
    <groupId>io.jhdf</groupId>
    <artifactId>jhdf</artifactId>
    <version>0.3.0</version>
</dependency>

<!--
<dependency>
  <groupId>edu.ucr.cs.jhdf</groupId>
  <artifactId>jhdf</artifactId>
  <version>0.1-SNAPSHOT</version>
</dependency>
-->

推荐阅读