Search code examples
eclipsemavenbintrayjcenter

eclipse 2018-09 maven can't find dependency but it exists everywhere


I'm using an older version of eclipse 2018-09 with 32-bit Java, not sure that makes a difference. (project limitation for using these older versions)

I have been using the default maven plugin with the project and it all has worked so far, except for the following one:

<!-- https://mvnrepository.com/artifact/com.github.kilianB/JImageHash -->
<dependency>
    <groupId>com.github.kilianB</groupId>
    <artifactId>JImageHash</artifactId>
    <version>3.0.0</version>
</dependency>

https://mvnrepository.com/artifact/com.github.kilianB/JImageHash/3.0.0

I get: Missing artifact com.github.kilianB:JImageHash:jar:3.0.0

I have done all the maven things, clean, install, etc...

This jar is located at "JCenter repository (https://jcenter.bintray.com/)".

And the url and files are all there. https://bintray.com/kilianb/maven/JImageHash/3.0.0#files/com%2Fgithub%2FkilianB%2FJImageHash%2F3.0.0

I even downloaded the files and jars.

I have no settings.xml in my .m2, as I'm using the default eclipse maven. The pom.xml is the default one and I added the dependencies I have needed.

What's missing?

Thanks in advance.

FWIW here's my pom I'm using

<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>patmangames</groupId>
  <artifactId>carddetect</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resource>
        <directory>resources</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>

    <!-- https://mvnrepository.com/artifact/net.sourceforge.tess4j/tess4j -->
    <dependency>
        <groupId>net.sourceforge.tess4j</groupId>
        <artifactId>tess4j</artifactId>
        <version>4.5.1</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
    <dependency>
        <groupId>org.jsoup</groupId>
        <artifactId>jsoup</artifactId>
        <version>1.13.1</version>
    </dependency>

    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1.1</version>
    </dependency>

    <dependency>
      <groupId>org.openpnp</groupId>
      <artifactId>opencv</artifactId>
      <version>4.3.0-1</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.11.0</version>
    </dependency>


    <!-- FAILS TO FIND AND DOWNLOAD-->
    <dependency>
      <groupId>com.github.kilianB</groupId>
      <artifactId>JImageHash</artifactId>
      <version>3.0.0</version>
    </dependency>
    <!-- FAILS TO FIND AND DOWNLOAD-->

  </dependencies>  

</project>

Solution

  • Without a settings.xml you only get jars from MavenCentral.

    Note that MavenCentral has nothing to do with mvnrepository. Finding a jar on mvnrepository does not mean that it is in MavenCentral.

    Indeed, in your case, the jar is in jcenter, so you need to write a settings.xml where you add that repository as <repository>.