How do I start a new project in Eclipse and Subversion - java

A newbie question (I haven't really created new projects in Eclipse yet): I have a machine running Linux with a fresh install of Eclipse 3.5.2. I want to create a new Java project in an existing subversion repository (which already contains some unrelated stuff). So after running Eclipse I get this dialog to specify workspace. What is the best practise here? Should it be in subversion? Then when I created a random one, when I add a project it goes into the workspace. So if my workspace is not in subversion, where and how should I get these projects there?
Background: probably I will work on my own on this project, however I have 2 PC's which I want to be able to use interchangeably.

What I usually do is put the workspace out of the way in ~/.workspace (invisible directory). Then I create new projects outside of that workspace, in the Subversion checkout directory.
You can create a project outside the workspace as follows:
Create a directory in your Subversion repository. Your project will live in this directory.
In Eclipse, click File; New; Project.
Choose the desired project type; click Next.
Instead of "Create new project in workspace" (the default), select "Create project from existing source". The name is misleading: the source does not have to exist, just the directory!
Click Browse and select the directory that you just created.
Eclipse will create a .project file and other support files in the directory you specified. Simply add all these files to Subversion, and you're all set.

Your workspace is the folder where eclipse will place all of your projects.
Basically, once you've linked Eclipse with a SVN repository, retrieving a SVN project will send him to the workspace, thus allowing you to work on it. Once you've made the changes, you can right click on your project in the project bar (on the left, by default) and chose ->team/subversion (depending on the eclipse version) -> commit.
If you want to send a project into your subversion, you create a new project inside your workspace. Then, you right click on the project in your project bar and do the same thing.

let's say that your workspace dir is /home/grzenio/workspace and your project name is project
first of all, go to to /home/grzenio/workspace, then checkout the source code, so the code will be at /home/grzenio/workspace/project.
Open eclipse, and create a new project from the folder selecting "Create project from existing source". Select /home/grzenio/workspace/project
Voilá!

Related

What does netbeans or any IDE look for when importing a project

I tried to use a project not made using netbeans. I tried to use it by creating a new project and using the "web application with existing resources". When browsing for the existing project, I clicked on the project name and clicked OK, but it opens the project and shows the list of folders in the project and doesn't accept the projectnamefolder as the project to be imported.
What does an IDE look for the identify a project as a project that can be imported
Eclipse looks for .project files when importing existing eclipse projects. If you create an eclipse project for existing code, you can simply create a project and point it to the right folder, and specify the layout for source and target.

How to import a spring project in STS

Just by a mistake I had deleted a spring project in STS.To use it back I borrowed the same project from my friend in zip format but when I tried to import it says
Some projects cannot be imported because they already exist in the workspace
Following is the way I tried to import
file->import->general->existing projects into worspace->select archive file
and after browse when I select the zip project
Some projects cannot be imported because they already exist in the workspace
and the finish button and next button are in disabled state.Please help me
The workspace in STS/Eclipse is not automatically the same as the file structure that you have on disc in your workspace directory. You can have projects in this workspace folder or somewhere else on disc.
To get them into your project explorer (and access them from inside STS/Eclipse), you need to import them (Import Existing Projects into Workspace). Then you can select the folder where those projects are located in. In case you have those projects already in your workspace folder on disc, you can choose the workspace folder as root folder in the wizard. It will show all the projects that exist on disc in that folder and grey those out that are already imported/referenced in your workspace in Eclipse.
Make sure it is really not in workspace, also if there aren't any other projects with the same name. If not, just delete the .metadata folder or create a new workspace.
Check if you still have the project in folder of the workspace on disk. You may have deleted in STS, without checking 'Delete on disk'. So, the project may be still there in the workspace folder though its deleted in STS.
I get this issue from time to time. Usually I just open a new workspace but sounds like you don't want to loose other projects.
I simply open the.project file in my project and change the name of the project in name tag.
Good Luck!
Probably whey you 'accidentally deleted' your project, you only deleted it from the Eclipse workspace, but not from the actual workspace folder on your hard-drive (as other people pointed out, Eclipse can arbitrarily map workspace projects to files on disk, so it is possible for a project to be 'deleted' from your Eclipse workspace but still exist on disk.
The good news is the files you deleted are actually still there.
Instead of importing your project from a zip, you may just want to import those files from the workspace folder back into your Eclipse workspace.
Generally this kind of problems not occurred you can go to Project option and clean and than restart STS.
May be STS is not synched with the latest configured project.
When you launch Spring Tools Suite, it will ask you to Select directory as workspace as below:
If the directory you selected here (i.e., workspace directory) is the same as the directory where the project that you are going to import resides, then you will get Some projects cannot be imported because they already exist in the workspace.
Therefore, to solve the issue,
Close Spring Tool Suite
Create a new directory
Launch Spring Tool Suite again
And, select that as your workspace
Launch the application and you would be able to import as you mentioned in your question
It solved my problem.
Hope it helps..
Happy Coding!!
the problem is that when you delete a project maybe sts only close it.
Try View Menu --> uncheck closed projects
Now you will see all closed project, simply delete it.

Eclipse doesn't show projects in package explorer

I keep my workspace folder in the Dropbox folder so I can use it on different computers. Usually there isn't a problem. Today however I opened Eclipse and found it doesn't show the projects in the package explorer.
I checked and it's set to the correct workspace folder.
I tried to Import existing projects into workspace, but Eclipse doesn't allow importing the projects because 'they already exist in the workspace' - even though they don't appear.
Will appreciate your help.
Keep your project files in DropBox. You shouldn't share a workspace like that -- it will inevitably lead to issues like the one you describe.
That is, keep the project folder, along with the .project, .classpath, and .settings/ in your shared Dropbox space. Create a new workspace on each computer, then "Import existing project" into each workspace, selecting your project in Dropbox, being sure to unselect "copy projects into workspace".
I don't have idea about using dropBox-BUT-However
For your question::
I tried to Import existing projects into workspace, but Eclipse doesn't allow importing the projects because 'they already exist in the workspace' - even though they don't appear.
Possibility:: Projects are not in Eclipse explorer but a copy of it exists in the workspace folder so eclipse is not allowing you to add the projects with same name again.
Solution:: Create a new workspace and then use dropbox to import the projects.
What you can also try is do
Create new General Project
Select in current workspace
Create project with name of an already existing project in your workspace
I seem to remember using this to "hydrate" already existing projects in my workspace into the eclipse package explorer.
This happened to me and it was because I inadvertently filtered out some of the files in the filters option in the Package Explorer.
Inside PackageExplorer -> Small drop down on top right side -> Filters
Un-select all and see if your files are now visible. Worked for me.

How to use TortoiseSVN together with Eclipse

I want to use TortoiseSVN together with Eclipse.
For now I just want to try it out.
So I use a local folder as repository.
I have installed TortoiseSVN 1.7.13.
I created a folder called 'REPOSITORY' and chose 'Create repository here' from
the context menu.
As other websites told, I installed Subclipse 1.8.22 in Eclipse.
I use the SVNKit1.7.9 as client or connector (Whatever it is called).
I had already some projects in eclipse's workspace.
From the context menu I chose 'Team->Share Project'.
That is what other websites told to do.
It did show the normal commit dialog and so on.
The projects are marked as commited but the folder 'REPOSITORY'
is still small in size.
It seems, that the projects where not copied or moved to the repository.
At work we have a server based SVN. I just want to have something like that at home.
Did I miss something?
Isn't it the purpose of the SVN repository to hold a copy of the projects?
So the commited projects should be inside the REPOSITORY, right?
Greetings
Mike
Apparently, you have to manually import the project in Eclipse into the repository created with TortoiseSVN before actually committing to it.
This other page might help you. It gives a very detailed walkthrough of how to set up exactly the kind of local system you want. In essence:
In Eclipse, delete the project but not its contents (Delete project contents on disk unchecked). This will leave the project's folder under your workspace location untouched.
Outside Eclipse, import the project folder into the repository previously created with TortoiseSVN (Right click on folder > TortoiseSVN > Import and select the URL of the repository). Once imported, you may wish to delete the project folder.
Back in Eclipse, checkout the project from TortoiseSVN's repository (e.g. Right click on Package Explorer > Import.. > SVN > Projects from SVN).
Hope that helps.
If your project's folder structure and package structure are the same, you can use Eclipse Subversive. It's just a plugin for eclipse and provides all features of TortoiseSVN

Is it possible to put Eclipse GWT project under EGit?

Is it possible to put Eclipse GWT project under EGit?
If I select an option "Use or create repository in parent folder of a project", Eclipse says "Creation of repositories in the Eclipse workspace is not recommended" and does not allow me to go further.
If I deselect this option, it moves the project files into a separate folder of Git repository and breaks the classpath. For example, Web App Libraries entry remains pointing to the old place and does not fix it upon recreate.
Trap! How to get out?
When it shows that warning, you need to hit the "Create Repository" button at the bottom of the dialog. That will allow you to select your project as your repo and use Finish.
See EGit User Guide/Repos for a discussion on why it's better to have an external repo.
PW
You have to select project folder in the project view, then right click 'Team>Add'. 'Team>Add to index' in newer eclipse versions. Make a commit and the Web App Libraries fixes itself.

Categories