27

I get an error downloading javax.media.jai_core:1.1.3 from maven central.

The error is:

download failed: javax.media#jai_core;1.1.3!jai_core.jar

using play compiler.

gavioto
  • 1,695
  • 2
  • 17
  • 38

4 Answers4

33

The problem at this moment is that maven-central doesn't have the .jar, which is a dependency from geotoolkit

Sample of maven repo content

If you need it, you could use the next public repositories:

https://maven.geotoolkit.org (jai-core is here)

https://repo.osgeo.org/repository/release/

Make sure geotoolkit-repo is before Maven Central, so that it resolves before Central which misses the jar.

arve0
  • 3,424
  • 26
  • 33
gavioto
  • 1,695
  • 2
  • 17
  • 38
  • 1
    I have tried both, but it is not working, it's trying to download a wrong url http://maven.geotoolkit.org/javax/media/jai/com.springsource.javax.media.jai.core/1.1.3/com.springsource.javax.media.jai.core-1.1.3.pom – bachr Jan 13 '20 at 23:36
  • "Make sure geotoolkit-repo is before Maven Central, so that it resolves before Central which misses the jar." Why??? When a jar isn't found in one repo, couldn't it simply look in the next one? What if geotoolkit-repo misses a jar which is in Maven Central? – Eric Duminil Jul 12 '23 at 14:41
8

For Gradle users:

    mavenCentral().content {
        excludeModule("javax.media", "jai_core")
    }
elect
  • 6,765
  • 10
  • 53
  • 119
6

And move the http://download.osgeo.org/webdav/geotools repo to the first position in your repo list. Otherwise it will probably still give you that error.

user1712200
  • 329
  • 5
  • 8
  • Why is this necessary? – Harold L. Brown Jul 19 '19 at 13:44
  • 3
    It's necessary to have Geotools-repo first as Maven Central includes the dependency, but not the .jar. Therefore it is "resolved" in Central, but actually not found. Central, pom but no jar: https://repo1.maven.org/maven2/javax/media/jai_core/1.1.3/ Geotools, pom and jar: https://repo.osgeo.org/#browse/browse:geotools-releases:javax%2Fmedia%2Fjai_core%2F1.1.3 – arve0 Aug 05 '20 at 08:56
3

I was having a similar problem, trying to add icepdf to my pom for a project. What worked for me was adding this exclusion inside de dependency tag:

<exclusions>
    <exclusion>
        <groupId>javax.media</groupId>
        <artifactId>jai-core</artifactId>
    </exclusion>
</exclusions>

Here is the link to the answer that helped me, hoping it helps some other people having this same issue:

https://stackoverflow.com/a/48248739/10428307

A. Baena
  • 121
  • 5
  • 2
    If your project doesn't need jai-core it can work. What you should take into account that excluding a dependency from your project could result in some runtime errors depending of the functionality you are using. – gavioto Apr 05 '20 at 14:10