这是我的 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>
工件 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>
当我用这样的代码下载常春藤库时:
<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>
ivy 下载排除了 deps avalon-framework:avalon-framework:4.1.3 和 logkit:logkit:1.0.1
为什么?我在 pom 中排除了它!
如何用 ivy 排除它,保持相同的简单 ivy.xml?