4

Since grails 3.1.x has major changes, what would be appropriate .gitignore?

For now, I've used default grails .gitignore

sgiri
  • 691
  • 12
  • 28

4 Answers4

7

My team usually works on different OS (Win/Lin) and various collaboration tools and editors. So I've developed a standard .gitignore using IntelliJ for my team which works fine on many systems and editors. Here is is:

# Created by .ignore support plugin (hsz.mobi)
### Grails template
# .gitignore for Grails 1.2 and 1.3
# Although this should work for most versions of grails, it is
# suggested that you use the "grails integrate-with --git" command
# to generate your .gitignore file.

# web application files
/web-app/WEB-INF/classes

# default HSQL database files
/prodDb.*
/devDb.*

# general HSQL database files
*Db.properties
*Db.script

# logs
/stacktrace.log
/test/reports
/logs

# project release file
/*.war

# plugin release files
/*.zip
/plugin.xml

# older plugin install locations
/plugins
/web-app/plugins

# "temporary" build files
/target
### Java template
*.class
*.asscache
# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see     http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### NetBeans template
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
.nb-gradle/
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio

*.iml

## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries

# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml

# Gradle:
# .idea/gradle.xml
# .idea/libraries

# Mongo Explorer plugin:
# .idea/mongoSettings.xml

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
### Eclipse template
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch


 # JDT-specific (Eclipse Java Development Tools)
.classpath

 # Java annotation processor (APT)
 .factorypath


 # Ignore Gradle GUI config
 gradle-app.setting

 # Avoid ignoring Gradle wrapper jar file (.jar files are usually  ignored)
!gradle-wrapper.jar
### SublimeText template
# cache files for sublime text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache

# workspace files are user-specific
*.sublime-workspace

# project files should be checked into the repository, unless a  significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project

# sftp configuration file
sftp-config.json
### Linux template
*~

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*
### Vim template
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
Ejaz Ahmed
  • 654
  • 4
  • 17
  • 1
    The must have config for grails3 as well as any gradle project is not to ignore gradle-wrapper.jar. See similar description in comments of my file. – Ejaz Ahmed Apr 04 '16 at 11:20
6

All the previous posts give sound advice. Here's a good starting point for a .gitignore file from a Grails 3 project (note that the first 4 lines I'm excluding here are IntelliJ project files, which may/may not be a concern for you):

*.iml
*.ipr
*.iws
.idea

.gradle
.asscache
build
out
logs
classes
ZacharyAKlein
  • 633
  • 4
  • 9
  • Have a look at this https://www.gitignore.io/api/grails I don't know if they respect grails 3.0 – ppasler Apr 04 '16 at 11:22
0

Grails 3.x is built with gradle, a lot of the ignore entries used for older grails versions are not necessary anymore. Take a look at the .gitignore file for gradle, which only ignores the '.gradle' directory and the 'build' directory. It also makes sure not to ignore the wrapper jar file.

Steinar
  • 5,860
  • 1
  • 25
  • 23
0

Well that's totally a matter of choice of your technical hands like idea or eclipse and many other such combinations.

Hence your .gitignore file will vary depending upon what you actually won't like to get stored to a repo.

Following are few such things:

  1. Any thing that get's generated after compilation e.g. plugins, class files and build tool specific data etc
  2. Anything that is not part of your application and is only required by local machines and tools for development and testing purpose e.g .iml files or idea specific files. Remember when I say not part of your application means the minimum stuff that will run successfully independent of the fact that it might need to download certain stuff from remote server.

May be this answers you!

Vinay Prajapati
  • 7,199
  • 9
  • 45
  • 86