How To Manually Add Project To Eclipse Without Using Eclipse - eclipse

I'd like to manually create the folders/files on the file system that create a new project in a workspace in eclipse, and show up in the Project Explorer when eclipse is started and the workspace is selected.
What files would need to be created to do this and where would they need to be?
Please understand that I do not want to open eclipse and make a new project using eclipse. I want to make a new project without using eclipse.

I think you will need to do the following
create a .project file and whatever other files needed by your specific type of project (for example java projects need .classpath) in the project folder, you can find out what you need by looking at those files for another project.
In your workspace .metadata folder, this is where eclipse keeps information about the current workspace, I think the plugin responsible for project definition is .metadata/.plugins/org.eclipse.core.resources , you will need to create those files yourself, some of them are binary, so you will need to open up the source of that plugin to see exactly how it writes them. Depending on your project, you will need to write more .metadata plugin information (for maven for example).

There is no easy way of doing this. Each new project modifies many scattered files throughout the eclipse structure (if you want a list, make a new project and find files created/modified most recently, and/or search for the project name.)
Short of writing the files by hand, there's not much you can do. I found these links in my reseach, but they're both pretty old and seem to be dead ends:
http://www.eclipsezone.com/eclipse/forums/t107019.html
http://dev.eclipse.org/newslists/news.eclipse.tools/msg36546.html

Based on the answers of #shipmaster I think this will work.
Go the workspace and create a new folder as your new required project name.
Copy the contents like .project, .classpath, .includepath etc from any existing project and modify the same like project name, source folder, build folder etc in .project. Do the similar changes in .classpath etc as per the new project requirements.
Unfortunately this is not enough to create a project by just doing eclipse restart so we need to do an import project and point it to this folder and we are ready to use the same now and we see the new project created in eclipse!

try archiving the file .. right click on project ---> export --->archive file(in General section) ..after you archive it as a zip you can import it after.

IF you want to manually copy a pre-existing project to a new workspace,
I have a solution for you:
Copy the project folder.
Paste it into the new work space.
File > Import > General > Existing Project Into Workspace
Eclipse will now see the project you cut+pasted manually.
Why I am doing this:
I am doing this so I can build upon my scrum stories while keeping documentation via working files that each successive step was built upon.
E.g. Story #2 is built upon story#1 code. But I don't want to version them because I want to be able to open them up one after another to do a presentation on my work flow.

Related

How to clear the eclipse .project files from maven project

After I import my maven project to eclipse, it created eclipse project files in my maven project. How do I clear them out?
After your comment "if I dont clean the project files, how to I hand it over to someone else? If they dont use eclipse would they be appreciate all those extra files unrelated to the project?" I have understood your need.
The best way to achieve it is to use a version control system (VCS) like git, svn etc. and add inside your project tree a special file call .[VCSofYourChoice]ignore. For example for git this file would be .gitignore for svn it would be .svnignore.
Once you created this file you add rules to exclude files or directories you don't want to share on your version control system of your choice. To find the syntax to use google it with keywords ".[VCSofYourChoice]ignore syntax".
Eclipse and eventually every IDE create specific files, in order to save project structure and other internals. Some of them prompt you to select in which folder you want to save these files, for example IntelliJ, but I am sure eclipse as well. So you every time you use and IDE and you import a project, some files are going to be generated. The cleanest way is to 1) select to save them in a folder not related with the actual project, and as it already suggested do not commit them and add them in an ignore list, on your VCS of choice (e.g git)

I need Netbeans help. NO project's -src node appears so no source files--only -Libraries node shows

