mpeltonen / sbt-idea Goto Github PK
View Code? Open in Web Editor NEWA simple-build-tool (sbt) plugin/processor for creating IntelliJ IDEA project files
License: Other
A simple-build-tool (sbt) plugin/processor for creating IntelliJ IDEA project files
License: Other
For those using the community edition of IntelliJ without web facets it would be useful if the processor could be set to not generate the web facet for web projects.
Hi,
I've recently migrated my projects to Scala 2.8.0 but unfortunately the plugin doesn't appear to work with this version. Are there any plans to move to Scala 2.8.0 ?
If not any idea's what changes would be required to do this as I might have a go myself.
Thanks,
Paul.
for multiprojects, it looks like the ParentProject doesn't need the IdeaProject
trait mixed in, as stated in the README.
doing so results in a completely broken config (using the current master of the project).
class MyProject(info: ProjectInfo) extends ParentProject(info) with IdeaProject /* not needed */ {
}
So, far I found two problems where the plugins creates different idea metadata for each run. This instability leads to spurious reloads necessary and unclear diffs if the generated files are put under version control (even if this is not recommended usage).
As usual this comes from some information put into sets. I observed:
Hi
What is the best way to attach sources to the Intellij dependencies? After I run the "idea" command there does seem to be a source path attached for each dependency, e.g.:
/Users/dev/scala/proj/lib_managed/scala_2.8.1/test/servlet-api-2.5.0.jar
Has source location:
/Users/dev/scala/proj/lib_managed/scala_2.8.1/test/servlet-api-2.5.0-sources.jar
Is it possible to tell sbt-idea to use a specific path format when it generates source attachment paths?
Alternatively is it possible to configure my sbt ivy retrieve pattern in such a way as to match the source locations generated by sbt-idea?
I am automatically retrieving the sources of my ivy.xml dependencies using sbt-sources(https://github.com/OlegYch/sbt-sources-plugin), so I would prefer to avoid copying source jars manually into the sbt-idea expected locations.
Thanks
Did
Version information
[info] Building project Lift SBT Tempalte 0.1 against Scala 2.8.0
[info] using LiftProject with sbt 0.7.4 and Scala 2.7.7
Stacktrace after issuing idea command
java.lang.NullPointerException
at scala.xml.XML$.saveFull(XML.scala:138)
at scala.xml.XML$.save(XML.scala:103)
at scala.xml.XML$.save(XML.scala:93)
at SaveableXml$class.save(SaveableXml.scala:10)
at IdeaModuleDescriptor.save(IdeaModuleDescriptor.scala:5)
at IdeaProject$class.createIdeaProject(IdeaProject.scala:15)
at LiftProject$$anonfun$subProject$1$$anon$1.createIdeaProject(LiftProject.scala:12)
at IdeaProject$$anonfun$idea$1.apply(IdeaProject.scala:6)
at IdeaProject$$anonfun$idea$1.apply(IdeaProject.scala:6)
at sbt.TaskManager$Task.invoke(TaskManager.scala:62)
at sbt.impl.RunTask.doRun$1(RunTask.scala:77)
at sbt.impl.RunTask.runTask(RunTask.scala:85)
at sbt.impl.RunTask.sbt$impl$RunTask$$runIfNotRoot(RunTask.scala:60)
at sbt.impl.RunTask$$anonfun$runTasksExceptRoot$2.apply(RunTask.scala:48)
at sbt.impl.RunTask$$anonfun$runTasksExceptRoot$2.apply(RunTask.scala:48)
at sbt.Distributor$Run$Worker$$anonfun$2.apply(ParallelRunner.scala:131)
at sbt.Distributor$Run$Worker$$anonfun$2.apply(ParallelRunner.scala:131)
at sbt.Control$.trapUnit(Control.scala:19)
at sbt.Distributor$Run$Worker.run(ParallelRunner.scala:131)
This would be in line with the project structure that IntelliJ generates from a multi-module Maven build. Without this, I can't see files in subdirectories of the parent project that don't correspond to a sub-module. The parent project should not have dependencies attached, nor should it have the Scala facet.
Hi,
apparently the URL that is stated in the documentation isn't applicable anymore? Thanks for looking into this.
> *sbtIdeaRepo at http://mpeltonen.github.com/maven/ [info] Defined new processor repository 'sbtIdeaRepo at http://mpeltonen.github.com/maven/' > *idea is com.github.mpeltonen sbt-idea-processor 0.4.0 [warn] module not found: com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0 [warn] ==== local: tried [warn] /Users/alex/.ivy2/local/com.github.mpeltonen/sbt-idea-processor_2.8.1/0.4.0/ivys/ivy.xml [warn] -- artifact com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0!sbt-idea-processor_2.8.1.jar: [warn] /Users/alex/.ivy2/local/com.github.mpeltonen/sbt-idea-processor_2.8.1/0.4.0/jars/sbt-idea-processor_2.8.1.jar [warn] ==== sbtIdeaRepo: tried [warn] http://mpeltonen.github.com/maven/com/github/mpeltonen/sbt-idea-processor_2.8.1/0.4.0/sbt-idea-processor_2.8.1-0.4.0.pom [warn] -- artifact com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0!sbt-idea-processor_2.8.1.jar: [warn] http://mpeltonen.github.com/maven/com/github/mpeltonen/sbt-idea-processor_2.8.1/0.4.0/sbt-idea-processor_2.8.1-0.4.0.jar [warn] ==== public: tried [warn] http://repo1.maven.org/maven2/com/github/mpeltonen/sbt-idea-processor_2.8.1/0.4.0/sbt-idea-processor_2.8.1-0.4.0.pom [warn] -- artifact com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0!sbt-idea-processor_2.8.1.jar: [warn] http://repo1.maven.org/maven2/com/github/mpeltonen/sbt-idea-processor_2.8.1/0.4.0/sbt-idea-processor_2.8.1-0.4.0.jar [warn] ==== Scala-Tools Maven2 Repository: tried [warn] http://scala-tools.org/repo-releases/com/github/mpeltonen/sbt-idea-processor_2.8.1/0.4.0/sbt-idea-processor_2.8.1-0.4.0.pom [warn] -- artifact com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0!sbt-idea-processor_2.8.1.jar: [warn] http://scala-tools.org/repo-releases/com/github/mpeltonen/sbt-idea-processor_2.8.1/0.4.0/sbt-idea-processor_2.8.1-0.4.0.jar [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: [info] [warn] :: problems summary :: [warn] :::: WARNINGS [warn] module not found: com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0 [warn] ==== local: tried [warn] /Users/alex/.ivy2/local/com.github.mpeltonen/sbt-idea-processor_2.8.1/0.4.0/ivys/ivy.xml [warn] -- artifact com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0!sbt-idea-processor_2.8.1.jar: [warn] /Users/alex/.ivy2/local/com.github.mpeltonen/sbt-idea-processor_2.8.1/0.4.0/jars/sbt-idea-processor_2.8.1.jar [warn] ==== sbtIdeaRepo: tried [warn] http://mpeltonen.github.com/maven/com/github/mpeltonen/sbt-idea-processor_2.8.1/0.4.0/sbt-idea-processor_2.8.1-0.4.0.pom [warn] -- artifact com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0!sbt-idea-processor_2.8.1.jar: [warn] http://mpeltonen.github.com/maven/com/github/mpeltonen/sbt-idea-processor_2.8.1/0.4.0/sbt-idea-processor_2.8.1-0.4.0.jar [warn] ==== public: tried [warn] http://repo1.maven.org/maven2/com/github/mpeltonen/sbt-idea-processor_2.8.1/0.4.0/sbt-idea-processor_2.8.1-0.4.0.pom [warn] -- artifact com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0!sbt-idea-processor_2.8.1.jar: [warn] http://repo1.maven.org/maven2/com/github/mpeltonen/sbt-idea-processor_2.8.1/0.4.0/sbt-idea-processor_2.8.1-0.4.0.jar [warn] ==== Scala-Tools Maven2 Repository: tried [warn] http://scala-tools.org/repo-releases/com/github/mpeltonen/sbt-idea-processor_2.8.1/0.4.0/sbt-idea-processor_2.8.1-0.4.0.pom [warn] -- artifact com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0!sbt-idea-processor_2.8.1.jar: [warn] http://scala-tools.org/repo-releases/com/github/mpeltonen/sbt-idea-processor_2.8.1/0.4.0/sbt-idea-processor_2.8.1-0.4.0.jar [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: [info] [info] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS sbt.ResolveException: unresolved dependency: com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0: not found at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:130) at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:112) at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:110) at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:93) at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:93) at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:85) at sbt.IvySbt.liftedTree1$1(Ivy.scala:41) at sbt.IvySbt.action$1(Ivy.scala:41) at sbt.IvySbt$$anon$1.call(Ivy.scala:50) at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:63) at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:67) at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:67) at xsbt.boot.Using$.withResource(Using.scala:11) at xsbt.boot.Using$.apply(Using.scala:10) at xsbt.boot.Locks$GlobalLock.withFileLock(Locks.scala:67) at xsbt.boot.Locks$GlobalLock.liftedTree1$1(Locks.scala:45) at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:45) at xsbt.boot.Locks$.apply(Locks.scala:31) at sbt.IvySbt.withDefaultLogger(Ivy.scala:50) at sbt.IvySbt.withIvy(Ivy.scala:82) at sbt.IvySbt$Module.withModule(Ivy.scala:93) at sbt.IvyActions$.update(IvyActions.scala:110) at sbt.processor.Retrieve$$anonfun$retrieve$1.apply(Retrieve.scala:21) at sbt.processor.Retrieve$$anonfun$retrieve$1.apply(Retrieve.scala:21) at sbt.processor.Callable$$anon$1.call(Retrieve.scala:31) at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:63) at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:67) at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:67) at xsbt.boot.Using$.withResource(Using.scala:11) at xsbt.boot.Using$.apply(Using.scala:10) at xsbt.boot.Locks$GlobalLock.withFileLock(Locks.scala:67) at xsbt.boot.Locks$GlobalLock.liftedTree1$1(Locks.scala:45) at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:45) at xsbt.boot.Locks$.apply(Locks.scala:31) at sbt.processor.Retrieve.retrieve(Retrieve.scala:21) at sbt.processor.ManagerImpl.sbt$processor$ManagerImpl$$retrieveProcessor(Manager.scala:61) at sbt.processor.ManagerImpl.defineProcessor(Manager.scala:40) at sbt.processor.Execute.apply(Execute.scala:16) at sbt.processor.CommandRunner.apply(CommandRunner.scala:13) at sbt.xMain$$anonfun$process$1$6.apply(Main.scala:242) at sbt.xMain$$anonfun$process$1$6.apply(Main.scala:241) at sbt.xMain.tryOrFail$1(Main.scala:146) at sbt.xMain.process$1(Main.scala:241) at sbt.xMain$Continue$1.apply(Main.scala:132) at sbt.xMain.run$1(Main.scala:136) at sbt.xMain.processArguments(Main.scala:266) at sbt.xMain.startProject(Main.scala:107) at sbt.xMain.run(Main.scala:84) at sbt.xMain.run0$1(Main.scala:35) at sbt.xMain.run(Main.scala:42) at xsbt.boot.Launch$.run(Launch.scala:53) at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:42) at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:42) at xsbt.boot.Launch$.launch(Launch.scala:57) at xsbt.boot.Launch$.explicit(Launch.scala:42) at xsbt.boot.Launch$.initialized(Launch.scala:38) at xsbt.boot.Launch$.parsed(Launch.scala:31) at xsbt.boot.Launch$.configured(Launch.scala:21) at xsbt.boot.Launch$.apply(Launch.scala:16) at xsbt.boot.Launch$.apply(Launch.scala:13) at xsbt.boot.Boot$.runImpl(Boot.scala:24) at xsbt.boot.Boot$.run(Boot.scala:19) at xsbt.boot.Boot$.main(Boot.scala:15) at xsbt.boot.Boot.main(Boot.scala) [error] sbt.ResolveException: unresolved dependency: com.github.mpeltonen#sbt-idea-processor_2.8.1;0.4.0: not found
Please change to
*idea is com.github.mpeltonen sbt-idea 0.1.0
Hello, I've got a SBT project which has created idea files previously, but when I've updated and re-run I'm getting this error:
Any ideas?
java.lang.StackOverflowError
at scala.collection.mutable.HashTable$class.elemHashCode(HashTable.scala:154)
at scala.collection.mutable.HashMap.elemHashCode(HashMap.scala:33)
at scala.collection.mutable.HashTable$class.findEntry(HashTable.scala:66)
at scala.collection.mutable.HashMap.findEntry(HashMap.scala:33)
at scala.collection.mutable.HashMap.findEntry(HashMap.scala:33)
at scala.collection.mutable.DefaultMapModel$class.update(DefaultMapModel.scala:38)
at scala.collection.mutable.HashMap.update(HashMap.scala:33)
at sbt.Reflective$$anonfun$reflectiveMappings$1.apply(BasicProjectTypes.scala:574)
at sbt.Reflective$$anonfun$reflectiveMappings$1.apply(BasicProjectTypes.scala:573)
at scala.collection.mutable.OpenHashMap$$anonfun$foreach$1.apply(OpenHashMap.scala:197)
at scala.collection.mutable.OpenHashMap$$anonfun$foreach$1.apply(OpenHashMap.scala:195)
at scala.collection.mutable.OpenHashMap$$anonfun$foreachUndeletedEntry$1.apply(OpenHashMap.scala:202)
at scala.collection.mutable.OpenHashMap$$anonfun$foreachUndeletedEntry$1.apply(OpenHashMap.scala:202)
at scala.Iterator$class.foreach(Iterator.scala:414)
at scala.runtime.BoxedArray$AnyIterator.foreach(BoxedArray.scala:45)
at scala.Iterable$class.foreach(Iterable.scala:256)
at scala.runtime.BoxedArray.foreach(BoxedArray.scala:24)
at scala.collection.mutable.OpenHashMap.foreachUndeletedEntry(OpenHashMap.scala:202)
at scala.collection.mutable.OpenHashMap.foreach(OpenHashMap.scala:195)
at sbt.Reflective$.reflectiveMappings(BasicProjectTypes.scala:573)
at sbt.ReflectiveModules$class.reflectiveModuleMappings(BasicProjectTypes.scala:551)
at sbt.BasicScalaProject.reflectiveModuleMappings(DefaultProject.scala:21)
at sbt.ReflectiveModules$class.subProjects(BasicProjectTypes.scala:550)
at sbt.BasicScalaProject.subProjects(DefaultProject.scala:21)
at IdeaProcessor.attemptIdeaProject(IdeaProcessor.scala:16)
at IdeaProcessor$$anonfun$attemptIdeaProject$1.apply(IdeaProcessor.scala:16)
at IdeaProcessor$$anonfun$attemptIdeaProject$1.apply(IdeaProcessor.scala:16)
at scala.Iterator$class.foreach(Iterator.scala:414)
then these lines repeat over and over.
at IdeaProcessor.attemptIdeaProject(IdeaProcessor.scala:16)
at IdeaProcessor$$anonfun$attemptIdeaProject$1.apply(IdeaProcessor.scala:16)
at IdeaProcessor$$anonfun$attemptIdeaProject$1.apply(IdeaProcessor.scala:16)
at scala.Iterator$class.foreach(Iterator.scala:414)
project.properties:
build.scala.versions=2.8.0 2.8.1
SBT Startup:
[info] Building project scalaz 5.1-SNAPSHOT against Scala 2.8.0
Compiler output path:
/Users/jason/code/scalaz/example/target/scala_2.8.0 2.8.1/classes
Expected:
/Users/jason/code/scalaz/example/target/scala_2.8.0/classes
I was unable to get the SBT processor to work using the repo URL in the README; instead I used
*sbtIdeaRaw at http://github.com/mpeltonen/mpeltonen.github.com/raw/master/maven
and everything worked fine. Probably user error, but thought you should know.
I'm trying to use an HttpURLConnection, but idea said it cannot recognize the symbol java when importing java.net.HttpURLConnection
It would be nice if the plugin could (optionally) exclude the "lib_managed" sub directories underneath the module directories...
When building the project in IDEA I don't want to build the SBT project definition. At least not in most cases => Remove the sbt_project_definition module or make it optional defaulting to "not a module"
Issue #32 handled the issue with user libraries. I believe we can do the same for the Scala library. Or is there a reason why this would not work?
Can the plugin add dependencies as "jar directories" rather than "classes"? This would circumvent the need for the idea target to be re-run when the dependencies change.
Now, I am not really an expert in IDEA, but the section that controls the Language Level of the project is in the *.ipr file.
component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK"
output url="file://$PROJECT_DIR$/out"
component
When you run sbt the 'idea' action it will by default set the languageLevel="JDK_1_5" in the IdeaProjectDescriptor class. I could be mistaken, but I think the default for SBT is to consider the java sources as 1.6 language level. If so, it would make sense that the default Language Level was JDK_1_6.
Or maybe there could be a setting/property to specify? As it is now, I have to update and reload the project from IDEA everytime I run the sbt idea action.
I've got the following dependencies in my project:
val slf4j = "org.slf4j" % "slf4j-api" % "1.6.0"
val slf4jsimple = "org.slf4j" % "slf4j-simple" % "1.6.0" % "test"
slf4j-simple has a transitive dependency on slf4j-api.
When I export to idea, both of these dependencies are marked as TEST:
<orderEntry type="module-library" exported=" " scope="TEST">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib_managed/scala_2.8.1/test/slf4j-api-1.6.0.jar!/"></root>
</CLASSES>
<JAVADOC>
</JAVADOC>
<SOURCES>
</SOURCES>
</library>
</orderEntry><orderEntry type="module-library" exported=" " scope="TEST">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib_managed/scala_2.8.1/test/slf4j-simple-1.6.0.jar!/"></root>
</CLASSES>
<JAVADOC>
</JAVADOC>
<SOURCES>
</SOURCES>
</library>
</orderEntry>
They should not be. slf4j-api is a normal compile dependency.
SBT 0.9.6 was released recently and it seems like the release of the stable 0.10 is getting near:
https://groups.google.com/d/topic/simple-build-tool/jU03IhZx-yk/discussion
As such, I'm filing this so that we can keep track of the effort. There is a proof of concept here:
The Scala plugin version 0.3.2039 has been published to the update centre and it includes some changes to the Scala Facet configuration. Odd Muller made the required changes in his fork[1]. I cherry-picked on top of master in my fork[2] and tested it on a multi-module project and it works correctly.
Feel free to pull from wherever it's easier for you.
If one has Java dependencies with sources, it's important to override the outputPath so that sources don't go in the classpath (otherwise javac tries to compile them), see the following comment for the pattern recommended by Mark Harrah::
http://code.google.com/p/simple-build-tool/issues/detail?id=44#c8
This breaks this plugin as it searches the classpath for source jars.
Currently for each JAR from lib_managed a dependency of its own is created. It would be nice to have (optional at least) lib_managed//compile, .../test, etc. as JAR directories.
Hi
current readme says...
class MyProject(info: ProjectInfo) extends ParentProject(info) with IdeaProject
I think it should read...
class MyProject(info: ProjectInfo) extends ParentProject(info) with IdeaPlugin
SBT doesn't really do this part correctly, see http://code.google.com/p/simple-build-tool/issues/detail?id=44
But the plugin could work around this by omitting jars as a direct dependency of module A, if that jar was exported by a module B, where A depends on B.
Alternatively, JAR dependencies could be marks as not 'exported' in the IntelliJ config.
Having the same jar repeated on the classpath leads to annoyances like this error with SLF4J:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/E:/code/analytics/analytics-test-support/lib_managed/scala_2.8.1/compile/logback-classic-0.9.24.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/E:/code/analytics/analytics-utils/lib_managed/scala_2.8.1/compile/logback-classic-0.9.24.jar!/org/slf4j/impl/StaticLoggerBinder.class]
sbt includes resources and test-resources (in target) in the classpath when running classes. The way this is usually modelled in Eclipse is to also include them as output directories. IDEA, however, seems to only support two output directories and those are needed for classes and test-classes.
The only approach I have found is to include resources and test-resources directories as dependencies. I have a patch locally and I'll push it to my repository soon for review.
Directory-based format (.idea) is the default format as it makes it easier to share project settings among team members while using automated tools (like sbt-idea-plugin) to generate certain files. Randall Schulz brought this to my attention in the #scala IRC channel.
To the best of my knowledge and understanding, SBT-IDEA has nothing to go on to create .idea/vcs.xml files and overwriting existing ones that may have been created or edited by IDEA is undesirable.
I would like to have this file not generated or altered by the plug-in.
I just experienced this:
I updated the version my TestNG dependency in the SBT project definition. Additionally I added an "withSources".
Then I ran "sbt update" and "sbt idea" to also refresh the IDEA library setting. However, the plugin did not touch the existing TestNG library configuration in the IDEA module settings.
I had to manually remove the now invalid entry in the module dependencies and run "sbt idea" again for the plugin to really create a new (updated) TestNG dependency.
I'm assuming the current behavior is a bit too conservative... the plugin only checks whether there is already an IDEA library configured for a dependency, but does not check the versions (and additional info like "withSources" or "ideaDocUrl"...
when adding dependencies to my project in project/build/Foo.scala, the resolved dependencies are not added to the idea library and are therefore not found. Workaround is to just add the lib_managed/compile as a jar directory but would be good to have this automated
Manually created Facet configuration, such as the Scala Base Package, should be preserved.
Currently I need to revert changes made to .idea/misc.xml each time I re-run 'idea' to preserve manually entered project configuration that ends up in this file.
This is easy to forget, and requires a second project reload.
RewriteRule and RuleTransformer might be useful to implement this: http://stackoverflow.com/questions/970675/scala-modifying-nested-elements-in-xml/1306415#1306415
I just used the processor to create IDEA project files for a multi module SBT project that is built against 2.8.0 only. But all the compiler output directories contain scala_2.8.0.RC3 in the path, e.g. /Users/hseeberger/projects/petag/petag-db/target/scala_2.8.0.RC3/classes.
title says it all: using IDEA 10.0.2 (free version) with DefaultWebProject, it generates an invalid "Web" facet that doesnt seem to do anythng. Have to remove it from the project every time.
When I run the idea task it resets my project SDK to Java 1.6. This does not exist in the project so all java references break until I fix up my project SDK again.
IDEA supports adding a Documentation URL to dependency libs, a great feature that allows you to move the cursor over any class or method and press Shift-F1 to open a browser at the corresponding API doc page.
So far this only works for Java classes/methods, for some reason the Scala plugin doesn't open attached ScalaDoc API pages (yet). Still, it'd be nice if it was possible to somehow attach a Doc URL to a dependency in the SBT project definition, which the plugin would then convert into the respective IDEA setting.
I'm missing this for example with joda-time (http://joda-time.sourceforge.net/api-release/index.html).
If sbt is running using Scala 2.8.1 it tries to find the dependency:
com.github.mpeltonen#sbt-idea-processor_2.8.1;0.1.0
which does not exist.
This is running under sbt 0.7.5RC0.
I have a multi-module project in which there is one project ("Library") that is depended upon by another project ("User"). "Library" depends on a third-party library for its tests, and "User" on the same library for everything. Rather like this:
import sbt._
class Simple(info: ProjectInfo) extends ParentProject(info) with IdeaProject {
val slf4jVersion = "1.6.1"
val libraryProject = project("library", "library", new Library(_))
val userProject = project("user", "user", new User(_), libraryProject)
class Library(info: ProjectInfo) extends DefaultProject(info) with IdeaProject {
val slf4j = "org.slf4j" % "slf4j-api" % slf4jVersion % "test->default"
}
class User(info: ProjectInfo) extends DefaultProject(info) with IdeaProject {
val slf4j = "org.slf4j" % "slf4j-api" % slf4jVersion
}
}
The generated IML file for the User project does not contain the declared library as a dependency.
If misc.xml is invalid XML (typically because it contains merge markers) and I run 'idea', a SAXParseException is reported.
I suggest to catch exception and report an error with more context; and offer an option to blow away the existing file and recreate from scratch.
When running:
sbt idea
on:
sbt 0.7.3
scala 2.7.7
sbt-idea-plugin latest snapshot
produces:
java.lang.UnsupportedOperationException: unsuitable as hash key
at scala.collection.mutable.Buffer$class.hashCode(Buffer.scala:280)
at scala.collection.mutable.ArrayBuffer.hashCode(ArrayBuffer.scala:26)
at scala.xml.Utility$.hashCode(Utility.scala:263)
at scala.xml.Elem.hashCode(Elem.scala:64)
at scala.collection.mutable.FlatHashTable$class.elemHashCode(FlatHashTable.scala:144)
at scala.collection.immutable.HashSet.elemHashCode(HashSet.scala:39)
at scala.collection.mutable.FlatHashTable$class.containsEntry(FlatHashTable.scala:56)
at scala.collection.immutable.HashSet.containsEntry(HashSet.scala:39)
at scala.collection.immutable.HashSet.$plus(HashSet.scala:60)
at scala.collection.immutable.Set$$anonfun$$plus$plus$1.apply(Set.scala:73)
at scala.collection.immutable.Set$$anonfun$$plus$plus$1.apply(Set.scala:73)
at scala.Iterator$class.foldLeft(Iterator.scala:520)
at scala.runtime.BoxedArray$AnyIterator.foldLeft(BoxedArray.scala:45)
at scala.Iterable$class.foldLeft(Iterable.scala:321)
at scala.runtime.BoxedArray.foldLeft(BoxedArray.scala:24)
at scala.Iterable$class.$div$colon(Iterable.scala:338)
at scala.runtime.BoxedArray.$div$colon(BoxedArray.scala:24)
at scala.collection.immutable.Set$class.$plus$plus(Set.scala:73)
at scala.collection.immutable.HashSet.$plus$plus(HashSet.scala:39)
at scala.collection.immutable.HashSet$.apply(HashSet.scala:26)
at scala.collection.immutable.Set4.$plus(Set4.scala:31)
at scala.collection.immutable.Set$$anonfun$map$1.apply(Set.scala:167)
at scala.collection.immutable.Set$$anonfun$map$1.apply(Set.scala:167)
at scala.Iterator$class.foldLeft(Iterator.scala:520)
at scala.collection.mutable.ResizableArray$$anon$1.foldLeft(ResizableArray.scala:66)
at scala.Iterable$class.foldLeft(Iterable.scala:321)
at scala.collection.immutable.HashSet.foldLeft(HashSet.scala:39)
at scala.collection.immutable.Set$class.map(Set.scala:167)
at scala.collection.immutable.HashSet.map(HashSet.scala:39)
at IdeaModuleDescriptor.content(IdeaModuleDescriptor.scala:35)
at SaveableXml$class.save(SaveableXml.scala:10)
at IdeaModuleDescriptor.save(IdeaModuleDescriptor.scala:4)
at IdeaPlugin$class.createIdeaProject(IdeaPlugin.scala:11)
at LDSProject.createIdeaProject(LDSProject.scala:4)
at IdeaPlugin$$anonfun$idea$1.apply(IdeaPlugin.scala:4)
at IdeaPlugin$$anonfun$idea$1.apply(IdeaPlugin.scala:4)
at sbt.TaskManager$Task.invoke(TaskManager.scala:62)
at sbt.impl.RunTask.doRun$1(RunTask.scala:77)
at sbt.impl.RunTask.runTask(RunTask.scala:85)
at sbt.impl.RunTask.run(RunTask.scala:32)
at sbt.impl.RunTask$.apply(RunTask.scala:17)
at sbt.impl.RunTask$.apply(RunTask.scala:16)
at sbt.Project$class.run(Project.scala:98)
at sbt.Project$class.act(Project.scala:129)
at sbt.BasicScalaProject.act(DefaultProject.scala:21)
at LDSProject.act(LDSProject.scala:50001)
at sbt.xMain$$anonfun$8.apply(Main.scala:487)
at sbt.xMain$$anonfun$8.apply(Main.scala:487)
at sbt.xMain.withAction(Main.scala:520)
at sbt.xMain.sbt$xMain$$handleAction(Main.scala:487)
at sbt.xMain.handleCommand(Main.scala:477)
at sbt.xMain.processAction(Main.scala:418)
at sbt.xMain.process$1(Main.scala:238)
at sbt.xMain.processArguments(Main.scala:247)
at sbt.xMain.startProject(Main.scala:105)
at sbt.xMain.run(Main.scala:82)
at sbt.xMain.run0$1(Main.scala:33)
at sbt.xMain.run(Main.scala:40)
at xsbt.boot.Launch$.run(Launch.scala:51)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:40)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:40)
at xsbt.boot.Launch$.launch(Launch.scala:55)
at xsbt.boot.Launch$.explicit(Launch.scala:40)
at xsbt.boot.Launch$.initialized(Launch.scala:36)
at xsbt.boot.Launch$.parsed(Launch.scala:31)
at xsbt.boot.Launch$.configured(Launch.scala:21)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Launch$.apply(Launch.scala:13)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.run(Boot.scala:19)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
This could either be added to the existing config option (which should be renamed then) or maybe as individual ones.
In sbt you can download dependency with source code via
val dep = "name" % "org" % "ver" withSources
It will be cool for plugin to pickup those sources to Idea.
Iml for ParentProject does not include exclusions defined in 'excluded.folders' property.
I was looking at the source files and they don't seem to include a license. Has it been chosen yet? If not, I think it would be a good idea to do so as it's a requirement for many companies.
SBT uses target/... as output paths. The defaults in IDEA are different, e.g. out/production/...
The plugin should change the IDEA settings for the project to point to target and the modules to point to /target//classes and /target//test-classes
Well, that's not a killer, but it's not nice. Better stick to well recognized standards.
I updated this plugin to the latest version and found it's very good crafted and useful.
Find some minor problems:
If you look at the dependencies for a given module created by this plugin, you will find the module itself as a dependency. That should not be necessary.
Cloning the plugin-repo and running "sbt publish-local" fails with the following error:
[error] Error running deliver-local: sbt.ResolveException: unresolved dependency: com.github.mpeltonen#sbt-idea-core_2.7.7;0.1-SNAPSHOT: java.text.ParseException: [unknown tag project in file:/Users/mathias/.ivy2/cache/com.github.mpeltonen/sbt-idea-core_2.7.7/ivy-0.1-SNAPSHOT.xml.original
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.