Nexus 存储库包含工件,但仅使 POM 可用

发布于 2024-09-08 02:39:28 字数 3594 浏览 7 评论 0原文

我有一个 Nexus 实例,其 Maven 2 存储库托管在非 Internet 连接的企业开发域上。我需要使用 Sun 的 ma​​ven-jaxb-schemagen 插件,但是,它仅以 Maven 1 格式提供(以及许多其他 Maven 1 依赖项,因此这不是一次性的边缘情况) )。

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

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

然后,我将 ma​​ven1as2 添加到我的公共存储库组中。我发现的一些参考资料说 Nexus 不允许您浏览或搜索 Maven1 存储库。我的结果好坏参半。如果我在 Nexus 中选择公共存储库ma​​ven1as2,我可以转到浏览存储并深入到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] ---------------------------------------------------------------------------

I have a Nexus instance with Maven 2 repositories hosted on a non-Internet-connected corporate development domain. I need to use the maven-jaxb-schemagen plugin from Sun, however, it was only available in Maven 1 format (along with many other Maven 1 dependencies, so this is not a one-off edge case).

I made a new Maven 1 hosted repository in Nexus (maven1), then made a Maven1-to-Maven2 virtual repository as well (maven1as2). Because some of the needed artifacts are snapshots, the policy for maven1 (and by extension maven1as2) is Snapshot.

I imported all of the Maven 1 artifacts through the filesystem to this repository's overridden local storage location.

I then added maven1as2 to my Public Repositories group. Some of the reference I have found says that Nexus will not allow you to browse or search a Maven1 repository. I have had mixed results. If I select Public Repositories or maven1as2 in Nexus, I can go to Browse Storage and drill down to com/sun/tools/jxc/maven2/maven-jaxb-schemagen-plugin/1.3-SNAPSHOT/ and view the maven-jaxb-schemagen-plugin-1.3-SNAPSHOT.pom file and its checksum. However, I cannot view the JAR artifact that should be there and is on the filesystem.

When I try to use Maven to build, I get the following:

$ 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] ---------------------------------------------------------------------------

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

耳钉梦 2024-09-15 02:39:28

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

Sometimes it happens when working with m2eclipse. You chose a dependency and the default scope is pom and not jar. You didn't show your pom file. validate that all dependencies are jar scoped.

烟花易冷人易散 2024-09-15 02:39:28

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

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

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

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

I learned that most of the time rebuilding metadata of the repositories helps to solve such problems.
I find it annoying how often this is necessary.

  • Select the repository
  • In the "Browse Storage" tab open the context menu of the root node (it sometimes is hidden behind the Firefox default context menu - pressing Esc helps in this case and brings the Nexus context menu into view)
  • Select rebuild metadata

Expire cache and reindex may help too for some cases.
Most of the time these steps didn't solve the problem at the first try but at last they solved it each time though.

I run Nexus as a WAR in Glassfish 2.1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文