JAI depedency download

Hi all I am trying to use geotools, and download the dependency via maven repository.

The problem is that for licensing issue, a few jars cannot be distributed.

javax.media:jai_core:1.1.3, javax.media:jai_codec:1.1.3, javax.media:jai-imageio:1.1

So usually in maven you have to download it manually.

How do you do that in gradle? I put the ‘’‘jai_core.jar’’’ in the cache of gradle, but i still have:

Artifact 'javax.media:jai_core:1.1.3@jar' not found.

Any hint welcome

Hello, putting jars manually into the gradle cache is not recommended, as it is an internal structure. You could put the manual downloaded jars into a folder and use a flatdir repository as described in the userguide at

http://gradle.org/docs/current/userguide/userguide_single.html#flatDirMulti If you’re already using a repository manager like artifactory or nexus, you can put the downloaded jars to this repository manager manually and resolve it from there in your buildscripts.

cheers, René

Hi Rene,

Thanks for the answer, yes i already made a ‘lib’ dir where i put the jars, but still have an error. Personally i don’t understand how gradle can say “oh yes that jai_core.jar is the one missing in the maven dependency” or maybe i miss something

To help debugging i have narrowed down the script that does not work:

apply plugin: 'java'
  repositories {
    flatDir {
        dir 'lib'
    }
    mavenCentral()
    maven {
        url 'http://download.osgeo.org/webdav/geotools/'
    }
}
  dependencies {
    compile group: 'org.geotools', name: 'gt-image', version: '8.0-RC2'
}

If you launch a build task you will get the error

Hi again, it expects the missing library named jai_core-1.1.3.jar in the lib folder. The pattern for the libraries resolved from a flatDir repository are described in the JavaDoc of FlatDirectoryArtifactRepository at http://gradle.org/docs/current/javadoc/org/gradle/api/artifacts/repositories/FlatDirectoryArtifactRepository.html

hope that helps!

Thanks a lot again some interesting reading. However no luck still the same error. Did you try my gradle script?

Yeah I tried your script. what error do you get now? you can run the build with -d to get detailed information about the paths gradle looks up when resolving from a local directory.

here is the stacktrace. It sounds that it does not event try to check the lib/ folder

16:34:51.667 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain] Attempting to download javax.media#jai_core;1.1.3!jai_core.jar using repository 'MavenRepo'
16:34:51.669 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on artifact cache (/home/ubuntu/.gradle/caches/artifacts-13).
16:34:51.670 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
16:34:51.672 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache artifact-at-repository.bin (/home/ubuntu/.gradle/caches/artifacts-13/artifact-at-repository.bin)
16:34:51.685 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleVersionRepository] Detected non-existence of artifact 'javax.media#jai_core;1.1.3!jai_core.jar' in resolver cache
16:34:51.690 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache artifact-at-repository.bin (/home/ubuntu/.gradle/caches/artifacts-13/artifact-at-repository.bin)
16:34:51.698 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on artifact cache (/home/ubuntu/.gradle/caches/artifacts-13).
16:34:51.700 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':compileJava'
16:34:51.719 [ERROR] [org.gradle.BuildExceptionReporter]
 16:34:51.729 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
16:34:51.734 [ERROR] [org.gradle.BuildExceptionReporter]
 16:34:51.734 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
16:34:51.735 [ERROR] [org.gradle.BuildExceptionReporter] Could not resolve all dependencies for configuration ':compile'.
16:34:51.737 [ERROR] [org.gradle.BuildExceptionReporter] > Artifact 'javax.media:jai_core:1.1.3@jar' not found.
16:34:51.742 [ERROR] [org.gradle.BuildExceptionReporter]
 16:34:51.744 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
