52-technologies-in-2016 icon indicating copy to clipboard operation
52-technologies-in-2016 copied to clipboard

Feedback: Week 2 sbt blog

Open shekhargulati opened this issue 9 years ago • 24 comments

Please provide your feedback by posting a comment against this issue.

shekhargulati avatar Jan 10 '16 13:01 shekhargulati

Hi Shekhar,

I really like your introduction to SBT! I'm working on a fork of scala-lang.org, which focuses on being more beginner-friendly. (http://get-scala.org) and I wonder whether you might contribute your introduction as a starting point for an SBT page?

You will be credited as the author. The existing license of the scala-lang repo seems to be revised-BSD – would it be acceptable to license it that way (your repo uses MIT)? (I think both are perfectly fine, I just want to avoid having multiple licenses, that's why I ask.)

Thanks!

Simon

soc avatar Jan 13 '16 00:01 soc

@soc I don't mind get-scala.org using my content as the starting point. What I don't want is in future if I use my content say in a book then it violates get-scala.org license?

shekhargulati avatar Jan 16 '16 12:01 shekhargulati

@shekhargulati No no no! You of course keep your copyright, it's still your content! Giving a license for the get-scala site doesn't prevent you from doing whatever you want with your content in the future! :-)

soc avatar Jan 16 '16 17:01 soc

@soc cool. I would be happy to contribute my blog. Thanks :)

shekhargulati avatar Jan 17 '16 09:01 shekhargulati

Enjoy your posts, thanks for them. Would it be possible to show how to use SBT for a package hosted on Github?

josep2 avatar Feb 01 '16 19:02 josep2

@josep2 thanks for your feedback. I will add a tip for this.

shekhargulati avatar Feb 02 '16 04:02 shekhargulati

Your SBT blog is one of the easiest one I have read about sbt. I was having many confusions before, even though I have been working on scala for over a year. Can you also give brief details on how to build sbt plugins as well.?

yadavan88 avatar Feb 02 '16 09:02 yadavan88

@yadavan88 Glad you found it useful. I will add a section on writing SBT plugins.

shekhargulati avatar Feb 02 '16 16:02 shekhargulati

Very useful introduction to important concepts in Sbt. Thanks

raghavan20 avatar Jun 07 '16 00:06 raghavan20

Excellent introduction. Very helpful!

batla avatar Jun 29 '16 01:06 batla

Hi, In tips, for cross compiler platform is it otherScalaVersions or crossScalaVersions?? Using otherScalaVersionsgave an error I'm using sbt 0.13.11

munendrasn avatar Jul 12 '16 14:07 munendrasn

Thanks @munendrasn for feedback. You are right it should be crossScalaVersions. I have fixed the blog. Cheers.

shekhargulati avatar Jul 12 '16 20:07 shekhargulati

Just one minor mistake: "To run the test you can execute the run task." -> you mean test task, right? Anyway very good introduction.
It would be nice to see also more about sub-projects and more complicated tasks. Something like a task for restoring production database backup in your local environment (or other things you usually have to do manually).
Thanks and have a nice day.

Juraj-Masiar avatar Jul 28 '16 08:07 Juraj-Masiar

Thank you! I'm learning Scala and was a bit confused about how this sbt thing fit in. This post was super helpful.

eyspahn avatar Dec 17 '16 01:12 eyspahn

Great work with your SBT tutorial!

JSPolania avatar Feb 01 '17 14:02 JSPolania

fantastic. very helpful.

dkdubey avatar Jun 09 '17 15:06 dkdubey

awesome! very simple but covers all the necessary topics. Thanks!

tokiwadai avatar Aug 14 '17 02:08 tokiwadai

This tutorial was super helpfull for me grasping SBT. I liked the follow-along style. Thank you for your work 👍

invad0r avatar Aug 15 '17 10:08 invad0r

I wanted to say thanks for this excellent introduction to sbt. Well written and easy to understand!

One thought was that it would have been better to make an example application which didn't use the same nomenclature as sbt. I.e. both have tasks. Wasn't that confusing, but I did have one moment when I had to scroll back up to see if we were talking about the tasky application or how to start writing sbt tasks.

dpwrussell avatar Sep 10 '17 22:09 dpwrussell

Coursera's materials refer to this post. I followed it step by step. It will be good to update.

Versions

scalaVersion := "2.12.4"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test"
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
addSbtPlugin("net.virtual-void" %% "sbt-dependency-graph" % "0.9.0")

Process

import scala.sys.process.Process // it tries to use Java's first
// ...
gitCommitCountTask := {
  try {
    val branch = Process("git symbolic-ref -q HEAD").lineStream.head.replace("refs/heads/","")
    val commitCount = Process(s"git rev-list --count $branch").lineStream.head
    println(s"total number of commits on [$branch]: $commitCount")
    commitCount
  } catch {
    case _: Throwable => println("Can't count commits. Probably that's not a git repo yet.")
    "Can't count commits"
  }
}
  1. .lineStream instead of deprecated.lines
  2. Process easily throws exceptions... try makes task better.

Thanks a lot for this post.

vladimirlogachev avatar Nov 04 '17 05:11 vladimirlogachev

Great post! Thanks a lot! I use IntelliJ IDEA IDE and have done following the post. Here is some notes:

In Add Dependencies section, I encountered: "java.lang.NoClassDefFoundError: scala/Product$class". It might be the version of scalatest doesn't support the scala version. Try to update the version number.

In sbt shell, we need to use 'sbt /<task_name>' to run the tasks. There is a '/' in here.

chien-wei avatar Feb 18 '19 15:02 chien-wei

Super grateful for this awesome summary. My 3rd day learning Scala and it's really good when experiences are documented like this so I don't have to spend months discovering by myself!

kipkosgeik avatar Feb 19 '19 08:02 kipkosgeik

Thanks a lot for this post. I was looking for something like this to get an overview of SBT. It really helped.

Srikanth-Nalam-510 avatar Oct 08 '19 05:10 Srikanth-Nalam-510

Hi Shekhar, it's refreshing to see a blog related to Scala that easy to understand and not loaded with terms that mean little to beginners. I found this blog very easy to read and there are definitely some things that I'm going to use going forward. Thanks, we [the community] needs more blogs like this.

macgrewal avatar Jul 11 '21 11:07 macgrewal