常春藤不会忽视在pom中被标记为排除的罐子

时间:2012-05-16 05:54:44

标签: pom.xml ivy

这是我的ivy.xml:

<dependencies defaultconf="default">
    <dependency org="com.mycompany" name="custom" rev="1.0"/>
</dependencies>

ivysettings.xml:

<ivysettings>
    <settings defaultResolver="repo.mycompany.com" />
    <resolvers>
        <ibiblio name="repo.mycompany.com" root="http://repo.mycompany.com/maven/" m2compatible="true" usepoms="true" />
    </resolvers>
</ivysettings>

Artifact com.mycompany:custom:1.0创建为maven pom并发布到repo.mycompany.com:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mycompany</groupId>
    <artifactId>custom</artifactId>
    <version>1.0</version>
    <packaging>pom</packaging>

    <dependencies>
        <dependency>
            <artifactId>commons-logging</artifactId>
            <groupId>commons-logging</groupId>
            <version>1.1</version>
            <exclusions>
                 <exclusion>
                     <groupId>logkit</groupId>
                     <artifactId>logkit</artifactId>
                 </exclusion>
                <exclusion>
                    <groupId>avalon-framework</groupId>
                    <artifactId>avalon-framework</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
</project>

我用这样的代码下载ivy libs:

<target name="ivy-init">
    <mkdir dir="${internal-libs}"/>
    <ivy:settings file="${ivy.settings.dir}/ivysettings.xml"/>
    <ivy:retrieve pattern="${internal-libs}/[artifact]-[revision].[ext]" sync="true"  />
</target>

常春藤下载排除deps avalon-framework:avalon-framework:4.1.3和logkit:logkit:1.0.1

为什么呢?我在pom中将它排除在外!

如何使用常春藤排除它,保持相同的简单ivy.xml?

1 个答案:

答案 0 :(得分:0)

在接下来的步骤中解决此问题:

  1. 查看我的pom.xml并添加排除到其他工件依赖 commons-logging:commons-logging
  2. 更新到最新的常春藤
  3. 清理本地常春藤缓存