Setup sbt to submit assignment

1,314 views
Skip to first unread message

Richard Kuo

unread,
Sep 25, 2012, 12:53:10 AM9/25/12
to scala-c...@googlegroups.com
hi, 
I got my assignment done in Eclipse without using sbt (it took me a while to set it up). My test was done with embedded codes. They are not pretty, but they all work. When I was ready to submit, I realized I need to use sbt, styleChech, ... and ScalaTest(still need to learn). 

I followed the steps in

but they all show how to import from exist project.  I still could not get it right. How to create a project with all hooks to test  and to submit? Can I just copy build.sbt in example and modify it? or ...?

Can I get some help? Thank you in advance.

Richard

Pankaj Gupta

unread,
Sep 25, 2012, 2:06:09 AM9/25/12
to scala-c...@googlegroups.com
Hi Richard,

I think the example project comes with sbt build file. All you need to do is go to the recfun folder from terminal and type sbt. From there you can do the following:

> test

for running your tests

> styleCheck
for running style check

> submit email passcode
to submit the assignment.

Hope this helps.

Pankaj
--
You received this message because you are subscribed to the Google Groups "Scala discussion based on Coursera" group.
To unsubscribe from this group, send email to scala-courser...@googlegroups.com.
Visit this group at http://groups.google.com/group/scala-coursera?hl=en.
 
 

Richard Kuo

unread,
Sep 25, 2012, 3:57:49 AM9/25/12
to scala-c...@googlegroups.com
Pankaj,
I guess I did not ask my question correctly. I am not talking about the example itself. Let me try it again;

How do I setup my SBT environment for each problem, so I can enter my assignment code/answer, for example-pascal triangle, in SBT environment? I have my code run in Eclipse and worked. But the source code has to under SBT project structure.

Or, in other word, how do create a SBT project for the assignment that can do "test", "submit"?  

Richard

Richard Kuo

unread,
Sep 25, 2012, 4:30:47 AM9/25/12
to scala-c...@googlegroups.com
Pankaj,
I know this is very stupid question, no one even asked in general forum site and many people submitted assignments back already. How do I create a directory structure with all settings (the screenshot below is for the example), so I can start my coding? 

Inline image 1
I know source code is under src/main/scala. Where can I get a build.sbt? what did I missed? Thank you.

Richard
image.png

Robert Kohlenberger

unread,
Sep 25, 2012, 5:37:54 AM9/25/12
to scala-c...@googlegroups.com
Richard,

I also tried to shortcut the install process, since I already had Eclipse installed with my own prefs, plugins, etc.  But that "shortcut" led to unexpected problems later.

My advice: install everything from scratch for your course work.  It's actually less trouble than trying to upgrade an existing Eclipse installation.  Do this:

1. Download the clean TypeSafe supplied version of Eclipse with the plugins and settings you need, from: http://typesafe.com/stack/scala_ide_download .  Unpacking this creates a folder called "eclipse 2" with the app inside.  (This gives you the cool new Scala Worksheet as well!)

2. Create a fresh workspace folder.  Copy your projects, such as "recfun", into the new workspace.

3. Open the newly installed Eclipse app and choose your new workspace.  Once Eclipse opens, choose File > Import... > General > Existing Projects into Workspace.  At "Select root directory" click "Browse...", and select the new project folder copied in step 2.  Click "Open".  Click "Finish".

4. Try running your unit tests from Eclipse to check that Import worked.  For project "recfun" these are in src/test/scala/recfun from the Package Explorer.  Part of the homework is to add to these test cases, so you do need ScalaTest (installed in step 1).

5. Setup instructions for sbt are pretty complete at: https://class.coursera.org/progfun-2012-001/wiki/view?page=ToolsSetup .  Note that the Mac instructions assume that your default Unix shell, the one used by the Terminal app, is Bash.  If it is not, or you're not sure, open System Preferences > Users & Groups, and click the lock icon in the lower left to authenticate.  Right-click the current user and select "Advanced Options...", then be sure the "Login shell" shows "/bin/bash".  Click OK, close System Preferences.  Edit your .bash_profile file as described in the Setup instructions.  My profile has these additional lines (you must change "/PATH/TO/YOUR" to the correct path!):
export SCALA_HOME="/PATH/TO/YOUR/scala-2.9.3"
export PATH=$PATH:$SCALA_HOME/bin
export PATH=/PATH/TO/YOUR/sbt/bin:$PATH

6. (Mac only).  If you are annoyed by a popup window in Eclipse that flashes quickly before your eyes, it may be that you need to tell the Firewall to allow incoming connections for the new Eclipse installation.  Open System Preferences > Security & Privacy > Firewall, and click the lock icon in the lower left to authenticate.  Then click "Firewall Options..." and click the "+" button to add the new Eclipse app to the list.

Hope this helps,
 - Bob

"Hurry along as fast as you can and never take no cutoffs." - Virginia Reed (Donner Party), May 16, 1847

On Sep 24, 2012, at 9:53 PM, Richard Kuo wrote:

Richard Kuo

unread,
Sep 25, 2012, 12:11:28 PM9/25/12
to scala-c...@googlegroups.com
Bob,
Thanks a lot. I will give it try after a few office stuff out of way. 2:30am in the morning; you worked late.

Richard

Richard Kuo

unread,
Sep 25, 2012, 6:53:42 PM9/25/12
to scala-c...@googlegroups.com
Silly me, with Bob's help, I found out where was my problem. I got confused with "example.zip" and "progfun-recfun".  I guess I have to read the instruction closely, no jumping around. 

I am trying to learn how to use ScalaTest and hopefully I can submit my answer with sbt soon. :-)

Richard Kuo

unread,
Sep 25, 2012, 10:39:17 PM9/25/12
to scala-c...@googlegroups.com
No kidding, I successfully submitted my first assignment and got 9.44 back :-) That is pretty good for me. I did not use tailrec yet. I will learn it in next few days. 

This is cool, I am only two days behind. Thanks for everyone's help. 

Pankaj Gupta

unread,
Sep 27, 2012, 12:49:41 AM9/27/12
to scala-c...@googlegroups.com
Hey Richard,

Good to know that you were able to submit the assignment. 

Richard Kuo

unread,
Sep 27, 2012, 1:26:48 AM9/27/12
to scala-c...@googlegroups.com
Thank you. 
Started the second assignment. I need to beef up my set theory first and hoping to have some discussion tomorrow.
Message has been deleted

Aishwarya Singh

unread,
May 5, 2018, 6:43:20 AM5/5/18
to Scala discussion based on Coursera
hey  richard
 i am facing the same problem in submitting my assignment in coursera , can you please help me out ?
i m using sbt 1.1.4 and scala 2.12.4 and eclipse scala ide 4.7 . when i tried submit command in sbt ,it showed error.Please help me out .
Thanks in advance .
Reply all
Reply to author
Forward
0 new messages