sbt-idea
sbt-idea copied to clipboard
Support configuable source/javadoc classifiers
Our internal repository uses the classifier src rather than sources, and as per Ivy's documentation this may not be that unusual
As per our discussion on the sbt mailing list, it would be useful to be able to configure a Seq of classifiers rather than hardcoding "sources" & "javadoc"
Note that having a sequence of classifiers doesn't help. That already exists in SBT and is called transitiveClassifiers. What we want is a way to map from that sequence of classifiers into the two types that IDEA supports: source and javadoc.
Two settings should do the job, I think.
So do you mean something like:
set transitiveClassifiers := Seq("src", "sources", "javadocs") set ideaSourcesClassifiers := Seq("src", "sources") set ideaJavadocsClassifiers := Seq("javadocs")
Yes exactly
Looks good to me too.
You could test this now with 0.11.1-SNAPSHOT, i.e. put something like this in build.sbt:
transitiveClassifiers += "src"
ideaSourcesClassifiers += "src"
and report back whether it works for you or not (I tested just very briefly so...).
Could you build for scala 2.8.1
To my understanding, sbt 0.11 does not support scala 2.8 for build definition/plugins, or am I wrong? At least I can't easily compile with just setting crossScalaVersions because sbt_2.8.1 -stuff is not found from repos.
Is there something preventing you from using 2.9 (you can use 2.8 for your project code, of course)?
That is correct. SBT 0.10 is the only version that used Scala 2.8 for plugins and build definition.
I've upgraded to sbt 0.11.0 - it appears that when I run gen-idea for dependencies I've had to declare the artifacts manually the src dependency ends up being copied into the jar type in my local Ivy repository. For example:
dependency: "x" % "y" % "8.2.2" % "compile" artifacts (Artifact("y"), Artifact("y", "src", "jar", "src")),
ivy cache (before running gen-idea): ....ivy2\cache\x\y\jars\y-8.2.2.jar ....ivy2\cache\x\y\srcs\y-8.2.2-src.jar
additional file after running gen-idea: ....ivy2\cache\x\y\jars\y-8.2.2-src.jar
In addition the src jars for standard dependencies declared without specifying their artifacts are still being added as CLASSES rather than SOURCES in libraries*.xml
I'm using the full configuration for project\MyProject.scala and the simple configuration for project\plugins\build.sbt with the following in MyProject.scala - is this in the correct place?
def c2settings: Seq[Setting[_]] = Defaults.defaultSettings ++ Seq( [...snip...] transitiveClassifiers := Seq("src"), SbtIdeaPlugin.ideaSourcesClassifiers += "src", SbtIdeaPlugin.ideaJavadocsClassifiers += "doc", [...snip...] )
lazy val project = Project("project", file("."), settings = c2settings)
I noticed too that -src gets placed into jars -dir instead of srcs -dir, which I think should not be a problem as such, but this "are still being added as CLASSES rather than SOURCES in libraries*.xml" needs some investigation. Thanks for the report.
Is there any way to simply turn off looking for src and javadoc classifiers? I'm on a coffee shop wireless network and this is taking a while.
[error] Server access Error: Operation timed out url=http://repo1.maven.org/maven2/org/springframework/spring-jdbc/3.0.4.RELEASE/spring-jdbc-3.0.4.RELEASE-javadoc.jar [warn] [NOT FOUND ] org.springframework#spring-jdbc;3.0.4.RELEASE!spring-jdbc.jar(doc) (77031ms) [warn] ==== public: tried [warn] http://repo1.maven.org/maven2/org/springframework/spring-jdbc/3.0.4.RELEASE/spring-jdbc-3.0.4.RELEASE-javadoc.jar [error] Server access Error: Operation timed out url=http://repo1.maven.org/maven2/org/springframework/spring-beans/3.0.4.RELEASE/spring-beans-3.0.4.RELEASE-javadoc.jar [warn] [NOT FOUND ] org.springframework#spring-beans;3.0.4.RELEASE!spring-beans.jar(doc) (76486ms)
'gen-idea no-classifiers no-sbt-classifiers' should do the trick. But no permanently configurable way to turn it off.
Ahh this is very helpful for the exact reasons wsargent mentioned. Thank you mpeltonen.
The change (4f7acd829eb4b330ae263404dd56c8fb27b85993) introduced to deal with this problem has broken generation of sources for the sbt-and-plugins
library in .idea_modules/project.iml
. Any clues what happened here?