Any way not to confuse sbt-eclipse if I just want everything in the top-level folder? (2.2.0 with 0.12.4)
Asked Answered
O

3

6

I'm a high school teacher, and I'm using Scala to teach my Intro to Programming class. It's a little scary, but I'm excited.

However, since these are beginners, I want to give them as simple a project structure as possible. In the beginning, everything will just be at the top level, and at the very beginning, everything will probably be in one .scala file.

Unfortunately, I can't figure out how to convince Eclipse that I don't want src/main/scala, src/test/scala, etc. and not get errors. Here's my best crack at build.sbt so far:

scalaSource in Compile <<= baseDirectory

scalaSource in Test <<= baseDirectory

resourceDirectory <<= baseDirectory

unmanagedSourceDirectories in Compile <<= Seq(scalaSource in Compile).join

unmanagedSourceDirectories in Test <<= Seq(scalaSource in Test).join

Unfortunately, when I run eclipse and refresh, Eclipse complains that there are duplicate entries in the build path and that it can't link to the base directory--which it represents as the absolute path to the project directory, but with hyphens substituted for slashes.

I can fix up the Eclipse project manually, but it'd be great if I could figure out how not to have to do that.

Orazio answered 18/9, 2013 at 3:20 Comment(2)
Oh! I should also mention that I don't have my students use Eclipse. Too complicated. We just use a text editor with Scala syntax coloring. This is just for me when I'm setting up starter code for them. I have a workspace with each of their assignments in it as a separate project.Stauder
+1 for the simple fact that you are teaching high school kids Scala, totally awesome ;-)Yvoneyvonne
T
1

Instead you can go with the scala interpreter and you start as it from the scratch. it will be very basic for the beginners. All the best!!!

Torrey answered 19/9, 2013 at 9:26 Comment(1)
We're starting in the interpreter, and it's a lot of fun. But to make it more fun, I like to provide them with libraries that do stuff with image manipulation and other cool things. I'm sure you're aware that dealing with dependencies and classpath issues is not trivial in Java and Scala. :-) Because Java has been used as a teaching language for several years, there are educational programs that help with these set-up issues. Until Scala gets such things (and I'm working on one), SBT is low-overhead, cross-platform, and not too complicated. (As long as they don't look at build.sbt.)Stauder
V
1

You shouldn't teach things one way for people to later discover it doesn't work in the real world. I see your point, they are beginners, but a folder structure is not the hard part.

Do a step by step, minimum level, but real world intro into things. If they go home and try on their own they have to waste time with build.sbt changes that are for more difficult than a simple General -> Import in Eclipse.

Stick with the standards, if they will learn anything about Scala, they won't have a problem with the folders. My 2 cents.

Vaivode answered 19/9, 2013 at 10:38 Comment(2)
Remember that these are high school students who are very unused to terminal commands. Keeping track of which folder they're in is hard for them. Eventually, we'll get to the normal folder structure, but I'm trying to minimize the possible sources of errors.Stauder
Trust me, it's not that simple. I have a Linux lab, but probably 90% of my students have some flavor of Windows. And even if they understood all those commands (which they will after about 3 weeks), there are three prompts: the shell, the sbt prompt, and the REPL prompt. "I'm typing pwd like you told me, to make sure I'm in the right folder, but it's not working." And then I have to figure out which prompt they're in. And they typed Ctrl-C to copy, but that exited SBT. Multiply that by 30 students in one class.Stauder
M
0

I ran across this problem of having *.scala files in the root directory in another context, and filed this sbteclipse issue.

Misread answered 21/11, 2013 at 18:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.