3
我已经在这里看到了答案,但它并没有完全适用:Gradle Not Resolving Maven Repo on localhost摇篮unnable解决archiva依赖
基本上,我有一个小小的gradle这个项目和相应的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'
}
当我运行
gradle dependencies
我得到以下输出:
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
如果我使用mavenCental(),它可以正常工作。相关的调试输出是这样的:
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: [[email protected], [email protected]15692, [email protected]]
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)
我不明白为什么gradle不能对抗archiva。在我们的网络中,链接op2-ivy1.hpd5.aus1.snapfish.com:40000/archiva/repository/snapfish/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.pom检索POM 。我究竟做错了什么?任何帮助,将不胜感激。
没错,就是它。我现在感觉很蠢。我看了看,看了看,发现了那一点。谢谢。 –