【问题标题】:Ivy resolving POM dependency where version comes from POM parentIvy 解决版本来自 POM 父级的 POM 依赖项
【发布时间】:2012-04-29 14:53:18
【问题描述】:

使用来自 Eclipse (Helios) 的 Ivy 2.2 和 IvyDE 2.2....

想要引入 spring-data-neo4j 及其默认依赖项: http://maven.springframework.org/milestone/org/springframework/data/spring-data-neo4j/2.1.0.M1

在我的 Ivy 文件中使用以下内容:

<dependency org="org.springframework.data" name="spring-data-neo4j" rev="2.1.0.M1"/>

以及我的设置文件中的这些解析器:

<!-- Maven springframework data milestones -->
<url name="maven.springframework.data.milestone">
  <ivy pattern="http://maven.springframework.org/milestone/org/springframework/data/[module]/[revision]/[artifact]-[revision].[ext]" />
  <artifact pattern="http://maven.springframework.org/milestone/org/springframework/data/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>

<!-- Maven springframework milestones -->
<url name="maven.springframework.data.milestone">
  <ivy pattern="http://maven.springframework.org/milestone/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
  <artifact pattern="http://maven.springframework.org/milestone/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>

只有 spring-data-neo4j 工件被拉下,没有提及常春藤控制台中的父级(调试级别)。看了以下建议: http://theholyjava.wordpress.com/2011/01/26/using-ivy-with-pom-xml/

但感觉这仅适用于无法通过普通解析器访问的相对路径。查看 PomModuleDescriptorParser 代码,如果父模块为空,则它可能拥有的所有信息(如修订信息)都将被丢弃:

 if (parentDescr != null) {
   for (int i = 0; i < parentDescr.getDependencies().length; i++) {
     mdBuilder.addDependency(parentDescr.getDependencies()[i]);
   }
 }

如果是这种情况:(1) 我如何在日志中看到更多信息以及 (2) 让 parseOtherPom 方法返回父级?

提前致谢 - 马修

【问题讨论】:

    标签: maven ivy ivyde


    【解决方案1】:

    试试下面的 ivysettings.xml 文件:

    <ivysettings>
        <settings defaultResolver="maven-repos"/>
        <resolvers>
            <chain name="maven-repos">
                <ibiblio name="central" m2compatible="true"/>
                <ibiblio name="spring-milestone" m2compatible="true" root="http://maven.springframework.org/milestone"/>
            </chain>
        </resolvers>
    </ivysettings>
    

    ibiblio 解析器是配置 Maven 存储库的最佳方式。

    【讨论】:

    • 我是 m2compatible 的 maven 兼容性。
    • @MatthewYoung 事实上,它的存在是出于历史原因。最初的 Maven Central repo 被称为 ibiblio 有一个不同的“Maven 1”格式。这解释了为什么默认情况下不启用 m2compatible 标志(因此它不会破坏使用旧 Maven 设置的旧版本)。
    猜你喜欢
    • 1970-01-01
    • 2020-07-12
    • 2021-11-12
    • 1970-01-01
    • 1970-01-01
    • 2018-03-05
    • 1970-01-01
    • 2018-02-16
    • 1970-01-01
    相关资源
    最近更新 更多