现有工件的 Maven 解析失败

Posted

技术标签:

【中文标题】现有工件的 Maven 解析失败【英文标题】:Maven resolution for existing artifact fails 【发布时间】:2016-05-06 23:59:10 【问题描述】:

我有依赖

<dependency>
  <groupId>org.jboss</groupId>
  <artifactId>jboss-serialization</artifactId>
  <version>1.0.4.Final</version>
</dependency>

( 版本字符串错误,我在这里发布了正确的字符串。我已经用 wrong 版本更新了帖子,我正在添加一个带有解释的答案。)

这是一个包含有关工件信息的链接: https://mvnrepository.com/artifact/org.jboss/jboss-serialization/1.0.4.FINAL

我在 Archiva 中设置了存储库,但是当解析失败时,我将存储库添加到 pom 以进行测试:

  <repository>
    <id>jboss-releases</id>
    <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
  </repository>

我仍然收到错误“无法解决依赖关系...”。 AFAIK 我已经从这个 repo 下载了其他工件,我可以用我的浏览器下载 jar/pom。什么给了??

堆栈跟踪:

[INFO] ------------------------------------------------------------------------
[INFO] Building project3 EJB module 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repository.jboss.org/nexus/content/repositories/releases/org/jboss/jboss-serialization/1.0.4.Final/jboss-serialization-1.0.4.Final.pom
Downloading: http://svn.redacted.xyz:8080/repository/internal/org/jboss/jboss-serialization/1.0.4.Final/jboss-serialization-1.0.4.Final.pom
Downloading: http://repo.maven.apache.org/maven2/org/jboss/jboss-serialization/1.0.4.Final/jboss-serialization-1.0.4.Final.pom
[WARNING] The POM for org.jboss:jboss-serialization:jar:1.0.4.Final is missing, no dependency information available
Downloading: http://repository.jboss.org/nexus/content/repositories/releases/org/jboss/jboss-serialization/1.0.4.Final/jboss-serialization-1.0.4.Final.jar
Downloading: http://svn.redacted.xyz:8080/repository/internal/org/jboss/jboss-serialization/1.0.4.Final/jboss-serialization-1.0.4.Final.jar
Downloading: http://repo.maven.apache.org/maven2/org/jboss/jboss-serialization/1.0.4.Final/jboss-serialization-1.0.4.Final.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] project3 EJB module ................................. FAILURE [8.361s]
[INFO] project3 Web module ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.063s
[INFO] Finished at: Fri Jan 29 12:02:09 CET 2016
[INFO] Final Memory: 14M/225M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project project3-ejb: Could not resolve dependencies for project xyz.redacted:project3-ejb:ejb:1.0-SNAPSHOT: Could not find artifact org.jboss:jboss-serialization:jar:1.0.4.Final in jboss-releases (http://repository.jboss.org/nexus/content/repositories/releases/) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project project3-ejb: Could not resolve dependencies for project xyz.redacted:project3-ejb:ejb:1.0-SNAPSHOT: Could not find artifact org.jboss:jboss-serialization:jar:1.0.4.Final in jboss-releases (http://repository.jboss.org/nexus/content/repositories/releases/)
        at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:210)
        at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:117)
        at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:258)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:201)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project xyz.redacted:project3-ejb:ejb:1.0-SNAPSHOT: Could not find artifact org.jboss:jboss-serialization:jar:1.0.4.Final in jboss-releases (http://repository.jboss.org/nexus/content/repositories/releases/)
        at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:189)
        at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:185)
        ... 22 more
Caused by: org.sonatype.aether.resolution.DependencyResolutionException: Could not find artifact org.jboss:jboss-serialization:jar:1.0.4.Final in jboss-releases (http://repository.jboss.org/nexus/content/repositories/releases/)
        at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:375)
        at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:183)
        ... 23 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not find artifact org.jboss:jboss-serialization:jar:1.0.4.Final in jboss-releases (http://repository.jboss.org/nexus/content/repositories/releases/)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
        at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:358)
        ... 24 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact org.jboss:jboss-serialization:jar:1.0.4.Final in jboss-releases (http://repository.jboss.org/nexus/content/repositories/releases/)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:947)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
        at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

【问题讨论】:

包含错误的完整堆栈跟踪通常是个好主意。在这种情况下将包括unable to find valid certification path to requested target 【参考方案1】:

这是由于自签名证书导致的 ssl 错误。一种选择是在您的存储库 url 中使用 http 而不是 https

如果您想使用 https,这可能会对您有所帮助:Problems using Maven and SSL behind proxy

【讨论】:

嗯,尝试将其仅更改为“http”。还是不行 也许这个有帮助:***.com/questions/12517129/…【参考方案2】:

哎呀!我犯了一个愚蠢的错误。

我发布了从链接页面复制的依赖项部分。但是我的父 POM 中有另一个版本标签!是 1.0.4-Final,但版本区分大小写,应该是 1.0.4-FINAL

现在可以了。我的错!

【讨论】:

考虑关闭问题,因为它是由拼写错误引起的。

以上是关于现有工件的 Maven 解析失败的主要内容,如果未能解决你的问题,请参考以下文章

如果某个工件已经存在,如何使 Maven 构建失败

Maven 发布插件失败:源工件被部署两次

Gradle 同步失败:无法解析所有工件以进行配置

android-jetifier: "无法解析所有工件";新项目上的“改造工件失败”

任务 ':app:lintVitalRelease' 执行失败。 > 无法解析配置 ':app:debugRuntimeClasspath' 的所有工件

bug记录----Maven项目发布失败