52-technologies-in-2016
52-technologies-in-2016 copied to clipboard
Feedback: Week 2 sbt blog
Please provide your feedback by posting a comment against this issue.
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 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 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 cool. I would be happy to contribute my blog. Thanks :)
Enjoy your posts, thanks for them. Would it be possible to show how to use SBT for a package hosted on Github?
@josep2 thanks for your feedback. I will add a tip for this.
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 Glad you found it useful. I will add a section on writing SBT plugins.
Very useful introduction to important concepts in Sbt. Thanks
Excellent introduction. Very helpful!
Hi,
In tips, for cross compiler platform
is it otherScalaVersions
or crossScalaVersions
??
Using otherScalaVersions
gave an error
I'm using sbt 0.13.11
Thanks @munendrasn for feedback. You are right it should be crossScalaVersions
. I have fixed the blog. Cheers.
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.
Thank you! I'm learning Scala and was a bit confused about how this sbt thing fit in. This post was super helpful.
Great work with your SBT tutorial!
fantastic. very helpful.
awesome! very simple but covers all the necessary topics. Thanks!
This tutorial was super helpfull for me grasping SBT. I liked the follow-along style. Thank you for your work 👍
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.
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"
}
}
-
.lineStream
instead of deprecated.lines
-
Process
easily throws exceptions...try
makes task better.
Thanks a lot for this post.
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.
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!
Thanks a lot for this post. I was looking for something like this to get an overview of SBT. It really helped.
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.