How do you share your Scala project on Intellij?


I have GitHub integration and Scala plugin enabled on my Intellij Ultimate. All I want to do is to create a Scala project and be able to publish it on to GitHub so that my collaborators can check out the project using their Intellij (with the same config as mine). I do the following steps. What am I doing wrong?

  1. Click "Create New Project" on Intellij Welcome window

  2. Select "Scala Module" and set the Scala home. I called my project "Test" --> Project is now setup

  3. Create a Test.scala file. This will represent my project for now.

  4. Create a .gitignore file with the following entries. (Note that I ignore *.iml and .idea because they may be different for different users and they change frequently, i.e. the .iml file and the content of the .idea folder change frequently)

    *.iml .DS_Store .idea

  5. Publish the project via VCS --> Import into Version Control --> Share project on GitHub

  6. Add the Test.scala file and the .gitignore file to be committed and pushed.

  7. Commit & push. It's successful.

---- Problem starts here ----

On a different machine (that has Intellij with the same config)

  1. Click "Check out from Version Control" on Intellij Welcome pane. Select GitHub

  2. Select the remote repository to check out and the directory name for the local repository.

  3. Intellij prompts "Would you like to create an Intellij IDEA project for the sources you have checked out to /Users/platypus/IdeaProject/Test?" Click "Yes"

  4. Select the SDK

  5. Click "Next" on "Import Project from Existing Sources"

  6. Intellij displays, "Source files for your project not found." When you click finish, on the left/navigation pane, you see no Test.scala or .gitignore files.

How do you share your Scala project with others on GitHub using Intellij??

I would not check-in IntelliJ specific (or eclipse specific) files at all, why limit the contributors to a specific IDE? and why limit them to specific settings? I think you have 2 main choices that will allow any collaborator to work on the project while making the configuration overhead of a new contributor to a minimum.

  1. Maven - although for Scala projects sbt is more idiomatic, maven is ubiquitous, supported by all major IDEs - and doens't even require to have an IDE

  2. SBT - although it has less "mainstream" support in IDEs it can create the project files for you using plugins (e.g. see this question: How to create SBT project with IntelliJ Idea?)

I would recommend #1 - start with a new Maven project, and add a Scala nature, you can create it from an archtype so scala compilation is supported from maven command line (see this for example)