Create g8 Template From a Git Remote Project

100 views Asked by At

I have a sbt g8 template that I customized for my projects and this is located as one of the sub project in a multi module scala sbt project which is assigned to my organization. For example.,

main-project
  - projec1
  - sbt-template-project.g8
  - some-other-project

The main-project is available in my git repo and I would like to know how I can create a project from the sbt-template-project? I tried the following, but it says "Template Not Found":

sbt new file:https://github.com/my-organization/main-project/tree/master/sbt-template-project.g8

I also tried:

sbt new file:https://github.com/my-organization/main-project/sbt-template-project.g8

I also tried:

sbt new https://github.com/my-organization/main-project/sbt-template-project.g8

What is the correct way to generate the project out of the template?

EDIT: I even tried the following:

sbt new my-organization/main-project -d sbt-template-project-g8

Even that is failing with the message "Template not found"

1

There are 1 answers

0
Mateusz Kubuszok On BEST ANSWER

Your flow is basically not supported - see: http://www.foundweekends.org/giter8/template.html - Giter8 (and sbt new) support only GitHub repositories where the template in either in the root directory or in src/main/g8.

Your best option is to git clone it manually and then call sbt new passing path to the subdirectory:

git clone https://github.com/my-organization/main-project tmp-template-dir
sbt new file://tmp-template-dir/sbt-template-project.g8
rm -rf tmp-template-dir

It is important that the directory name end with .g8.