So far i've collected the following:
*.iws *.war .classpath .DS_Store .project .settings /*.launch /*.tmproj /out/** stacktrace.log test/reports
Any other suggestions?
You can have the .gitignore file automatically generated by Grails using the following command:
grails integrate-with --git
Grails 2.1.0 generated the following file content on my machine:
*.iws
*Db.properties
*Db.script
.settings
stacktrace.log
/*.zip
/plugin.xml
/*.log
/*DB.*
/cobertura.ser
.DS_Store
/target/
/out/
/web-app/plugins
/web-app/WEB-INF/classes
Update 5 years later (April 2014):
As mentioned in the other answers below, two sites are now able to provide good default .gitignore files, including for a Grails project.
GitHub, when creating a new repo (based on the github/gitignore project).
=> Grails.gitignore
(Original answer, January 2009)
Only may be to add /web-app/WEB-INF
to your list:here is an full example of such a gitignore file.
# .gitignore for Grails 1.0.3
# web application files that are overwritten by "grails upgrade"
# cf. GRAILS_HOME/scripts/Upgrade.groovy, target( upgrade )
/web-app/WEB-INF
# IDE support files that are overwritten by "grails upgrade"
# cf. GRAILS_HOME/scripts/CreateApp.groovy, target( createIDESupportFiles )
# to be specific, you could replace "/*" below with your project name,
# e.g. "foobar.launch" (no slash)
.classpath
.project
.settings
/*.launch
/*.tmproj
# logs
stacktrace.log
/test/reports
# project release file
*.war
Note, as mentionned here, that :
build.xml
is not part of that list, since grails won’t overwrite it. .classpath
, .project
, and .settings
will also not be overwritten if they exist, but they can be ignored at first./plugins/core
/web-app/WEB-INF
folder?
Commented
Oct 10, 2013 at 21:46
IMHO, stuff like .DS_Store and *.tmproj should not be in the projects .gitignore, but rather in your own userwide ignore-file, as they aren't related to the project but just related to how you work in the repository.
Otherwise, an argument could be made to also include ignores for temporary files from Eclipse, vim, emacs, XCode, ...
I'm very late to the game, but I came across this link for templates https://github.com/github/gitignore which has one for grails: https://github.com/github/gitignore/blob/master/Grails.gitignore. Hope it may be useful to anyone else who finds this page first by searching "git ignore for grails"
If you're using Intelli J IDEA should also add these:
.idea
*.iml
*.iws
*.ipr
Heroku also provides proposals for a .gitgnore
file (Getting Started with Grails on Heroku):
*.iws
*Db.properties
*Db.script
.settings
.classpath
.project
eclipse
stacktrace.log
target
/plugins
/web-app/plugins
/web-app/WEB-INF/classes
web-app/WEB-INF/tld/c.tld
web-app/WEB-INF/tld/fmt.tld
We should bear all the suggestions from this thread together and create a common file. When working with the NetBeans IDE, then there are also some files that can be excluded (for example, the nbprojects
folder).