【问题标题】:Add custom, local project to integration-distribution将自定义的本地项目添加到集成分发中
【发布时间】:2018-04-04 16:39:43
【问题描述】:

我正在尝试将自定义项目添加到分发中。我通过

创建的项目

mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeRepository=https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ -DarchetypeCatalog=remote -DarchetypeVersion=1.6.0-SNAPSHOT

(显然)无法通过官方链接获得。我没有对这个项目做任何更改。

我在distribution 中启动了karaf 并尝试通过

将新项目添加为新存储库

feature:repo-add mvn:org.opendaylight.flowlistener/features-flowlistener/0.1.0-SNAPSHOT/xml/features

并收到此错误:

添加功能网址 mvn:org.opendaylight.flowlistener/features-flowlistener/0.1.0-SNAPSHOT/xml/features 执行命令时出错:解析工件 org.opendaylight.flowlistener:features-flowlistener:xml:features:0.1.0-SNAPSHOT 时出错:[找不到工件 org.opendaylight.flowlistener:features-flowlistener:xml:features:0.1.0- opendaylight-snapshot 中的快照 (https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/)] : mvn:org.opendaylight.flowlistener/features-flowlistener/0.1.0-SNAPSHOT/xml/features

一般可以添加只存在于本地的项目吗?我做错了什么?

提前致谢! 最大

【问题讨论】:

    标签: opendaylight


    【解决方案1】:

    在 Karaf 中使用 etc/org.ops4j.pax.url.mvn.cfg 配置工件存储库。 OpenDaylight 中的配置只使用了 Karaf 系统目录;它完全忽略了本地 Maven 存储库。

    要添加您的本地 Maven 存储库,您应该编辑文件末尾的 org.ops4j.pax.url.mvn.repositories 条目以包含您的 Maven 存储库:

    org.ops4j.pax.url.mvn.repositories= \
        file:${karaf.home}/${karaf.default.repository}@id=system.repository, \
        file:${karaf.data}/kar@id=kar.repository@multi, \
        file:${user.home}/.m2/repository@snapshots@id=m2.repository
    

    顺便说一句,除非您打算将您的项目贡献给 OpenDaylight,否则您应该避免使用 org.opendaylight 命名空间。

    【讨论】:

    • 这行得通,感谢您的帮助!如何将我的本地项目作为l2switch/distribution 添加到现有发行版中?我尝试将flowlistener添加到l2switch/distribution/karaf/pom.xml,但失败了。
    【解决方案2】:

    Karaf 分发使用 etc/org.ops4j.pax.url.mvn.cfg 中的设置来解析 maven 工件。您必须调整这些设置(例如 maven 本地 repo)才能找到您的本地项目。有一些关于如何编辑此文件的内嵌文档: https://github.com/apache/karaf/blob/master/assemblies/features/base/src/main/resources/resources/etc/org.ops4j.pax.url.mvn.cfg

    【讨论】:

      猜你喜欢
      • 2017-01-24
      • 1970-01-01
      • 2023-04-02
      • 2017-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-03
      • 2020-10-07
      相关资源
      最近更新 更多