How do I start using source control with an existing project? - eclipse

So I'm working on my first website in Eclipse. It is very simple only shows some text and an input box currently that does nothing, all this eclipse stuff is in my project folder. I've set it up to use Apache Tomcat 9 which is also in my project folder.
Now I think that I shouldn't just push my top level project folder as if I do this, everytime I open up the project in Eclipse, Sourcetree will show 50 or so files modified (.metadata files and such), so I'm guessing that I shouldn't have pushed these to start with.
I've since reset all my commits and am now wondering which files are necessary to upload to github?

You should add all source files to git: the actual code that runs your site (PHP, JavaScript, HTML, whatever it is), along with things like CSS. Don't include config files or files auto generated by the IDE (Eclipse in your case). You can use a .gitignore file to tell git not to pay attention to certain files, types of files, or directories. A guide to .gitignore files can be found here.

Related

Eclipse Project Explorer show modifications on SVN externals

I have project which contains source files and cmake file that creates deeper structure and download another sources from externals. The goal is to see in Project Explorer if any versioned file was modified. It is working fine for files on main repository, but not on externals.
Example:
Let's assume that we have directory General and code main.cpp. When i change main.cpp, icon in project explorer will change. Inside General cmake creates directory External and download external external.cpp. When i change this file, Eclipse doesn't show icon that file was modified on directory and file.
I've downloaded Subversive and try to change settings, but nothing helped. I am almost sure that there is a way to have this, but no idea how to set it.
Using IAR it is simple Connect Project to subversion, but it shows only files, so you have to expand all groups in explorer to see which files was modified...

Eclipse and subversion/git - which files to keep

I've just ported a C++ system from codeblocks to eclipse. I now wish to put the workspace under source code control. I don't know if I have set this up correctly. The directory structure looks like
toplevel
+--.metadata
+--very big file structure
+--project1
+--.project
+--.cproject
+--various cpp/h files
+--project2
+--.project
+--.cproject
+--various cpp/h files
What I would like is to be able to checkout everything on a different machine, start up eclipse, point it to the workspace and pick up all the projects. I know I have to keep the .project and .cproject files but what do I need to keep in .metadata or have I got the entire structure wrong?
Edit I found Where in an Eclipse workspace is the list of projects stored? which recommends .metadata/.plugins/org.eclipse.core.resources/.projects but there is a structure under each project folder containing .markers .indexes and properties.index. Do all these need to be kept? I had a bad experience with codeblocks where I kept the layout file and even though I finally deleted it, it was stuck in the source code control system forever.
I would discourage you from putting .metadata folder into source code repository. It is a very complex and large folder that contains internal plug-in data. It is very hard to keep it in the repository.
The recommended way is to store only the project folders (project1 and project2) in the repo along with .project, .cproject and .settings. You can then import them using subversion or git on any other machine.

IBM Worklight - How does Worklight detect the project version?

Recently we'd updated our Worklight platform with the latest Fixpack (6.1.01) and everything works fine after the update.
However although we had check in all our files into our SVN repository, when we check out a fresh copy of project, the eclipse Worklight plugin will still perform an upgrade to the project.
Is there a Worklight platform version control in the project folder that we missed out and didn't commit to the repository? or is there extra setting that we need to apply before checking into the SVN repo?
Any clues will help, thank you.
EDIT
Below is the print screen taken from the SVN Repository browser in eclipse. We use Windows environment for development. The .settings folder is inside the repo.
EDIT 2
After inspecting the org.eclipse.core.resources.prefs file in the .settings folder, i notice that there's this line of properties that are not updated in the repo:
wl_version=6.1.0.00.20131219-1900
Is it this line that is causing the problem?
Edit the question with the files/folders you did commit to SVN.
Additionally, make sure to setup your PC/Mac to display hidden files and folders and see that you did not miss those.
Specifically, there is a .settings folder (. denotes a hidden folder in Mac) that also contains a org.eclipse.core.resources.prefs file.
I'd be interested to see the result of an import of a project that does contain this folder and this specific file.

Sharing eclipse project over SVN

We want to share an eclipse Qt project via an SVN repository.
Of course we need to share the .pro file of Qt to be able to build the project.
The problem is, that without the project files you can not handle the project in eclipse but we cannot use the same as they contain local references.
Also it would be nice to use the Eclipse SVN plugin to manage this.
I already tried to check out the project and create a Qt project on Checkout but this overwrites the checked-out project file.
Any suggestion would be appreciated.
These are some lines from the .cproject file that are autogenerated, so I can not change the absolute paths:
<storageModule moduleId="org.eclipse.cdt.core.pathentry">
<pathentry base-path="/usr/include/qt4" include="" kind="inc" path="" system="true"/>
<pathentry base-path="/usr/include/qt4" include="QtWebKit" kind="inc" path="" system="true"/>
...
There are 2 rules for Subversion (independent of Eclipse, should be the same all the time):
If the tool will regenerate a file, and you don't have to change it:
==> don't check it in your version management (may it Subversion, Git, CVS, ...).
If the file contains parts that are manually changed by a user
==> it should be checked into version management.
If you have the second case (not clear from your question), you should try to change the paths to be relative, so that others could use your project at the same location.
If you cannot change that, stick to the location in the file system. Every developer has to use an identical setup.
If you have to support different operating systems, and the files generated by the tooling are not compliant (shame on the tool makers), you should hold templates for all operating systems in your version management, and should initially (manually) make a copy, depending on the operating system you are working in.
If you have to change that file for some purpose, you have to change the templates as well and should remember that all developers have to make a new copy after that.
Sorry, I don't know Qt and have never developed in a C-environment on different platforms, so my tips are pretty vague.
Finally I found following solution:
No .cproject .project file in SVN!
Import the code files from SVN (also the .pro file for Qt)
Eclipse will ask you to create a project, so create a Qt Project with the same name (or some else, but you will then have to delete the files)
When the project was created, revert it (right MB on the Project in Project Explorer -> Team -> Revert) to the state of the repo checkout
Done, now you can work with the project

In Eclipse, how can I move all my source files to a different folder without screwing up the project?

I have created my ActionScript source files in a folder on a Mac (I normally use Windows), and somehow managed to make an Eclipse/FDT project that can see them.
I now need to move them into a svn checkout of an existing project to get them under source control.
I just can't work out how you do this without losing all references in the project.
I'm new to Eclipse and don't really understand any of the terminology (e.g. workspace). Does Eclipse have project files or are they all hidden? Can the project file be moved?
Help me stackoverflow, you're my only hope.
Update:
From the FDT Flash Explorer window I can only seem to be able to move files/folders within projects that exist. Should I create a new project in the place I want first?
Should I move them from within Eclipse or from the file system? Do I need to setup a new workspace afterwards?
The project folder has 2 hidden files: .project and .classpath that have all the info of the project. You just need to copy those files along with your project files.
For instance, you have a project folder in workspace/myproject/, and you want to add it to a checkout svn folder, you just need to copy the complete folder content to the checkout and then add all the files to the svn (including the project hidden ones) and finally commit.
From now on, when you checkout from that svn, you will have the eclipse project files, so all you need to do is create new project, and select the option that says that you already have a project folder with the source files (I'm not near an eclipse IDE to tell exactly the steps, but it's something like this). Eclipse will then import the project with all the settings you had previously defined.
I hope that this answers your question.
Try refactoring your project. Rightclick on the folder to move and then choose Refactor->Move. Don't know if this will solve your problem but it will try to change the references in all projects according to the move.