Last updated by 4 years ago
Page: Checking Projects into SVN, Version:6
Checking Projects into SVNAuthor: Marc PalmerAuthor: James LorenzenTable of Contents
- #Creating a new project and putting it into SVN
- #Fixing an existing project that is already in SVN
- #Checking out from SVN
NoteThe information in here should be easily adapted to CVS. Replace the svn propset svn:ignore commands to set the same text in .cvsignore files in the directories specified in the commands.Up to and including Grails 0.4.x there are files that are generated or copied by Grails within your project tree. This can be problematic as it is unclear what is to go into SVN and what isn't. In addition, you will not usually want your compiled .class files going into version control, nor duplicates of your libs etc.
This is correct at the time of writing (Grails 0.4.x) but makes the following assumptions:
- You do not want ./plugins/core (Core Grails plugins) under SVN
- You do not want anything under ./web-app/WEB-INF/ under SVN. You should not usually need to put files in here. Files from ./conf are copied to WEB-INF/classes so they are on the classpath, if you need to supply anything.
Creating a new project and putting it into SVNThis approach is for use when starting a new Grails project - i.e. it does not yet exist on your disk at all, nor in SVN. It will talk you through your first check in, including the relevant svn:ignore properties, and avoids any checkin of these ignored files that may or may not exist locally.With SVN installed, create your project. We will use "MyProject" as the name for the purposes of demonstration:
Now you must create an empty SVN directory under your SVN repository using whatever appropriate tools you have. This directory should be called the same as MyProject but it doesn't have to be. We will call this SVN repository directory path "emptysvndir" for this example.Note: The WEB-INF instructions below are optional. If you perform those steps, you must run "grails upgrade" after checking out your repository.Next you do:
grails create-app MyProject cd <projname>
That should have your project committed, and changes to ./plugins/core and ./web-app/WEB-INF/ should be ignored by SVN.You will not need to check out this project as we have used the "in place import" technique.
svn checkout <svn-server-url>/emptysvndir/ . svn add * svn propset svn:ignore "WEB-INF" web-app/ svn propset svn:ignore "core" plugins/ (as of grails v1.0.3 there is no plugins/core directory) svn rm --force web-app/WEB-INF svn rm --force plugins/core svn commit -m "First commit"
Fixing an existing project that is already in SVNThis approach is for use when you have optimistically imported your entire project into SVN already and have started getting errors or are being annoyed by the warning messages relating to locally changed files.We will use "MyProject" as the name for the purposes of demonstration:
That should have your project committed, and changes to ./plugins/core and ./web-app/WEB-INF/ should be ignored by SVN.
cd MyProject svn propset svn:ignore "WEB-INF" web-app/ svn propset svn:ignore "core" plugins/ svn rm web-app/WEB-INF svn rm plugins/core svn commit -m "Fixing SVN"
Checking out from SVNTo checkout this project fresh locally or on another machine you will need to checkout as usual but then run:
The grails upgrade command re-instate some files that we are not checking in. This applies mainly to the files under WEB-INF/ dir: including applicationContext.xml, tld/* , sitemesh.xml , web.template.xml etc.