Not compiling code for imported source because of excessive source exclusions
I downloaded the source for the spray library from https://github.com/spray/spray/zipball/master and extracted it into ~/api/src
I then created a new Scala project in Eclipse and pointed to the existing source location for the spray-base project, ~/api/src/spray-spray-4004c23/spray-base
(which have no .project or .classpath file from the spray distro)
Initially, ScalaIDE listed too many source folders, including several nested in others (see attached image) so I removed
and left these top level source folders
Output folder is spray-base/bin
Note also the error not finding object scala
I finished the import.
I then cleaned the project but this still had not added the Scala library like the dialog implied so I added it manually.
Nothing was being compiled. I opened the .classpath file and found that ScalaIDE was excluding the subdirectories:
so nothing was being compiled - the spray-base/bin directory is empty.
I removed the exclusions by updating the Build Path and then things compiled, so there is a workaround, but initial project setup seems incorrect
when it lists subdirectories of src/main/scala as well as src/main/scala
[luc] for some reason, the new Scala project wizard doesn't correctly configure the source folders when creating from an existing project structure.
I then created a new Scala project in Eclipse and pointed to the existing source location for the spray-base project, ~/api/src/spray-spray-4004c23/spray-base
(which have no .project or .classpath file from the spray distro)
Initially, ScalaIDE listed too many source folders, including several nested in others (see attached image) so I removed
- src/main/scala/cc/spray
- src/main/scala/cc/spray/http
- src/test/scala/cc/spray
- src/test/scala/cc/spray/http
and left these top level source folders
- /src/main/scala
- /src/test/scala
Output folder is spray-base/bin
Note also the error not finding object scala
I finished the import.
I then cleaned the project but this still had not added the Scala library like the dialog implied so I added it manually.
Nothing was being compiled. I opened the .classpath file and found that ScalaIDE was excluding the subdirectories:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="cc/spray/http/|cc/spray/" kind="src" path="src/main/scala"/>
<classpathentry excluding="cc/spray/http/|cc/spray/" kind="src" path="src/test/scala"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
so nothing was being compiled - the spray-base/bin directory is empty.
I removed the exclusions by updating the Build Path and then things compiled, so there is a workaround, but initial project setup seems incorrect
when it lists subdirectories of src/main/scala as well as src/main/scala
[luc] for some reason, the new Scala project wizard doesn't correctly configure the source folders when creating from an existing project structure.
Leave a comment
Screen shot showing nested source
Thanks for the really detailed report.
Creating Scala project from existing sources is indeed not working as expected.
Spray is a sbt project, so in this case the best solution is to use sbteclipse to generate the Eclipse files.
To do that, add the given config line to project/plugins.sbt.
Then load the project using
Creating Scala project from existing sources is indeed not working as expected.
Spray is a sbt project, so in this case the best solution is to use sbteclipse to generate the Eclipse files.
To do that, add the given config line to project/plugins.sbt.
Then load the project using
file > import > existing project in workspace
.
on 2012-04-20 15:52 *
By David Biesack
Yup, I've done that. Still having some difficulties. I.e. all the spray projects now load OK in Scala IDE
but when I try to create a new project that uses spray-client I get an error (in the Eclipse Problems view)
class file needed by HttpConduit is missing. reference value actor of package akka refers to nonexisting symbol. Sandbox.scala /spray-client-test/src/main/scala/com/sas/tools/api/sandbox line 8 Scala Problem
ScalaIDE resolves HttpConduit but not akka.actor
does ScalaIDE or sbteclipse provide any way to get transitive dependencies from another project - i.e.
to have my sandbox project get all the dependencies from spray-client ?
but when I try to create a new project that uses spray-client I get an error (in the Eclipse Problems view)
class file needed by HttpConduit is missing. reference value actor of package akka refers to nonexisting symbol. Sandbox.scala /spray-client-test/src/main/scala/com/sas/tools/api/sandbox line 8 Scala Problem
ScalaIDE resolves HttpConduit but not akka.actor
does ScalaIDE or sbteclipse provide any way to get transitive dependencies from another project - i.e.
to have my sandbox project get all the dependencies from spray-client ?
on 2012-05-08 13:37 *
By skyluc
Description changed from I downloaded the source for... to I downloaded the source for...
Hi David,
sbt-eclipse doesn't setup the project in such a way that they can be directly used as dependencies.
sbt-eclipse doesn't expect this use, so it doesn't setup the transitive dependencies.
My advice would be to not try to create your application against the spray sources, but to use maven or sbt to pull the correct dependencies for you. For sbt, they provide a template for spray-server (https://github.com/spray/spray-template), but no stand alone config for spray-client. The dependency string seems to be
If you want to continue with the source, open the properties of the spray-client project > Java Build Path > Order and Export, and check the box next to akka-actor-2.0.jar
sbt-eclipse doesn't setup the project in such a way that they can be directly used as dependencies.
sbt-eclipse doesn't expect this use, so it doesn't setup the transitive dependencies.
My advice would be to not try to create your application against the spray sources, but to use maven or sbt to pull the correct dependencies for you. For sbt, they provide a template for spray-server (https://github.com/spray/spray-template), but no stand alone config for spray-client. The dependency string seems to be
"cc.spray" %% "spray-can" % "1.0-M1"
from the repository http://repo.spray.cc/.If you want to continue with the source, open the properties of the spray-client project > Java Build Path > Order and Export, and check the box next to akka-actor-2.0.jar
on 2012-10-10 12:36 *
By Mirco Dotta
Eclipse version changed from Helios to All
Milestone changed from Helium to Backlog