Ivy解决POM依赖关系,其中版本来自POM父级

时间:2012-04-18 07:57:29

标签: maven ivy ivyde

使用来自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

在我的常春藤文件中使用以下内容:

<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工件被拉下来,没有提到Ivy控制台中的父级(调试级别)。看看下面的建议:      http://theholyjava.wordpress.com/2011/01/26/using-ivy-with-pom-xml/

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

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

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

提前谢谢 - 马修

1 个答案:

答案 0 :(得分: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存储库的最佳方式。