如何在 Scala IDE 中将源附加到 SBT 托管依赖项? [英] How to attach sources to SBT managed dependencies in Scala IDE?
问题描述
我从 Akka 2.0.1 开始使用 Scala IDE 2.0.1 和 SBT 0.11.2.我的 build.sbt 看起来像这样:
I'm using Scala IDE 2.0.1 and SBT 0.11.2 to start with Akka 2.0.1. My build.sbt looks like this:
name := "akka"
version := "0.1"
scalaVersion := "2.9.2"
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies += "com.typesafe.akka" % "akka-actor" % "2.0.1"
如您所见,没有什么了不起的.
As you can see, there's nothing spectacular.
现在我如何告诉 Eclipse 将工件与 akka-actor 库的源分类器一起使用?
Now how can I tell Eclipse to use the artifact with the sources classifier for the akka-actor library?
在 SBT 中,我可以使用 update-classifiers 将源代码和 Javadocs 下载到 Ivy 存储库,但即使我在从 sbteclipse 插件运行 eclipse 命令之前执行此操作,Eclipse 仍然不知道源代码.当然,我可以手动执行此操作,但这不适用于更多库.
In SBT, I can use update-classifiers to download sources and Javadocs to the Ivy repository, but even if I do this before running the eclipse command from the sbteclipse plugin then Eclipse still does not know the sources. Of course, I could do this manually, but this doesn't scale well for more libraries.
我也尝试过将 IvyDE 插件与 deliver-local 命令一起使用.虽然这集成了依赖管理,但它似乎对源代码没有帮助.
I have also tried to use the IvyDE plugin with the deliver-local command. While this integrates the dependency management, it doesn't seem to help with the sources.
有什么线索吗?
这是从 Deliver-local 生成的 ivy.xml:
This is the ivy.xml generated from deliver-local:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="default" module="akka_2.9.2" revision="0.1" status="release" publication="20120506225613">
<description>
akka
</description>
</info>
<configurations>
<conf name="compile" visibility="public" description=""/>
<conf name="runtime" visibility="public" description="" extends="compile"/>
<conf name="test" visibility="public" description="" extends="runtime"/>
<conf name="provided" visibility="public" description=""/>
<conf name="optional" visibility="public" description=""/>
<conf name="sources" visibility="public" description=""/>
<conf name="docs" visibility="public" description=""/>
<conf name="pom" visibility="public" description=""/>
</configurations>
<publications>
<artifact name="akka_2.9.2" type="pom" ext="pom" conf="pom"/>
<artifact name="akka_2.9.2" type="jar" ext="jar" conf="compile"/>
<artifact name="akka_2.9.2" type="src" ext="jar" conf="sources" e:classifier="sources"/>
<artifact name="akka_2.9.2" type="doc" ext="jar" conf="docs" e:classifier="javadoc"/>
</publications>
<dependencies>
<dependency org="org.scala-lang" name="scala-library" rev="2.9.2" conf="compile->default(compile)"/>
<dependency org="com.typesafe.akka" name="akka-actor" rev="2.0.1" conf="compile->default(compile)"/>
<exclude org="org.scala-lang" module="scala-library" artifact="*" type="jar" ext="*" matcher="exact"/>
<exclude org="org.scala-lang" module="scala-compiler" artifact="*" type="jar" ext="*" matcher="exact"/>
<override org="org.scala-lang" module="scala-library" matcher="exact" rev="2.9.2"/>
<override org="org.scala-lang" module="scala-compiler" matcher="exact" rev="2.9.2"/>
</dependencies>
</ivy-module>
我是 Ivy 的新手,所以这并不能说明什么.我只是认为它提到了源代码和 javadocs,但不知何故 IvyDE 没有选择它.
I'm new to Ivy, so this doesn't tell me much. I just figure that it mentions sources and javadocs, but somehow the IvyDE doesn't pick it up.
推荐答案
好吧,我已经放弃了,回到了 NetBeans 7.1.2 + Scala 插件 + Maven.这种组合的集成度要好得多,而且开箱即用,无需修修补补.
Well, I have given up on this and returned to NetBeans 7.1.2 + Scala plugin + Maven. This combination is much better integrated and works out of the box without tinkering.
这篇关于如何在 Scala IDE 中将源附加到 SBT 托管依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!