28

So far i've collected the following:

*.iws
*.war
.classpath
.DS_Store
.project
.settings
/*.launch
/*.tmproj
/out/**
stacktrace.log
test/reports

Any other suggestions?

6 Answers 6

66

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
15

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.


(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.
  • the eclipse dot files .classpath, .project, and .settings will also not be overwritten if they exist, but they can be ignored at first.
  • for previous version of Grail, you would also have needed (at least) a line /plugins/core
1
  • Is it safe to ignore everything in the /web-app/WEB-INF folder? Commented Oct 10, 2013 at 21:46
6

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, ...

0
4

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"

3

If you're using Intelli J IDEA should also add these:

.idea
*.iml
*.iws
*.ipr
2
  • the .idea directory can be added to version control, indeed it should be.
    – Michael
    Commented Aug 22, 2012 at 21:49
  • 3
    I don't think so, since not every developer uses IDEA. Normally, project files should be kept IDE-agnostic.
    – migu
    Commented Oct 24, 2012 at 15:18
0

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.