16:34:51.747 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compile'.
16:34:51.749 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.wrapException(ErrorHandlingArtifactDependencyResolver.java:47)
16:34:51.753 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.access$000(ErrorHandlingArtifactDependencyResolver.java:26)
16:34:51.754 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration.getFiles(ErrorHandlingArtifactDependencyResolver.java:80)
16:34:51.755 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:460)
16:34:51.755 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:203)
16:34:51.755 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
16:34:51.756 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileTreeConverter.convertInto(DefaultFileCollectionResolveContext.java:191)
16:34:51.758 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:103)
16:34:51.768 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:75)
16:34:51.769 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileTreeConverter.convertInto(DefaultFileCollectionResolveContext.java:182)
16:34:51.770 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:98)
16:34:51.771 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:75)
16:34:51.772 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.file.CompositeFileCollection$1.resolve(CompositeFileCollection.java:88)
16:34:51.772 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.file.CompositeFileCollection.getSourceCollections(CompositeFileCollection.java:143)
16:34:51.773 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.file.CompositeFileTree.getSourceCollections(CompositeFileTree.java:30)
16:34:51.774 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.file.CompositeFileCollection.getFiles(CompositeFileCollection.java:38)
16:34:51.774 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:60)
16:34:51.775 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.changedetection.DefaultFileSnapshotter.snapshot(DefaultFileSnapshotter.java:42)
16:34:51.775 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.changedetection.InputFilesChangedUpToDateRule.create(InputFilesChangedUpToDateRule.java:35)
16:34:51.775 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.changedetection.CompositeUpToDateRule.create(CompositeUpToDateRule.java:35)
16:34:51.775 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.calcCurrentState(DefaultTaskArtifactStateRepository.java:80)
16:34:51.775 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.isUpToDate(DefaultTaskArtifactStateRepository.java:88)
16:34:51.776 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepository.java:128)
16:34:51.776 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.changedetection.ShortCircuitTaskArtifactStateRepository$ShortCircuitArtifactState.isUpToDate(ShortCircuitTaskArtifactStateRepository.java:77)
16:34:51.776 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.changedetection.FileCacheBroadcastTaskArtifactStateRepository$1.isUpToDate(FileCacheBroadcastTaskArtifactStateRepository.java:37)
16:34:51.776 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:44)
16:34:51.776 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
16:34:51.777 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
16:34:51.783 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
16:34:51.783 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
16:34:51.784 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
16:34:51.784 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)
16:34:51.784 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
16:34:51.784 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
16:34:51.784 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
16:34:51.785 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
16:34:51.785 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
16:34:51.786 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
16:34:51.786 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
16:34:51.786 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
16:34:51.787 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)
16:34:51.787 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
16:34:51.793 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)
16:34:51.793 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:103)
16:34:51.794 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
16:34:51.794 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
16:34:51.794 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
16:34:51.794 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
16:34:51.794 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
16:34:51.795 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
16:34:51.795 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
16:34:51.795 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
16:34:51.795 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)
16:34:51.822 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)
16:34:51.822 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)
16:34:51.822 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
16:34:51.823 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
16:34:51.823 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
16:34:51.823 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
16:34:51.823 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
16:34:51.823 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
16:34:51.823 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:31)
16:34:51.823 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:20)
16:34:51.824 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.Main.doAction(Main.java:48)
16:34:51.824 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:45)
16:34:51.827 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.Main.main(Main.java:39)
16:34:51.828 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
16:34:51.829 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:32)
16:34:51.829 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
16:34:51.829 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ArtifactNotFoundException: Artifact 'javax.media:jai_core:1.1.3@jar' not found.
16:34:51.829 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain$ModuleVersionRepositoryBackedArtifactResolver.resolve(UserResolverChain.java:168)
16:34:51.829 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver$ErrorHandlingArtifactResolver.resolve(LazyDependencyToModuleResolver.java:59)
16:34:51.830 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.ResolvedArtifactFactory$1$1.create(ResolvedArtifactFactory.java:39)
16:34:51.830 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.ResolvedArtifactFactory$1$1.create(ResolvedArtifactFactory.java:37)
16:34:51.830 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
16:34:51.831 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:99)
16:34:51.831 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:49)
16:34:51.831 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.ResolvedArtifactFactory$1.get(ResolvedArtifactFactory.java:37)
16:34:51.831 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.DefaultResolvedArtifact.getFile(DefaultResolvedArtifact.java:107)
16:34:51.831 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactFileResolver.getFile(DefaultLenientConfiguration.java:137)
16:34:51.832 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.getFiles(DefaultLenientConfiguration.java:115)
16:34:51.832 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.getFilesStrict(DefaultLenientConfiguration.java:98)
16:34:51.832 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.DefaultResolvedConfiguration.getFiles(DefaultResolvedConfiguration.java:45)
16:34:51.833 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver$1.getFiles(SelfResolvingDependencyResolver.java:56)
16:34:51.834 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration.getFiles(ErrorHandlingArtifactDependencyResolver.java:78)
16:34:51.834 [ERROR] [org.gradle.BuildExceptionReporter]
... 66 more
16:34:51.839 [ERROR] [org.gradle.BuildExceptionReporter]
 16:34:51.845 [LIFECYCLE] [org.gradle.BuildResultLogger]
 16:34:51.845 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
16:34:51.846 [LIFECYCLE] [org.gradle.BuildResultLogger]
 16:34:51.846 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 7.338 secs
16:34:51.849 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache outputFileStates.bin (/home/ubuntu/git/VSat/.gradle/1.0/taskArtifacts/outputFileStates.bin)
16:34:51.854 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache taskArtifacts.bin (/home/ubuntu/git/VSat/.gradle/1.0/taskArtifacts/taskArtifacts.bin)
16:34:51.854 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on task artifact state cache (/home/ubuntu/git/VSat/.gradle/1.0/taskArtifacts).
16:34:51.854 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on no_buildscript class cache for build file '/home/ubuntu/git/VSat/build.gradle' (/home/ubuntu/.gradle/caches/1.0/scripts/build_2e3cogk45so68vtft4nksprh32/ProjectScript/no_buildscript).
16:34:51.854 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on buildscript class cache for build file '/home/ubuntu/git/VSat/build.gradle' (/home/ubuntu/.gradle/caches/1.0/scripts/build_2e3cogk45so68vtft4nksprh32/ProjectScript/buildscript).
16:34:51.873 [DEBUG] [org.gradle.logging.internal.DefaultLoggingConfigurer] Finished configuring with level: DEBUG, configurers: [org.gradle.logging.internal.OutputEventRenderer@1cb25f1, org.gradle.logging.internal.slf4j.Slf4jLoggingConfigurer@2808b3, org.gradle.logging.internal.JavaUtilLoggingConfigurer@535b58]

