Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven站点插件或其中之一';无法解析的依赖项_Maven_Maven 3_Dependency Management_Nexus_Sonatype - Fatal编程技术网

Maven站点插件或其中之一';无法解析的依赖项

Maven站点插件或其中之一';无法解析的依赖项,maven,maven-3,dependency-management,nexus,sonatype,Maven,Maven 3,Dependency Management,Nexus,Sonatype,我在一个受限网络中,不允许访问从internet加载的文件,因此我们有一个本地Nexus服务器正在运行 白名单代理不是一个选项 我需要更新我们的公共java库存储库,我已经设法创建了一个将新工件上传到nexus的过程 使用允许连接到中心的settings.xml 使用声明了新依赖项的pom下载所有新工件 这会将所有jar/pom下载到~/.m2/repository。我有一个python脚本,它将存储库的内容复制到另一个临时目录,然后遍历该目录,并为遇到的每个jar/pom运行mvn deplo

我在一个受限网络中,不允许访问从internet加载的文件,因此我们有一个本地Nexus服务器正在运行

白名单代理不是一个选项

我需要更新我们的公共java库存储库,我已经设法创建了一个将新工件上传到nexus的过程

  • 使用允许连接到中心的settings.xml
  • 使用声明了新依赖项的pom下载所有新工件
  • 这会将所有jar/pom下载到
    ~/.m2/repository
    。我有一个python脚本,它将存储库的内容复制到另一个临时目录,然后遍历该目录,并为遇到的每个jar/pom运行
    mvn deploy:deploy file
  • 然后,我将settings.xml切换为只允许连接到nexus而不允许连接到central的设置
  • 理论上这听起来不错,但当我运行
    mvn dependency:resolve
    with the local settings.xml时,我得到了以下结果

    [INFO] Scanning for projects...
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom (4 KB at 23.2 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/22/maven-plugins-22.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/22/maven-plugins-22.pom (13 KB at 187.3 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/maven-parent/21/maven-parent-21.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/maven-parent/21/maven-parent-21.pom (26 KB at 357.5 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/apache/10/apache-10.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/apache/10/apache-10.pom (15 KB at 147.5 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar (25 KB at 325.1 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom (7 KB at 100.5 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/23/maven-plugins-23.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/23/maven-plugins-23.pom (9 KB at 149.7 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/maven-parent/22/maven-parent-22.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/maven-parent/22/maven-parent-22.pom (30 KB at 215.2 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/apache/11/apache-11.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/apache/11/apache-11.pom (15 KB at 278.2 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.jar
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.jar (27 KB at 355.7 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom (6 KB at 91.4 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.jar
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.jar (27 KB at 494.4 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-site-plugin/3.3/maven-site-plugin-3.3.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-site-plugin/3.3/maven-site-plugin-3.3.pom (21 KB at 312.7 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/24/maven-plugins-24.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-site-plugin:3.3: Plugin org.apache.maven.plugins:maven-site-plugin:3.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-site-plugin:jar:3.3
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.pom (5 KB at 81.1 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/12/maven-plugins-12.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/12/maven-plugins-12.pom (12 KB at 47.6 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/maven-parent/9/maven-parent-9.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/maven-parent/9/maven-parent-9.pom (33 KB at 305.4 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/apache/4/apache-4.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/apache/4/apache-4.pom (5 KB at 75.7 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.jar
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.jar (24 KB at 451.4 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.pom (15 KB at 185.0 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/16/maven-plugins-16.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/16/maven-plugins-16.pom (13 KB at 252.9 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/maven-parent/15/maven-parent-15.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/maven-parent/15/maven-parent-15.pom (24 KB at 366.3 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/apache/6/apache-6.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/apache/6/apache-6.pom (13 KB at 137.3 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.jar
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.jar (204 KB at 2193.2 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.pom (12 KB at 116.5 KB/sec)
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-dependency-plugin:2.8: Plugin org.apache.maven.plugins:maven-dependency-plugin:2.8 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.8
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-release-plugin/2.3.2/maven-release-plugin-2.3.2.pom
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-release-plugin/2.3.2/maven-release-plugin-2.3.2.pom (10 KB at 116.5 KB/sec)
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/release/maven-release/2.3.2/maven-release-2.3.2.pom
    [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-release-plugin:2.3.2: Plugin org.apache.maven.plugins:maven-release-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-release-plugin:jar:2.3.2
    Downloading: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-metadata.xml
    Downloading: http://localhost:8082/nexus/content/groups/public/org/codehaus/mojo/maven-metadata.xml
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/codehaus/mojo/maven-metadata.xml (834 B at 6.7 KB/sec)
    Downloaded: http://localhost:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-metadata.xml (3 KB at 20.5 KB/sec)
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3.776 s
    [INFO] Finished at: 2015-06-17T09:50:07+01:00
    [INFO] Final Memory: 11M/310M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Plugin org.apache.maven.plugins:maven-dependency-plugin:2.8 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.8: Failure to find org.apache.maven.plugins:maven-plugins:pom:24 in http://localhost:8082/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [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/PluginResolutionException
    
    它在解决许多maven插件的依赖关系时遇到了问题,我曾尝试查看插件POM并检查Nexus中是否存在依赖关系,但显然仍然缺少一些

    有没有一种简单的方法可以查看哪些依赖项无法解析

    这是我的settings.xml

    
    关系
    *
    http://localhost:8082/nexus/content/groups/public
    部署
    管理
    管理员123
    关系
    中心的
    http://central
    符合事实的
    符合事实的
    中心的
    http://central
    符合事实的
    符合事实的
    关系
    
    线索在原始消息中

    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    
    所以运行
    mvn dependency:resolve-X
    给了我更具体的细节

    编辑:它给出的更具体消息的示例

    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2.708 s
    [INFO] Finished at: 2015-06-18T11:15:26+01:00
    [INFO] Final Memory: 13M/310M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal on project mavenproject1: Could not resolve dependencies for project com.xxx:mavenproject1:pom:1.0-SNAPSHOT: Could not find artifact org.hamcrest:hamcrest-parent:jar:1.3 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project mavenproject1: Could not resolve dependencies for project com.xxx:mavenproject1:pom:1.0-SNAPSHOT: Could not find artifact org.hamcrest:hamcrest-parent:jar:1.3 in central (https://repo.maven.apache.org/maven2)
            at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221)
            at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)
            at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:257)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
            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:116)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
            at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.xxx:mavenproject1:pom:1.0-SNAPSHOT: Could not find artifact org.hamcrest:hamcrest-parent:jar:1.3 in central (https://repo.maven.apache.org/maven2)
            at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:211)
            at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195)
            ... 23 more
    Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact org.hamcrest:hamcrest-parent:jar:1.3 in central (https://repo.maven.apache.org/maven2)
            at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:384)
            at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:205)
            ... 24 more
    Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact org.hamcrest:hamcrest-parent:jar:1.3 in central (https://repo.maven.apache.org/maven2)
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
            at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:367)
            ... 25 more
    Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.hamcrest:hamcrest-parent:jar:1.3 in central (https://repo.maven.apache.org/maven2)
            at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:39)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
            at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
            ... 27 more
    [ERROR]
    [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
    

    您处于一个受限制的网络中,这并不罕见。但是您的nexus没有提供正确的文件以使构建工作正常…这意味着您的nexus必须能够从internet(Maven Central)下载这些文件。是的,nexus没有保存的文件是从可以访问internet的机器上下载的,然后将它们部署到NexusIt,很高兴您回答了自己的问题。不幸的是,这个答案对其他用户没有太大帮助,因为它不包含这些“特定细节”。“你介意添加它们吗?”Gilleb为你添加