在sbt中,如何发布到外部常春藤设置文件中定义的解析器?
我们有许多基于ant的项目,它们依赖于单个的在sbt中,如何发布到外部常春藤设置文件中定义的解析器?,sbt,publish,ivy,Sbt,Publish,Ivy,我们有许多基于ant的项目,它们依赖于单个的ivysettings.xml,其中定义了我们的ivy解析器。我正在创建一个新的基于sbt的项目,根据DRY原则,我希望sbt也依赖于相同的ivysettings.xml文件(而不是试图在sbt脚本中重新定义解析器)。事实证明,使用externalIvySettings(),这非常容易——至少在解决依赖关系时是这样 但是,我们还需要发布到文件中定义的一个解析器。在ant中,这真的很容易:“,但是对于sbt,我被难倒了。sbt有一个publishTo设置
ivysettings.xml
,其中定义了我们的ivy解析器。我正在创建一个新的基于sbt的项目,根据DRY原则,我希望sbt也依赖于相同的ivysettings.xml
文件(而不是试图在sbt脚本中重新定义解析器)。事实证明,使用externalIvySettings()
,这非常容易——至少在解决依赖关系时是这样
但是,我们还需要发布到文件中定义的一个解析器。在ant中,这真的很容易:“
,但是对于sbt,我被难倒了。sbt有一个publishTo
设置,可以用来定义要发布到的解析器,但我不想定义新的解析器。相反,我想从ExternalVysettings()加载的设置中提取解析器,并将其传递给publishTo
。这可能吗
编辑:
这是请求的ivysettings.xml
文件。我们希望发布到“模块”解析器
<ivysettings>
<properties file="${ivy.settings.dir}/ivysettings.properties" />
<settings defaultResolver="default" defaultResolveMode="dynamic"/>
<property name="x1.resolver" value="x1-fs" override="false"/>
<property name="x2.resolver" value="x2-fs" override="false"/>
<property name="x1.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="x1.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="x2.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="x2.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="local.root" value="${ivy.default.ivy.user.dir}/x1-local" override="true"/>
<property name="local.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="local.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="modules.root" value="${ivy.settings.dir}/ivy/published" override="true"/>
<property name="modules.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<property name="modules.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="true"/>
<!-- some default values for paths to the x2 and x1 repositories; these should be overridden in ivysettings.properties -->
<property name="x2.fs.root" value="${ivy.settings.dir}/ivy/x2root" override="false"/>
<property name="x1.fs.root" value="${ivy.settings.dir}/ivy/x1root" override="false"/>
<property name="ivy.cache.dir" value="${ivy.settings.dir}/ivy/cache"/>
<caches defaultCacheDir="${ivy.cache.dir}"/>
<resolvers>
<filesystem name="x1-fs">
<ivy pattern="${x1.fs.root}/${x1.ivy.pattern}" />
<artifact pattern="${x1.fs.root}/${x1.artifact.pattern}" />
</filesystem>
<filesystem name="x2-fs">
<ivy pattern="${x2.fs.root}/${x2.ivy.pattern}" />
<artifact pattern="${x2.fs.root}/${x2.artifact.pattern}" />
</filesystem>
<chain name="x1">
<resolver ref="${x1.resolver}"/>
</chain>
<chain name="x2">
<resolver ref="${x2.resolver}"/>
</chain>
<filesystem name="local">
<ivy pattern="${local.root}/${local.ivy.pattern}" />
<artifact pattern="${local.root}/${local.artifact.pattern}" />
</filesystem>
<filesystem name="modules" checkmodified="true" changingPattern="*" changingMatcher="glob">
<ivy pattern="${modules.root}/${modules.ivy.pattern}" />
<artifact pattern="${modules.root}/${modules.artifact.pattern}" />
</filesystem>
<chain name="main" dual="true">
<resolver ref="modules"/>
<resolver ref="x1"/>
<resolver ref="x2"/>
</chain>
<chain name="default" returnFirst="true">
<resolver ref="local"/>
<resolver ref="main"/>
</chain>
</resolvers>
</ivysettings>
在该链接中找到了答案 但答案是只引用解析程序的名称。在您的情况下,它将是
publishTo := Some(Resolver.file("modules"))
既然您想使用“模块”解析器发布,您能显示发布解析器的xml定义吗?