Hmm strange. For testing, I put to files in my lib folder relative to the build script you provided: - gt-api.jar - jai_core-1.1.3.jar

When I run this script with the both libs in the lib folder I get the following error:

> gradle clean build
  FAILURE: Build failed with an exception.
  * What went wrong:
Could not resolve all dependencies for configuration ':testRuntime'.
> Could not find group:com.vividsolutions, module:jts, version:1.12.
  Required by:
      :flatlib:unspecified > org.geotools:gt-image:8.0-RC2 > org.geotools:gt-main:8.0-RC2
      :flatlib:unspecified > org.geotools:gt-image:8.0-RC2 > org.geotools:gt-coverage:8.0-RC2
      :flatlib:unspecified > org.geotools:gt-image:8.0-RC2 > org.geotools:gt-main:8.0-RC2 > org.geotools:gt-api:8.0-RC2
> Could not find group:org.jaitools, module:jt-zonalstats, version:1.2.0.
  Required by:
      :flatlib:unspecified > org.geotools:gt-image:8.0-RC2 > org.geotools:gt-coverage:8.0-RC2
> Could not find group:org.jaitools, module:jt-utils, version:1.2.0.
  Required by:
      :flatlib:unspecified > org.geotools:gt-image:8.0-RC2 > org.geotools:gt-coverage:8.0-RC2
> Could not find group:commons-pool, module:commons-pool, version:1.5.4.
  Required by:
      :flatlib:unspecified > org.geotools:gt-image:8.0-RC2 > org.geotools:gt-coverage:8.0-RC2 > org.geotools:gt-referencing:8.0-RC2
      :flatlib:unspecified > org.geotools:gt-image:8.0-RC2 > org.geotools:gt-coverage:8.0-RC2 > org.geotools:gt-referencing:8.0-RC2 > org.geotools:gt-metadata:8.0-RC2 > org.geotools:gt-opengis:8.0-RC2
> Could not find group:net.java.dev.jsr-275, module:jsr-275, version:1.0-beta-2.
  Required by:
      :flatlib:unspecified > org.geotools:gt-image:8.0-RC2 > org.geotools:gt-coverage:8.0-RC2 > org.geotools:gt-referencing:8.0-RC2 > org.geotools:gt-metadata:8.0-RC2 > org.geotools:gt-opengis:8.0-RC2

BTW. Which gradle version are you using?

last and greatest version 1.0.

yes there are many dependencies and subdependencies… jai_core.jar is one of them, but cannot be distributed. This is a known issue already for maven: http://sahits.ch/blog/?p=1038

as mentioned, putting all those jars with the pattern mentioned above to the lib folder should work for you. could you run your build above with the -d command line option and post the output ?

i have exactly the same error as the one i put previously

For your error, are you sure you put http://download.osgeo.org/webdav/geotools/ as a maven repo?

ok with the following script i can’t make it running (ie “Artifact ‘javax.media:jai_core:1.1.3@jar’ not found”), even if ‘jai_core-1.1.3.jar’ is in lib/

However when i remove mavenCentral(), this works. It seems that when not found in maven (actually there is a pom, but no jar in the maven repo), it does not look into flatDir afterwards.

i think this is a bug somehow. Should i raise one in JIRA?

apply plugin: 'java'
  repositories {
    flatDir {
        dir 'lib'
    }
    mavenCentral()
}
dependencies {
    compile group: 'javax.media', name: 'jai_core', version: '1.1.3'
}

I raised a new issue, i think i narrowed down enough the problem for this.

GRADLE-2395

Gradle has special support for searching for POM and artifact in different Maven repositories. See Adding additional Maven repositories for JAR files in the Gradle user guide. However, I don’t think that mixing Maven and flatDir repositories is supported in this scenario. What you could do is keep the missing Jars in a Maven repository on the local disk (‘artifactUrls “file:///…”’). Or even better, use a repository manager like Artifactory or Nexus, which will solve such tasks with ease.

yes, having artifactory or nexus locally would help, but i don’t think everyone want to install one

on the GRADLE-2395 ticket i have found a workaround: put this repository BEFORE mavenCentral()

maven {
    url 'http://download.osgeo.org/webdav/geotools/'
}

This repo contains actually the jai_core.jar (against the license?)

that fixes for JAI case, but not for the general case (ie existing POM, but no jar)

yes, having artifactory or nexus locally would help, but i don’t think everyone want to install one

In that case, you can always use a file-based Maven repository.

Still agree, but i still do think that a small logic inside gradle (if there is a pom but no jar -> don’t raise error maybe i’ll find the jar in another repository) could make this a no brainerfor gradle, even if you add a switch (strictResolution=true or something like that) to toggle the behaviour.