How to link project in eclipse
I have a java project and I want to develop it without 开发者_如何学Goreplacing the source code from its place. I want to link my code to my workspace without replace physically?
- 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
.
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
.
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)
.
For Maven based projects, following worked for me:
Make sure to have following checkbox checked
Project properties -> Java build path (tree-item) -> Libraries (tab) -> Maven Dependencies (tree-item) -> Edit (button) -> Maven Project Settings (link) -> Resolve dependencies from Workspace projects (checkbox)
精彩评论