常春藤定制网址解析器

Jer*_*iho 3 ant dependencies build-process ivy dependency-management

我想在我的ivysettings.xml文件中创建自定义解析器:

<ivysettings>
    <settings defaultResolver="default"/>
    <resolvers>
        <chain name="default">
            <url name="scala-tools">
                <ivy pattern="http://scala-tools.org/repo-releases/[organisation]/[module]/[revision]/ivy-[revision].xml" />
                <artifact pattern="http://scala-tools.org/repo-releases/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
                <artifact pattern="http://scala-tools.org/repo-releases/[organisation]/[module]/[revision]/[artifact].[ext]"/>
            </url>
            <!--<ibiblio name="ibiblio"/>-->
        </chain>
    </resolvers>
</ivysettings>
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,我只有一个UrlResolver会尝试在scala-tools repo中查找我的依赖项.如果我正确指定我的依赖项,那么 ivy将尝试在http://scala-tools.org/repo-releases/org.scala-lang/scala-library/2.8.0/scala-library-2.8.0中找到它. jarhttp://scala-tools.org/repo-releases/org.scala-lang/scala-library/2.8.0/scala-library.jar(是的,根据我在ivysettings.xml中的说明)显然,它找不到任何东西.为了让事情有效,我必须以这种方式指定依赖关系:

<ivy-module version="2.2">
    <info organisation="org.yoba" module="Yoba"/>
    <dependencies>
        <dependency org="org/scala-lang" name="scala-library" rev="2.8.0"/>
        <!--<dependency org="org.scala-lang" name="scala-library" rev="2.8.0"/>-->
        <dependency org="org/scala-lang" name="scala-compiler" rev="2.8.0"/>
        <!--<dependency org="org.scala-lang" name="scala-compiler" rev="2.8.0"/>-->
    </dependencies>
</ivy-module>
Run Code Online (Sandbox Code Playgroud)

问:如何改变工件模式/其他东西迫使常春藤使其工作正常?

1:http://scala-tools.org/repo-releases/ scala-tools repo

Mar*_*nor 6

的ivy.xml

我检查了POM的scala编译器,发现它引用了模块scala-library.这意味着在常春藤文件中只需要一个依赖声明:

<ivy-module version="2.0">
    <info organisation="org.yoba" module="Yoba"/>
    <dependencies>
        <dependency org="org.scala-lang" name="scala-compiler" rev="2.8.0" conf="default"/>
    </dependencies>
</ivy-module>
Run Code Online (Sandbox Code Playgroud)
  • 版本号需要为"2.0"
  • 包括默认映射以避免下载可选依赖项

ivysettings.xml

从任何符合Maven标准的存储库下载时,我建议使用ibiblio解析器.

<ivysettings>
    <settings defaultResolver="scalatools"/>
    <resolvers>
        <ibiblio name="scalatools" root="http://scala-tools.org/repo-releases" m2compatible="true"/>
    </resolvers>
</ivysettings>
Run Code Online (Sandbox Code Playgroud)

如果您需要下载其他库,可以增强设置文件,以便常春藤只从scala存储库中检索scala模块

<ivysettings>
    <settings defaultResolver="central"/>
    <resolvers>
        <ibiblio name="central" m2compatible="true"/>
        <ibiblio name="scalatools" root="http://scala-tools.org/repo-releases" m2compatible="true"/>
    </resolvers>
    <modules>
        <module organisation="org.scala-lang" resolver="scalatools"/>
    </modules>
</ivysettings>
Run Code Online (Sandbox Code Playgroud)