Dec 4th, 2012, 03:47 PM
Importing Grails project in Git repo into GGTS 3.1.0
Is there an easy way to import Grails projects in a Git repository into GGTS 3.1.0? The Git repositories do not contain Eclipse project metadata (.project, .settings, and .classpath are in .gitignore). Also, I'd like the imported project files to live inside the workspace directory rather than being linked to an external location.
In GGTS 3.0, I could do something like this:
- Importů > Projects from Git.
- On "Local Destination" page, use defaults. Git repo is cloned inside workspace directory.
- Outside eclipse, run "grails integrate-with --eclipse".
- Back in Eclipse, do New Project > Grails Project. Use same project name and "new" changes to "import".
In GGTS 3.1.0, when I try to import (or do new project on) the project that EGit clones inside the workspace, I get the error: "<name> overlays the location of another project: <name".
It does work GGTS 3.1.0 when I tell EGit to clone outside the workspace, but the subsequent Grails project import does not have the option to copy into the workspace, so the project files wind up outside the workspace.
It seems like there should be an easier way to do this
Dec 6th, 2012, 10:05 AM
For 3.1.0, there is a new Grails import wizard, so here are the steps you should do (the first two are as before):
1. Import… > Projects from Git.
2. On "Local Destination" page, use defaults. Git repo is cloned inside workspace directory.
3. File -> Import -> Grails project
You do not need to run anything on the command line.
Dec 6th, 2012, 03:44 PM
Example of set up, push and pull Git repo of Grails project
I can not figure out how to set up a Git repo from my STS 3.1.0 Grails project, push to a remote and then clone from the remote on my colleague's machine. Is there an example somewhere of how to do this and end up with a copy of the repo that is still connected to the remote for push/pull?
Git is configured and working on the remote. In my project folder, I manually created a repository after adding a few things to .gitignore like target-eclipse and .project and I pushed that to the remote. I cloned from the remote to my colleague's machine but the instructions above do not work.
"Import existing projects" says "no project found to import"
"Use existing project" creates a project but it's not integrated with git on my colleague's machine!
"Import as general Project" says "overlaps the location of another project"
Dec 6th, 2012, 04:26 PM
I am guessing that your problem is that when you clone from inside of STS, this creates a project for that repository containing all of the stuff in that repository. Then when you try to import the grails project, you get the error because you are trying to import a project that is a sub folder of another project.
Try cloning from the command line, then importing the grails project, and then connect to the git repo.
Dec 7th, 2012, 01:01 PM
That works, as does importing with EGit but canceling after it clones, then importing and connecting to the repo.
It seems to me like the "Import... > Projects from Git" wizard must at least partially set up the imported stuff as a project, so when GGTS tries to import it, Eclipse thinks the project already exists. It seems like its a problem with EGit, but perhaps GGTS import could handle this case?
It would certainly be nice to be able to directly import raw Grails projects from a Git repo without having to resort to these workarounds
Dec 7th, 2012, 01:09 PM
Yes. The problem is that egit does not know about grails projects, and I am not aware of any extension points that we can use to hook into egit to teach it about grails. So, unless you store your eclipse metadata in your git repo (not a terrible idea IMO), then there is no way that I can see this working any more smoothly.
Dec 7th, 2012, 01:12 PM
Here's a way to clone a Grails project that has worked for me:
1. Import... > Projects from Git
2. Proceed through the wizard up to the "Select a wzard to use for importing projects" page and click Cancel
The remote repo should be cloned inside your workspace directory but is not yet registered as an Eclipse project.
3. Import... > Grails Project
4. Navigate to the cloned project inside your workspace and click Finish.
5. Right-click on project in Project Explorer and do Team > Share Project...
6. Choose Git, click Next, and click Finish to reconnect the project to the repository.