1

I use SBT 0.13.0.

UPDATE it turned out that I've been using SBT 0.12.2 in the project (that I checked with sbt sbt-version and used sbt --version before).

With the following build.sbt SBT can't seem to be able to fetch the sbt-start-script plugin/dependency:

version := "0.1"

resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"

scalaVersion := "2.10.2"

libraryDependencies ++= Seq(
  "play" % "play_2.10" % "2.1.0",
  "org.mongodb" %% "casbah" % "2.6.3",
  "com.github.nscala-time" %% "nscala-time" % "0.8.0",
  "org.twitter4j" % "twitter4j-stream" % "3.0.5"    
)

resolvers += Classpaths.typesafeResolver

addSbtPlugin("com.typesafe.sbt" % "sbt-start-script" % "0.10.0")

When I run sbt clean compile stage I get the following error:

[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]      com.typesafe.sbt:sbt-start-script:0.10.0 (sbtVersion=0.13, scalaVersion=2.10)
[warn]
sbt.ResolveException: unresolved dependency: com.typesafe.sbt#sbt-start-script;0.10.0: not found

2 Answers 2

1

You should move the line

addSbtPlugin("com.typesafe.sbt" % "sbt-start-script" % "0.10.0")

into its own project/plugins.sbt file (as is also described in Details of the plugin's documentation). This way the plugin gets added to the project's installed plugins (via addSbtPlugin method call).

In the same documentation, there's the section Consider sbt-native-packager instead that says:

The more general native-packager plugin may replace this one in the future: https://github.com/sbt/sbt-native-packager

build.sbt should be as follows (it's only valid to get the plugin run successfully - I have not checked the other settings like libraryDependencies):

import com.typesafe.sbt.SbtStartScript

version := "0.1"

resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"

scalaVersion := "2.10.2"

libraryDependencies ++= Seq(
  "play" % "play_2.10" % "2.1.0",
  "org.mongodb" %% "casbah" % "2.6.3",
  "com.github.nscala-time" %% "nscala-time" % "0.8.0",
  "org.twitter4j" % "twitter4j-stream" % "3.0.5"
)

seq(SbtStartScript.startScriptForClassesSettings: _*)

With the build.sbt and project/plugins.sbt in place, when you run sbt shell you should be able to generate start script for the project.

jacek:~/sandbox/so/sbt-start-script
$ sbt
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Loading project definition from /Users/jacek/sandbox/so/sbt-start-script/project
[info] Updating {file:/Users/jacek/sandbox/so/sbt-start-script/project/}sbt-start-script-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] downloading http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-start-script/scala_2.10/sbt_0.13/0.10.0/jars/sbt-start-script.jar ...
[info]  [SUCCESSFUL ] com.typesafe.sbt#sbt-start-script;0.10.0!sbt-start-script.jar (2725ms)
[info] Done updating.
[info] Set current project to sbt-start-script (in build file:/Users/jacek/sandbox/so/sbt-start-script/)
[sbt-start-script]> start-script
[info] Updating {file:/Users/jacek/sandbox/so/sbt-start-script/}sbt-start-script...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] downloading http://repo1.maven.org/maven2/com/github/nscala-time/nscala-time_2.10/0.8.0/nscala-time_2.10-0.8.0.jar ...
[info]  [SUCCESSFUL ] com.github.nscala-time#nscala-time_2.10;0.8.0!nscala-time_2.10.jar (712ms)
[info] downloading http://repo1.maven.org/maven2/org/twitter4j/twitter4j-stream/3.0.5/twitter4j-stream-3.0.5.jar ...
[info]  [SUCCESSFUL ] org.twitter4j#twitter4j-stream;3.0.5!twitter4j-stream.jar (441ms)
[info] downloading http://repo1.maven.org/maven2/org/mongodb/casbah-commons_2.10/2.6.3/casbah-commons_2.10-2.6.3.jar ...
[info]  [SUCCESSFUL ] org.mongodb#casbah-commons_2.10;2.6.3!casbah-commons_2.10.jar (539ms)
[info] downloading http://repo1.maven.org/maven2/org/mongodb/casbah-core_2.10/2.6.3/casbah-core_2.10-2.6.3.jar ...
[info]  [SUCCESSFUL ] org.mongodb#casbah-core_2.10;2.6.3!casbah-core_2.10.jar (618ms)
[info] downloading http://repo1.maven.org/maven2/org/mongodb/casbah-query_2.10/2.6.3/casbah-query_2.10-2.6.3.jar ...
[info]  [SUCCESSFUL ] org.mongodb#casbah-query_2.10;2.6.3!casbah-query_2.10.jar (553ms)
[info] downloading http://repo1.maven.org/maven2/org/mongodb/casbah-gridfs_2.10/2.6.3/casbah-gridfs_2.10-2.6.3.jar ...
[info]  [SUCCESSFUL ] org.mongodb#casbah-gridfs_2.10;2.6.3!casbah-gridfs_2.10.jar (462ms)
[info] downloading http://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/2.11.3/mongo-java-driver-2.11.3.jar ...
[info]  [SUCCESSFUL ] org.mongodb#mongo-java-driver;2.11.3!mongo-java-driver.jar (605ms)
[info] downloading http://repo1.maven.org/maven2/org/twitter4j/twitter4j-core/3.0.5/twitter4j-core-3.0.5.jar ...
[info]  [SUCCESSFUL ] org.twitter4j#twitter4j-core;3.0.5!twitter4j-core.jar (523ms)
[info] Done updating.
[info] Wrote start script for mainClass := None to /Users/jacek/sandbox/so/sbt-start-script/target/start
[success] Total time: 21 s, completed Feb 15, 2014 9:43:42 PM
3
  • Thank you! It turned out that I had SBT version 0.12.2. I used your suggestion but changed the library to match my sbt version. What was throwing me me of is: $ sbt --version sbt launcher version 0.13.1 $ sbt sbt-version [info] 0.12.2
    – Greg R
    Feb 16, 2014 at 20:18
  • sbtVersion is set in project/build.properties. It can be as high as the version of the launcher (which in your case could be 0.13.2-M1). Feb 16, 2014 at 22:10
  • Good point! I did do that when testing the solution by Sari HH
    – Greg R
    Feb 17, 2014 at 4:26
0

For Play 2.1.0.

In project/build.properties use:

sbt.version=0.12.2

In project/plugins.sbt use:

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

addSbtPlugin("play" % "sbt-plugin" % "2.1.0")

In project/Build.scala use:

import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {
    val appName         = "your_app_name"
    val appVersion      = "1.0"

    val appDependencies = Seq(
        // project dependencies
    )

    val main = play.Project(appName, appVersion, appDependencies).settings(
        // project settings
    )
}

It remains a good idea to clear the content of your .ivy2 cache which you can find on your system drive. Then do:

play clean-all
play compile
play ~run
2
  • No dice. Got the following: [error] (*:update) sbt.ResolveException: unresolved dependency: play#sbt-plugin;2.1.0: not found [error] unresolved dependency: com.typesafe.sbt#sbt-start-script;0.10.0: not found
    – Greg R
    Feb 15, 2014 at 3:23
  • Thanks, I actually don't have a play project. I just have play as a dependency for working with JSON
    – Greg R
    Feb 16, 2014 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.