1
votes

I currently use an Ant script to download several Java projects (projects divided as modules) from a svn repository and generate a single war file. But now there is a need to use those scripts to download these projects directly to an eclipse workspace.

Even after the build.xml is executed successfully, these projects aren't really imported by eclipse. The projects are fully stored in svn (with their .project, .classpath, etc..) Probably something is missing on .metadata folders and files on workspace root, i don't know.

Does someone know how import eclipse projects to an active workspace using command line or even through an ant plugin?

Thanks in advance

2
It sounds like you've got all the files you need (.classpath, .project, etc.), so what happens if you do File -> Import -> Existing Projects into Workspace and browse to the workspace folder? Do you see a list of the projects that your script retrieved from SVN? If so, make sure the "Copy projects into workspace" option is disabled and click Finish. Do you see the projects?ChrisH
Yes, I see them. Probably there isnt a way doing this automatically, is there? You could paste this comment as an answer. I really appreciated your help.Danmaxis
I looked through the list of ant tasks that eclipse provides and didn't see anything that looked like it performed a project import. There is one for refreshing the workspace, but if the workspace doesn't know about the projects then a refresh won't help.ChrisH

2 Answers

2
votes

Have you considered using an eclipse team project set to import all of the projects? I know this isn't exactly what you are asking for, and I understand that you may have a strong reason to use the ant script you have, but I think creating a project set fits your needs pretty well.

1
votes

It sounds like you've got all the files you need for the projects (.classpath, .project, etc.), so you can get eclipse to see the projects by selecting File -> Import -> Existing Projects into Workspace and browse to the workspace folder. You should see a list of the projects that your script retrieved from SVN. If so, make sure the "Copy projects into workspace" option is disabled and click Finish.

I think your initial thought that something in the .metadata folder was not in SVN is correct. You should be careful about what you put in SVN from the .metadata folder though. Although I don't know exactly which files you might want to try sharing, you might want to investigate the files in .metadata/.plugins/org.eclipse.core.resources.