[英]How to link project in eclipse
I have a java project and I want to develop it without replacing the source code from its place.我有一个 java 项目,我想在不替换源代码的情况下开发它。 I want to link my code to my workspace without replace physically?
我想将我的代码链接到我的工作区而不进行物理替换?
Project
you want to reference from on Package Explorer
Package Explorer
上引用的Project
Properties
( or hit Ctrl-Enter ).Properties
(或按 Ctrl-Enter )。Projects
in Java Build Path
you can add another project which is currently open.Projects
Java Build Path
中的项目下,您可以添加另一个当前打开的项目。 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
.如果您想覆盖 class ,您可以在当前项目中复制它,然后在
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
.请参阅 Eclipse 帮助主题:
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:
这允许项目继续存在于外部,但可用于浏览源代码、调试、断点等。在 Eclipse 中,从菜单:
File | Import...
File | Import...
File | Import...
and choose General > Existing Projects into Workspace
File | Import...
并选择General > Existing Projects into Workspace
Copy projects into workspace
.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)
.请确保当您从非本地拥有的工作区中删除项目引用时,您不会
Delete project contents on disk (cannot be undone)
。
For Maven based projects, following worked for me:对于基于 Maven 的项目,以下为我工作:
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)
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 )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.