Scala on IntelliJ with Git: How should the .gitignore look like?

scala intellij gitignore
sbt gitignore
angular gitignore
gitignore helper
firebase gitignore
gitignore template
gitignore docker
gitignore-cli

Note: This question is specific to Scala projects. I want to have Scala compile and run successfully from inside IntelliJ without any prior configuration.

I have created a test project containing Scala examples using IntelliJ IDEA and published it to GitHub.

The project structure looks like this:

My current .gitignore looks like this:

*.class
*.log
target/
.idea/
project/

This results in a repository that looks like this:

Now for what I am trying to do:

Having Scala example code is cool, but I want to also use this project as a template for Scala projects with IntelliJ.

So, how should I best change my .gitignore file, so whenever I clone the project, I can open it with IntelliJ and have everything in working order? This, of course, excludes target directories, so I need to recompile the project whenever I clone it.

Assuming that you're using SBT to build your project in IntelliJ, you should filter out the following directories:

project/target/
target/

(Actually, just adding target/ filters both out.)

These directories contain SBT output generated from your sources, and should not be placed under version control.

If everyone working on your project is to use IntelliJ while working on the code, then you should add all of the ./.idea directory with the following exceptions:

.idea/.name
.idea/libraries/
.idea/modules/
.idea/modules.xml
.idea/scala_compiler.xml
.idea/tasks.xml
.idea/workspace.xml
.idea_modules/

(You might also want to consider adding .idea/sbt.xml to this list. It has some redundant information from SBT, but some IntelliJ SBT configuration settings as well. Up to you...)

These files and directories either contain information gleaned by IntelliJ from SBT (and are, therefore, redundant) or contain machine- and/or user-specific information which will create problems if checked out on a different machine or by a different user.

If SBT is the primary build tool, and people can use any IDE they like, it would probably be better to ignore the entire .idea directory instead.

Set up a Git repository - Help, I have created a test project containing Scala examples using IntelliJ IDEA and published it to GitHub. The project structure looks like this: Project Structure. Push to Git Repo. Now is a good time to begin pushing my codebase to GitHub to begin tracking the changes. Before you do, you should first create a .gitignore file in the project root folder so that you can exclude user specific files. There are a number of files that IntelliJ will create for your project, which should not be pushed to a Git repo.

You must commit the /project directory as it contains important information like build.properties and plugins.sbt, etc..

you should ignore /project/target also you should ignore *.iml

Files added to .gitignore are still shown in , Scala � Groovy � Android � JVM frameworks � Non-JVM technologies � Reference Git root mapping will be automatically set to the project root directory. Choose Git as the version control system and click OK. If you attempt to add a file that's on the .gitignore list, IntelliJ IDEA will suggest force adding it. Installing git in a new dir should be the best option: If your repo is already initiated, check your remotes: git remote --v $ git remote --v heroku ssh://xxxxxxxx.xxx:repo.git (fetch) heroku ssh://xxxxxxxx.xxx:repo.git (push) Check the list you have there. The first parameter, is the remote name, then you should write

I would recommend using the website https://gitignore.io where it will build you a .gitignore file based on your environment.

Here's one that ignores everything you shouldn't commit for a Scala/SBT/Windows/Vim based project:

https://gitignore.io/api/git,sbt,scala,windows,intellij,vim

How to gitignore .idea files – IDEs Support (IntelliJ Platform), On the screenshot all the files are marked as new - so they are added to git but not yet committed. Check git status - it should list them in the same� # create a .gitignore file. # create a placeholder class and test. # # This is what the final project layout will look like: # #. # ├── .gitignore # ├── README.md # ├── build.sbt # ├── project # │ └── build.properties # └── src # ├── main # │ ├── resources # │ └── scala

A sample .gitignore file for Scala/SBT projects, The links in the old posts explaining this are obsolete. Where is gitignore? It will still remain in your GIT repo, but simply not display in the� Scala Android Tutorial. Step by Step walk through for programmers wanting to use Scala for android development. Scala has started to become my personal favorite language, however it is a very difficult language for beginners and it is very hard to find how to set up your development environment, especially for setting it up for use with android.

Scala Intellij gitignore best practices : scala, One final note: Some of those files/directories are unique to SBT, some are for IntelliJ IDEA, others are for Scala/Eclipse, and .DS_Store is� Take a look at the Karate Demos for real-life examples of how you can use files for validating HTTP responses, like this one: read-files.feature. Read File As String In some rare cases where you don't want to auto-convert JSON, XML, YAML or CSV, and just get the raw string content (without having to re-name the file to end with .txt ) - you can

JetBrains/intellij-scala: Scala plugin for IntelliJ IDEA, Alvin Alexander http://alvinalexander.com/java/jwarehouse/scala/gitignore. SAMPLE.shtml. Like should the target directory be included why why not and others etc If you have an https://github.com/PurpleKingdomGames/indigo- examples. git,git-add,git-status. Look again carefully AreaChart.js and Areachart.js are different files. One has capital C and other has lower case c character. Since Git is case sensitive, and your filesystem is case insensitive, you will only see one of these on your filesystem. If you only want one in Git, you should

Comments
  • Possible duplicate of Intellij Idea 9/10, what folders to check into (or not check into) source control?
  • Thank you, great answer. I want to have a template for an IntelliJ Scala project in this case, so I will keep .idea/
  • Do I even need SBT if I compile inside IntelliJ IDEA? It tells me SBT configuration detected. Do you want to import it? whenever I load the cloned project for the first time, but I don't have to click it to build and run the code from inside IntelliJ.
  • Yes, you definitely need SBT! Even if all of your interaction is through IntelliJ, you'll still need an SBT build for continuous integration, etc. Anything that is related to the build should be in SBT; everything else (copyright, dictionaries, code styles, misc. settings) are in IntelliJ. Also, I recommend setting up SBT run configurations, so that IntelliJ uses SBT to run and debug code. (Alas, the run configurations are in .idea/workspace.xml and have to be recreated each time you retrieve from git.)
  • You should also enable auto-import of the SBT build into IntelliJ, so that the latter updates itself whenever the SBT build is modified.
  • What about the .idea - folder?
  • .idea/ is an intellij configuration folder. You're better off ignoring it too.
  • Sadly, without having the .idea-folder in the repository, I do not get a project in working order, but instead have to go through different setup steps beforehand.
  • @MarkusAppel you shouldn't commit any ide specific files. SBT should define the project, not intellij. The step for working on the project should be, clone the repository, then import sbt project in your ide.
  • @puhlen Please read my question again. I want a template project for IntelliJ IDEA.