Julio Garcia
Julio Garcia

Reputation: 1117

Gradle unnable to resolve archiva dependencies

I have looked at the answer here, but it did not quite apply: Gradle Not Resolving Maven Repo on localhost

basically, I have a trivial gradle project and corresponding build.gradle:

apply plugin: 'maven'
apply plugin: 'java'

repositories {
  mavenRepo (
    name: 'Snapfish Repo',
    url: 'op2-ivy1.hpd5.aus1.snapfish.com:40000/archiva/repository/snapfish/'
  )
  // mavenCentral()
}

dependencies {
  compile group:'org.slf4j', name: 'slf4j-api', version: '1.6.6'
}

when I run

gradle dependencies

I get the following output:

compile - Classpath for compiling the main sources.
No dependencies
:dependencies FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':dependencies'.
> Could not resolve all dependencies for configuration ':compile'.
   > Could not resolve group:org.slf4j, module:slf4j-api, version:1.6.6.
     Required by:
         :junk:unspecified
      > Target host must not be null, or set in parameters.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

If I use mavenCental(), it works correctly. The relevant debug output is this:

13:52:35.494 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache dynamic-revisions.bin (/home/julio/.gradle/caches/artifacts-14/dynamic-revisions.bin)
13:52:35.498 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache module-metadata.bin (/home/julio/.gradle/caches/artifacts-14/module-metadata.bin)
13:52:35.502 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-metadata.bin (/home/julio/.gradle/caches/artifacts-14/module-metadata.bin)
13:52:35.502 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache dynamic-revisions.bin (/home/julio/.gradle/caches/artifacts-14/dynamic-revisions.bin)
13:52:35.503 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on artifact cache (/home/julio/.gradle/caches/artifacts-14).
13:52:35.505 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.IvyLoggingAdaper] Snapfish Repo: no namespace defined: using system
13:52:35.510 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.IvyLoggingAdaper]                tried op2-ivy1.hpd5.aus1.snapfish.com:40000/archiva/repository/snapfish/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.pom
13:52:35.511 [DEBUG] [org.gradle.api.internal.artifacts.repositories.ExternalResourceResolver] Loading op2-ivy1.hpd5.aus1.snapfish.com:40000/archiva/repository/snapfish/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.pom
13:52:35.514 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on artifact cache (/home/julio/.gradle/caches/artifacts-14).
13:52:35.515 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
13:52:35.516 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache artifact-at-url.bin (/home/julio/.gradle/caches/artifacts-14/artifact-at-url.bin)
13:52:35.517 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache artifact-at-url.bin (/home/julio/.gradle/caches/artifacts-14/artifact-at-url.bin)
13:52:35.517 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on artifact cache (/home/julio/.gradle/caches/artifacts-14).
13:52:35.518 [DEBUG] [org.gradle.api.internal.externalresource.transfer.DefaultCacheAwareExternalResourceAccessor] Constructing external resource: op2-ivy1.hpd5.aus1.snapfish.com:40000/archiva/repository/snapfish/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.pom
13:52:35.579 [INFO] [org.gradle.api.internal.file.collections.DirectoryFileTree] file or directory '/home/julio/.gradle/caches/artifacts-14/filestore', not found
13:52:35.581 [DEBUG] [org.gradle.api.internal.externalresource.transport.http.HttpResourceAccessor] Constructing external resource: op2-ivy1.hpd5.aus1.snapfish.com:40000/archiva/repository/snapfish/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.pom
13:52:35.583 [DEBUG] [org.gradle.api.internal.externalresource.transport.http.HttpClientHelper] Performing HTTP GET: op2-ivy1.hpd5.aus1.snapfish.com:40000/archiva/repository/snapfish/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.pom
13:52:35.719 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Attaching #junk;unspecified(compile) to its parents.
13:52:35.726 [QUIET] [org.gradle.api.tasks.diagnostics.DependencyReportTask_Decorated] No dependencies
13:52:35.727 [DEBUG] [org.gradle.logging.internal.DefaultLoggingConfigurer] Finished configuring with level: DEBUG, configurers: [org.gradle.logging.internal.OutputEventRenderer@303020ad, org.gradle.logging.internal.logback.LogbackLoggingConfigurer@27b15692, org.gradle.logging.internal.JavaUtilLoggingConfigurer@6baa9f99]
13:52:35.728 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':dependencies'
13:52:35.728 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :dependencies FAILED
13:52:35.735 [ERROR] [org.gradle.BuildExceptionReporter]
13:52:35.736 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
13:52:35.737 [ERROR] [org.gradle.BuildExceptionReporter]
13:52:35.737 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
13:52:35.738 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':dependencies'.
13:52:35.738 [ERROR] [org.gradle.BuildExceptionReporter] > Could not resolve all dependencies for configuration ':compile'.
13:52:35.739 [ERROR] [org.gradle.BuildExceptionReporter]    > Could not resolve group:org.slf4j, module:slf4j-api, version:1.6.6.
13:52:35.740 [ERROR] [org.gradle.BuildExceptionReporter]      Required by:
13:52:35.740 [ERROR] [org.gradle.BuildExceptionReporter]          :junk:unspecified
13:52:35.741 [ERROR] [org.gradle.BuildExceptionReporter]       > Target host must not be null, or set in parameters.
13:52:35.744 [ERROR] [org.gradle.BuildExceptionReporter]
13:52:35.744 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
13:52:35.746 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':dependencies'.
13:52:35.746 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68)
13:52:35.747 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)

I cannot see why gradle does not work against archiva. In our network, the link op2-ivy1.hpd5.aus1.snapfish.com:40000/archiva/repository/snapfish/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.pom retrieves the POM. What am I doing wrong? Any help would be appreciated.

Upvotes: 3

Views: 2933

Answers (1)

David Levesque
David Levesque

Reputation: 22441

Try adding http:// at the beginning of your URL:

url: 'http://op2-ivy1.hpd5.aus1.snapfish.com:40000/archiva/repository/snapfish/'

Upvotes: 4

Related Questions