gpt4 book ai didi

maven - Gradle 无法解析存档依赖项

转载 作者:行者123 更新时间:2023-12-03 10:45:40 26 4
gpt4 key购买 nike

我看过这里的答案,但不太适用:Gradle Not Resolving Maven Repo on localhost

基本上,我有一个简单的 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: [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)

我不明白为什么 gradle 对存档不起作用。在我们的网络中,链接 op2-ivy1.hpd5.aus1.snapfish.com:40000/archiva/repository/snapfish/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.pom 检索 POM .我究竟做错了什么?任何帮助,将不胜感激。

最佳答案

尝试在您的 URL 开头添加 http://:

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

关于maven - Gradle 无法解析存档依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12788581/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com