Feb 24th, 2012, 04:29 PM
Grails 2.0 and version control
Hi, my local JUG is learning Grails 2 and git and I was wondering what we need to add to the ignore list. All the existing advice looks to be for 1.x and relying on that sounds dangerous. For instance, they all say to ignore WEB-INF, but that contains applicationContext.xml (which doesn't exist elsewhere). Can someone tell me the definitive list of files to ignore? All I have so far are the Eclipse/STS files like .project and .classpath.
Feb 24th, 2012, 07:45 PM
Run 'grails integrate-with --git' and it will create a .gitignore file for you. It probably has more entries than you need but has all the important ones.
Feb 24th, 2012, 08:25 PM
Thanks, Burt. Here is what it produced:
I believe I should add the following:
Please let me know if you think that's off or needs more. I created the project with STS 2.9M2 and the Grails project wizard if that makes any difference.
Feb 24th, 2012, 08:32 PM
I change the STS classes directory to /target/eclipseclasses so everything ends up under target. But if you want to keep /target-eclipse/ then yes, add it.
I check in the .project and .classpath files so others can clone the repo and open the project in STS. It will have some hard-coded paths (e.g. to plugin source directories) but others can run Grails | Refresh Dependencies and it'll update theirs. Or you can manually edit out those paths (e.g. <classpathentry kind="src" path=".link_to_grails_plugins..."> blocks in .classpath and the <linkedResources> block in .project and check in clean files that are usable by others (they still need to run Refresh Dependencies though).
Feb 25th, 2012, 01:35 AM
Thanks again, I will include .project and .classpath and instruct users to run Refresh Dependencies.
I'll add I was initially confused after doing Team >> Add at the project level, as none of the files in .link_to_grails_plugins were being tracked. However, I found these resources:
which explains it's an STS-specific artifact, linking to directories outside the project that shouldn't be checked in, hence it's ignored. Hope that helps the next person.
Tags for this Thread