I hope it's OK to ask this here. Netbeans forums isn't responding. If not, I'll delete this or ask for it to be deleted. I'm desperate so I'll face the wrath, if any.
I moved my Netbeans projects folder from one directory node to another to make backing up all my stuff easier. BAD MOVE.
Now when I open a project using Files | Open project (ctrl-shift-O) NO source files appear because there is no "+Source Packages" node to expand.
It looks like this for all projects, e.g. one named GBL:
Projects
-GBL
+Libraries
It doesn't look like this anymore:
Projects
-GBL
+Source Packages (How do I get this back?)
+Libraries
The Netbeans Properties for each project shows me the path it's using. Windows 7 Explorer shows me that the src, build, and nbproject folders contain files and ALL the source files are in the src folder for that path.
What have I done and more importantly what should I do to get back to being able to open a project normally?
(I've tried recreating the original Netbeans folder and using Windows Explorer to copy an entire project folder into it but: same result--all I see is the Libraries node under the project's name node.)
I just tried to Clean (and also Build) to see what would happen. Error:
ant -f C:\\Users\\Dov\\Documents\\NetBeansProjects\\BasicShirt -Dnb.internal.action.name=build jar
C:\Users\Dov\Documents\NetBeansProjects\BasicShirt\nbproject\build-impl.xml:[u]231[/u]:
Must set src.dir
I just Set Configuration by right-clicking the project's name and provided a path to the src folder.
NOW I SEE MY SOURCE FILES BUT NOW THIS line in the .xml file is flagged with similar message:
<fail unless="[u][b]test[/b][/u].src.dir">Must set test.src.dir</fail>
NOW what do I do? (Netbeans 7.4.)
If I could get rid of the 7.4 automatic creation of +Test Packages, I might be OK.
If you can help, I'd be very happy.
(I'm considering re-installing 7.3 if available or removing and reinstalling 7.4 and try to avoid the "testing" requirement, but there goes all my many tweaks of 7.4.)
Well, after considerable frustration with the problem, I solved it, essentially.
It's here, in total. My synopsis plus how it helped me follows. In short, I had to set up a new java project based on existing sources using the New Project Wiz and simply direct Netbeans to the sources.
File > New Project
Choose Java Project with Existing Sources.
Type a (new) project name and ...
... make the Project Folder contains the path to where you want the new project to be stored. (For me, this is the folder where Netbeans has been able to find my sources.)
Click Next for the Existing Sources page of the wizard and ...
5a. ... in the Source Packages Folder pane, click Add Folder and ...
5b. ... navigate to your sources and select the source root folder.
Clicking Next goes to the Includes/Excludes pane, which I didn't need to use.

Eclipse: how to keep project source files and ant build.xml seperate from eclipse workspace?

I'm trying to re-familiarize my self with the Eclipse environment and ant integration.
Question is: how to keep my sources dir + build.xml separate from the workspace?
What I have is
a small java project and its build.xml file with all the sources placed under a separate
project folder. I then started Eclipse and let it import my project via
New Project -> "Java Project from existing Ant Build File"
All went fine, until when I wanted to build the project from inside Eclipse using build.xml.
Ant starts complaining about not being able to find the source tree. After I examined
the workspace I found that Eclipse had copied the build.xml into the workspace, so it's
obvious that ant couldn't find any sources there. They are still under my project director
and I do want to keep them there, if possible.
so whats the best way so make this setup work? workspace on one side, my project on the other?
Thank!
edit: Is what I want even possible ?
Instead of using "Java Project from Existing Ant Buildfile", just create a simple "Java Project". In the wizard uncheck "use default location" and enter the path (or browse) to the top level directory of your existing project (i.e., where your build.xml is). True, eclipse will create .project and .classpath files in your project directory (if they do not already exist), but the project will remain outside the eclipse workspace.
Case in point, this setup has worked really well in a very particular situation on a standalone system where the source tree resides in a common location but each user has a workspace in a protected location. Using the method described above, each user of this system can create a project in their own eclipse workspace, execute ant targets and subsequently remove the project from their own workspace without affecting other users' workspaces.
What about using links?
Windows Symbolic Links
Linux man page for ln
I do this all the time in C++ projects (no Java, sorry, but I think the concept is portable).
I have my workspaces in ~/workspaces/{workspace_name}. I have a single shared project file in ~/{my_projects, and then the source trees (multiple versions) are in ~/proj1, ~/proj2, etc.
Within each ~/proj* directory, I put a symlink to ~/my_projects/.project and .cproject (required for C++, not used in Java). So each source tree is sharing the single project file. Then in each workspace (one for each source tree), I configure the workspace by importing the project link. For example, ~/workspaces/proj1 imports ~/proj1/.project, but ~/proj1/.project is actually a symlink to ~/my_projects/.project.
So this keeps the source separate from the workspaces. When building, there's no real configuration to do -- I just have Eclipse run make in the appropriate node of the tree -- we already have our own command-oriented build system (we're not using ant, but the same principle should apply).
I source-control the ~/my_projects folder in a private area of the SCM, so other team members don't see it or fiddle with it -- many of them don't use Eclipse at all.
There isn't really any need to try and avoid Ant and Eclipse using the same set of source files. In fact, its probably better that they do use the same set.
Bear in mind, you're not actually mixing anything. There is just one set of source files and then there are two different ways of building it; Ant and Eclipse. These builders are independent of each other, so there is no problem with being coupled to Eclipse. You can even happily commit all the eclipse files (.classpath, .project, .settings) to source control without affecting any developers who use a different IDE.
I do this all of the time (admittedly using maven, not ant), but the same principle applies.
If you have an existing project in Eclipse (with the .project in the source tree), then you can Import Project->Import Existing Project. When the dialog box comes up, you can choose to 'Copy projects into workspace'. Make sure this is unchecked, and them import.
You still store the .project in the original source tree, but thats all.
So now I have
code/xxx (which contains the .java files, which are in SVN)
code/xxx-workspace (which contains the eclipse workspace)

How to make an existing directory into an eclipse project

I have a project I am working on. I have decided to try working with it in Eclipse. There is already a directory, under version control where all the code resides. I am having a rather strange problem. I cannot find any way to just start using an existing code directory as an eclipse project. All I can find is how to import existing source into a new project or check out source from version control into a new project. How do I make an existing directory into a project?
My project is a Django web app if it is any help
In the New Java Project wizard, uncheck the checkbox that says Use default location and the use the Browse button to find your directory.
It is pretty easy to do. Go to File->New-> Project. In the Project wizard, choose the type of project you want and then be sure to unclick the 'Use default location` checkbox. Browse for your folder in the widget that then becomes enabled. Click finish after that.
Alternatively, you could create a brand new project workspace in a new location. Then, assuming Java as your project type, you can open up your project properties and add as a source folder your existing directory. To do this, use the 'Link Source' button on the Java Build Path -> Source tab of your Project Properties dialog.
My Method:
I clone this file to new project directory , and rename Project-Name to my project name, after that i import new files and directory from Eclips
File Name: .project ( Use Notepad for make this file...select Save as type to All Files (*.*) and write file name like: .project )
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Project-Name</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
Hope this link answers the original question of this thread.
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-45.htm
Creating linked resources
Folders and files can be linked to locations in the file system outside of the project's location. These special folders and files are called linked resources.
To create a linked folder:
In one of the navigation views, right-click the project or folder where you want to create the linked folder.
From the pop-up menu, select command link New > Folder.
Specify the name of the folder as it will appear in the workbench. This name can be different from the name of the folder in the file system.
Click Advanced.
Check Link to alternate location (Linked Folder).
Enter a file system path, or click Browse to select a folder in the file system.
Click Finish.
Probably not the way most people would go about this, but I like all of my eclipse projects in one place but don't necessarily have my source in my workspace directory. Maybe there is a built in way to "symlink" in eclipse, but I sometimes end up with the project folder in the workspace, with the "src" symlinked to the actual source directory somewhere totally different. That's my personal preference anyway. If you too are on a *nix machine a simple
ln -s /path/to/source src
will do from your project directory.
You know, it is not so simple question. Depending on your project type (jar, web module, ear and so on) different structure and configuration files are used by eclipse. So the first really interesting question is that what is your project type? The basic solution after it to create a new project, and define the directory of your source code as project root. Then you will see what else to change (for example source path settings, classpath and so on). So how does your project look like? Can you proide structure tree of folders?
Since you are using Django you should first set up PyDev in Eclipse. You can install it from the market. Then you want to configure the PyDev Python interpreters to find your installation of Django (http://pydev.org/manual_101_interpreter.html). Make sure to provide the explicit path to the Django folder if your Django is not installed in the default location.
Once these things are ready you can select File > New > Other, then select PyDev Django Project from the PyDev sub directory.
Click next and here is the sweet part: Uncheck 'Use default' (as previously stated) and then find your Django project directory. Be sure to select the right project folder (ie: the folder that contains manage.py). When you have the right folder selected Eclipse/PyDev will recognize that a project already exists and make mention that it will use those files. Click Finish.
Then there is a DB form that asks about your DB settings. If you already have a settings.py file then this seems to make no changes (as it should not). So fill it in or don't. But this is the last step.
Then you should be able to view and use your existing project in Eclipse!
I just created a pom.xml by hand and imported the project as an existing Maven project in Eclipse. It even works for nested projects without problems.
Use "import - existing projects into workspace". This works for my case.
Right click on a project -> Properties.
Open project location in explorer, there's a little icon next to path.
Put your folder/file structure in there and refresh the project in eclipse.

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.