突然Maven无法解决版本依赖性 发布。
例如:-
<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>ads-lib</artifactId>
<version>RELEASE</version>
</dependency>
在Maven安装中,出现以下错误:-
Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to collect dependencies at com.google.api-ads:ads-lib:jar:RELEASE
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:291)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:316)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:172)
... 24 more
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for com.google.api-ads:ads-lib:jar:RELEASE
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:245)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:198)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.resolveCachedArtifactDescriptor(DefaultDependencyCollector.java:535)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.getArtifactDescriptorResult(DefaultDependencyCollector.java:519)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:409)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:351)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:254)
... 26 more
Caused by: org.eclipse.aether.resolution.VersionResolutionException: Failed to resolve version for com.google.api-ads:ads-lib:jar:RELEASE: Could not find metadata com.google.api-ads:ads-lib/maven-metadata.xml in local (C:\Users\ashwani.kumar\.m2\repository)
at org.apache.maven.repository.internal.DefaultVersionResolver.resolveVersion(DefaultVersionResolver.java:300)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:231)
... 33 more
Caused by: org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata com.google.api-ads:ads-lib/maven-metadata.xml in local (C:\Users\ashwani.kumar\.m2\repository)
at org.eclipse.aether.internal.impl.DefaultMetadataResolver.resolve(DefaultMetadataResolver.java:247)
at org.eclipse.aether.internal.impl.DefaultMetadataResolver.resolveMetadata(DefaultMetadataResolver.java:205)
at org.apache.maven.repository.internal.DefaultVersionResolver.resolveVersion(DefaultVersionResolver.java:237)
... 34 more
我也看不到依赖项https://mvnrepository.com/artifact/com.google.api-ads/ads-lib的任何RELEASE版本
在进一步的探索中,我发现了文章https://www.baeldung.com/maven-dependency-latest-version
据此:-
不赞成使用的语法
Maven2还提供了两个特殊的metaversion值来实现 结果:最新发布。
但是,这种传统的升级方法导致了不可预测性, CI需要可重复性。因此,它们已被弃用, 在Maven3中已完全删除:
为了可复制的版本,Maven 3.x不再支持 POM中这些元转换的用途
除了 Versions Maven插件以外,还有其他解决方案吗?