我正在尝试在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>
正如您所看到的,我只有一个UrlResolver会尝试在scala-tools repo中找到我的依赖项。如果我指定我的依赖项correctly,那么常春藤将尝试在http://scala-tools.org/repo-releases/org.scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar和http://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>
问:如何改变工件模式/其他东西迫使常春藤使其正常工作?
1:http://scala-tools.org/repo-releases/ scala-tools repo
答案 0 :(得分:6)
<强>的ivy.xml 强>
我检查了POM的scala-compiler并发现它引用了模块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>
<强> ivysettings.xml 强>
我建议从任何符合Maven标准的存储库下载时使用ibiblio解析程序。
<ivysettings>
<settings defaultResolver="scalatools"/>
<resolvers>
<ibiblio name="scalatools" root="http://scala-tools.org/repo-releases" m2compatible="true"/>
</resolvers>
</ivysettings>
如果您需要下载其他库,可以增强设置文件,以便常春藤只从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>