HelloWorld example (sbt new sbt/scala-seed.g8) not working
After having installed sbt version 0.13.13 (with brew) on Mac 10.12.2 with scala 2.12.0, I tried the first example on the documentation (as per subject sbt new sbt/scala-seed.g8
).
The result is:
... [info] Set current project to hello (in build file:/scratch/hello/) SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. org.eclipse.jgit.api.errors.TransportException: http://github.com/sbt/scala-seed.g8.git: 301 Moved Permanently at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139) ...
I'm absolutely new on sbt, just wondering if this is an issue due to my inexperience...
I had the same issue. Even if you can access http://github.com/sbt/scala-seed.g8.git , your git 9418 port may still be blocked when using sbt or g8. Try running the line below at the command line. It will switch the port that git uses to https:// which is usually not blocked.
git config --global url."https://".insteadOf git://
It simply adds the following lines to your .gitconfig
[url "https://"] insteadOf = git://
so you can easily remove it if that is not the issue.
HelloWorld example (sbt new sbt/scala-seed.g8) not working, After having installed sbt version 0.13.13 (with brew) on Mac 10.12.2 with scala 2.12.0, I tried the first example on the documentation (as per� $ sbt new sbt/scala-seed.g8 . Minimum Scala build. name [My Something Project]: hello Template applied in ./hello When prompted for the project name, type hello. This will create a new project under a directory named hello. Running your app . Now from inside the hello directory, start sbt and type run at the sbt shell. On Linux or OS X the
Run it passing as a parameter the git url:
sbt new https://github.com/sbt/scala-seed.g8
There is no need of changing any git configuration.
scala/scala-seed.g8: Giter8 template for a simple hello , Giter8 template for a simple hello world app in Scala. - scala/scala-seed.g8. README.md. This is a Giter8 template for Scala. sbt new scala/scala-seed.g8� Giter8 template for a simple hello world app in Scala. - scala/scala-seed.g8
git clone http://github.com/scala/hello-world.g8.git
mv ./hello-world.g8/src/main/g8 hello-world
cd hello-world
sbt run
(assuming you have git setup)
sbt Reference Manual — sbt new and Templates, Normally the exact version for the sbt launcher does not matter because it will use sbt new scala/scala-seed.g8 . name [hello]: Template applied in . for Scala); scala/hello-world.g8 (A template to demonstrate a minimal Scala application) end of the command, so for example to specify a particular branch you can use: Giter8 template for a simple hello world app in Scala. - sbt/scala-seed.g8
Try using
sbt new scala/scala-seed.g8
A predefined template in git is required, but when you use one of the sample templates from git, it will create an sbt project with minimum scala build. And to name the project, the predefined templates usually provide you with an option to do so.
sbt Reference Manual — Hello, World, sbt new sbt/scala-seed.g8 . Minimum Scala build. name [My Something Project ]: hello Template applied in ./hello [info] Running example.Hello hello. .sbt build with .scala files example .sbt builds can be supplemented with project/*.scala files. When the build file gets large enough, the first thing to factor out are resolvers and dependencies.
I would like to share my experience:
I wanted to run sbt new scalatra/scalatra.g8
and was facing error
"git@github.com:scalatra/scalatra.g8.git: invalid privatekey: [...."
How fixed it ?
mkdir temp cd temp git clone https://github.com/foundweekends/giter8.g8 g8 file://giter8.g8
Now it's working and printing
Creates a Giter8 project template. name [My Template Project]:
Hopefully it will save someone's time.
HelloWorld example (sbt new sbt / scala -seed.g8) does not work , Run it as a git url parameter: sbt new https://github.com/sbt/scala-seed.g8. No need to change git configuration. sbt new and Templates . sbt 0.13.13 adds a new command called new, to create new build definitions from a template. The new command is extensible via a mechanism called the template resolver. Trying new command . First, you need sbt’s launcher version 0.13.13 or above.
sbt:foo-build> help about Displays basic information about sbt and the build. tasks Lists the tasks defined for the current project. settings Lists the settings defined for the current project. reload (Re)loads the current project or changes to plugins project or returns from it. new Creates a new sbt build.
play-scala-seed.g8. Giter8 template for generating a Play project seed in Scala. This project is intended for people who know how to use Play and want to get started right away.
sbt 1.1.1 adds a new global Boolean setting called autoStartServer, which is set to true by default. When set to true, sbt shell will automatically start sbt server. Otherwise, it will not start the server until startSever command is issued. This could be used to opt out of server for security reasons. #3922 by @swaldman. Contributors
Comments
- You can ignore the slf4j warning but the error seems to indicate a network problem? Are you connected to the internet? Are you working with a proxy?
- yes, I am connected to the internet, no proxy, and the machine can access the URL github.com/sbt/scala-seed.g8.git
- The URL provided redirects to a secure connection (
https
) and it looks like thejgit
client isn't handling this correctly. This looks a lot like a bug in the git client. - @jkinkead not sure, unless
jgit
is different fromgit
. I've testedgit
, and can clone repositories from the http URL without problem - I'm seeing the same issue on ubuntu 14.04 with git version 1.9.1
- Thanks but nope, port is not blocked and changing the port with your suggestion does not help...
- I meet the same error, this method works for me, thanks : )
- sorry for the delay:)
- Thanks! I have proxies preventing me from
sbt new
, this is the only way I can get it work - Please format all code examples with code formatting