Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SBT支持定制常春藤模块状态?_Sbt_Ivy - Fatal编程技术网

SBT支持定制常春藤模块状态?

SBT支持定制常春藤模块状态?,sbt,ivy,Sbt,Ivy,在我的SBT构建中,我依赖于使用自定义模块状态的常春藤工件。这导致SBT中出现以下错误: [error] (*:update) sbt.ResolveException: unresolved dependency: my-org#myapp-core_2.11;1.0: java.text.ParseException: inconsistent module descriptor file found in 'http://artifacts.myorg.com/libs-snapshots

在我的SBT构建中,我依赖于使用自定义模块状态的常春藤工件。这导致SBT中出现以下错误:

[error] (*:update) sbt.ResolveException: unresolved dependency: my-org#myapp-core_2.11;1.0: java.text.ParseException: inconsistent module descriptor file found in 'http://artifacts.myorg.com/libs-snapshots-local/myapp-core_2.11/1.0/myapp-ivy.xml': bad status: 'snapshot'; 
我可以通过告诉SBT使用外部常春藤设置来解决这个问题,如:

externalIvySettings(baseDirectory(_ / "ivySettings.xml"))
然后创建包含以下内容的ivySettings.xml:

<statuses default="release"> 
  <status name="release" integration="false"/> 
  <status name="snapshot" integration="false"/> 
</statuses>  

但肯定有更好的办法吗?这种解决方法的问题是,现在我的所有设置(如解析器)也必须在常春藤文件中,因为(IFAIK)在使用ExternalVysettings时要么全是,要么全是

有没有办法在my build.sbt中指定一组自定义状态?或者,有没有一种方法可以告诉sbt将外部常春藤设置与其从build.sbt生成的设置相结合


由于在ivy中指定自定义模块状态是一件有效的事情,因此在sbt中也应该支持这一点

这是因为对于某些存储库,它们使用的是非标准状态,无法通过一致性检查。我们通过构造不进行一致性检查的自定义解析器来解决这个问题。您还可以使用相同的方法构造具有自定义状态的解析器。以下是工作片段

  resolvers += {
  val resolver = new org.apache.ivy.plugins.resolver.IBiblioResolver
  resolver.setName("Custom Ivy Snapshots")
  resolver.setRoot("http://Custom/snapshots/")
  val settings = new org.apache.ivy.core.settings.IvySettings()
  settings.setVariable("ivy.local.default.ivy.pattern", Pattern)
  settings.setVariable("ivy.local.default.artifact.pattern", Pattern)
  resolver.setSettings(settings)
  resolver.setM2compatible(true)
  resolver.setCheckconsistency(false)
  new RawRepository(resolver)
}