gpt4 book ai didi

spring - gradle 在 mavenLocal 存储库中找不到 jar

转载 作者:行者123 更新时间:2023-12-03 03:36:58 25 4
gpt4 key购买 nike

我依赖 spring-beans;4.0.0.RELEASE,我使用它安装到我的 mavenLocal 缓存中
mvn install:install-file -Dfile=/Users/jric/Downloads/spring-beans-4.0.0.RELEASE.jar -DpomFile=/Users/jric/Downloads/spring-beans-4.0.0.RELEASE.pom ,

但是 gradle-1.11 没有找到依赖项,没有太多解释。我确实找到了这个看起来很相关的堆栈跟踪:

11:26:35.432 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver] Discarding resolve failure.
java.lang.NullPointerException
at org.gradle.api.internal.artifacts.repositories.resolver.MavenLocalResolver.isOrphanedPom(MavenLocalResolver.java:49)
at org.gradle.api.internal.artifacts.repositories.resolver.MavenLocalResolver.findMetaDataArtifact(MavenLocalResolver.java:42)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.resolveStaticDependency(ExternalResourceResolver.java:165)
at org.gradle.api.internal.artifacts.repositories.resolver.MavenResolver.getDependency(MavenResolver.java:83)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LocalModuleVersionRepository.getLocalDependency(LocalModuleVersionRepository.java:44)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.memcache.CachedRepository.getLocalDependency(CachedRepository.java:67)

以下是一些更可能相关的数据:
SCML-JRichardson:share jric$ ls /Users/jric/.m2/repository/org/springframework/spring-beans/
4.0.0.RELEASE maven-metadata-local.xml
SCML-JRichardson:share jric$ cat /Users/jric/.m2/repository/org/springframework/spring-beans/maven-metadata-local.xml
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<versioning>
<release>4.0.0.RELEASE</release>
<versions>
<version>4.0.0.RELEASE</version>
</versions>
<lastUpdated>20150307021047</lastUpdated>
</versioning>
</metadata>
SCML-JRichardson:share jric$ ls /Users/jric/.m2/repository/org/springframework/spring-beans/4.0.0.RELEASE/
_maven.repositories spring-beans-4.0.0.RELEASE.jar spring-beans-4.0.0.RELEASE.pom

最佳答案

Gradle 有一个特殊的语句可以在本地 Maven 存储库中查找:mavenLocal()。确保在全局存储库部分调用它:

repositories {
mavenLocal() // <- Here
mavenCentral()
}

如果它不起作用,请确保您没有在 buildscript 部分无意中添加它。这会将依赖项添加到您的构建环境而不是您的代码,这通常不是您想要的。
buildscript {            // <- Probably not what you mean
repositories {
mavenLocal()
mavenCentral()
}
}

关于spring - gradle 在 mavenLocal 存储库中找不到 jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28910925/

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