【问题标题】:Nexus repository contains artifact but only makes POM availableNexus 存储库包含工件,但仅使 POM 可用
【发布时间】:2011-03-12 12:12:29
【问题描述】:

我有一个 Nexus 实例,其 Maven 2 存储库托管在未连接 Internet 的公司开发域上。我需要使用 Sun 的 ma​​ven-jaxb-schemagen 插件,但是,它只能以 Maven 1 格式提供(以及许多其他 Maven 1 依赖项,所以这不是一次性的极端情况)。

我在 Nexus (ma​​ven1) 中创建了一个新的 Maven 1 托管存储库,然后也创建了一个 Maven1 到 Maven2 的虚拟存储库 (ma​​ven1as2)。因为一些所需的工件是快照,所以 ma​​ven1(以及扩展名为 ma​​ven1as2)的策略是 Snapshot

我通过文件系统将所有 Maven 1 工件导入到此存储库的覆盖本地存储位置。

然后我将 ma​​ven1as2 添加到我的 Public Repositories 组。我发现的一些参考资料说 Nexus 不允许您浏览或搜索 Maven1 存储库。我的结果好坏参半。如果我在 Nexus 中选择 Public Repositoriesma​​ven1as2,我可以转到 Browse Storage 并深入到 com/sun/tools/ jxc/maven2/maven-jaxb-schemagen-plugin/1.3-SNAPSHOT/ 并查看 ma​​ven-jaxb-schemagen-plugin-1.3-SNAPSHOT.pom 文件及其校验和。但是,我无法查看应该存在并位于文件系统上的 JAR 工件。

当我尝试使用 Maven 构建时,我得到以下信息:

$ mvn clean compile
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO]   MyProject
[INFO]   MyModule1
[INFO]   MyModule2
         ...
[INFO] ---------------------------------------------------------------------------
[INFO] Building MyProject
[INFO]    task-segment: [clean, compile]
[INFO] ---------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] [cobertura:clean {execution: default}]
[INFO] No goals needed for project - skipping
[INFO] ---------------------------------------------------------------------------
[INFO] Building MyModule1
[INFO]    task-segment: [clean, compile]
[INFO] ---------------------------------------------------------------------------
Downloading: http://my.nexus.server:8081/nexus/content/groups/public/com/sun/tools/jxc/maven2/maven-jaxb-schemagen-plugin/1.3-SNAPSHOT/maven-jaxb-schemagen-plugin-1.3-SNAPSHOT.pom
6K downloaded (maven-jaxb-schemagen-plugin-1.3-SNAPSHOT.pom)
[INFO] ---------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ---------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=com.sun.tools.jxc.maven2 -DartifactId=maven-jaxb-schemagen-plugin -Dversion=1.3-SNAPSHOT -Dpackaging=maven-plugin -Dfile=path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=com.sun.tools.jxc.maven2 -DartifactId=maven-jaxb-schemagen-plugin -Dversion=1.3-SNAPSHOT -Dpackaging=maven-plugin -Dfile=path/to/file -Durl=[url] -DrepositoryId=[id]


  com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.3-SNAPSHOT

from the specified remote repositories:
  nexus (http://my.nexus.server:8081/nexus/content/groups/public)


  com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.3-SNAPSHOT

from the specified remote repositories:
  nexus (http://my.nexus.server:8081/nexus/content/groups/public)

[INFO] ---------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ---------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Jul 06 15:05:08 EDT 2010
[INFO] Final Memory: 7M/17M
[INFO] ---------------------------------------------------------------------------

【问题讨论】:

    标签: maven-2 jaxb nexus


    【解决方案1】:

    我了解到,大多数时候重建存储库的元数据有助于解决此类问题。 我觉得这很烦人。

    • 选择存储库
    • 在“浏览存储”选项卡中,打开根节点的上下文菜单(它有时隐藏在 Firefox 默认上下文菜单后面 - 在这种情况下按 Esc 会有所帮助,并会显示 Nexus 上下文菜单)
    • 选择重建元数据

    在某些情况下,过期缓存和重新索引也可能有所帮助。
    大多数情况下,这些步骤在第一次尝试时并没有解决问题,但最后每次都解决了。

    我在 Glassfish 2.1 中将 Nexus 作为 WAR 运行

    【讨论】:

      【解决方案2】:

      有时在使用 m2eclipse 时会发生这种情况。您选择了一个依赖项,默认范围是 pom 而不是 jar。你没有显示你的pom文件。验证所有依赖项都是 jar 范围的。

      【讨论】:

        猜你喜欢
        • 2013-12-21
        • 1970-01-01
        • 1970-01-01
        • 2011-06-29
        • 2012-01-15
        • 1970-01-01
        • 2018-09-12
        • 1970-01-01
        • 2017-07-09
        相关资源
        最近更新 更多