I have a java project and I want to develop it without replacing the source code from its place. I want to link my code to my workspace without replace physically?
问题:
回答1:
- Select the
Project
you want to reference from onPackage Explorer
- Right-click and go to
Properties
( or hit Ctrl-Enter ). - Under
Projects
inJava Build Path
you can add another project which is currently open.
If you want to override a class you can make a copy of it in your current project and move it further up in the classpath in Order and Export
.
回答2:
Linking Source
Project properties -> Java build path (tree-item) -> Source (tab) -> Link source (button)
Linking Projects
Project properties -> Java build path (tree-item) -> Projects (tab) -> Add... (button)
Suggestion
See Eclipse help topic: Workbench User Guide > Tasks > Working with projects, folders and files > Creating linked resources
.
回答3:
You can link to a project that exists outside your workspace. This allows the project to continue to exist outside but be referable for purposes of browsing source, debugging, breakpoints, etc. In Eclipse, from the menu:
- Select
File | Import...
and chooseGeneral > Existing Projects into Workspace
- On the next panel in the dialog, browse to the location of the project and ensure it's selected in the listbox.
- Be sure to not check the checkbox
Copy projects into workspace
. Click Finish.
Changes you make in the project in this workspace will be reflected into the project in it's native location.
Be sure that when you remove the project reference from the non-natively owned workspace, that you don't Delete project contents on disk (cannot be undone)
.