将文件导入 Eclipse 项目时为什么要使用链接选项?
我知道可以选择在 src
目录下添加指向源代码的链接,而不是将源代码文件直接放在 Eclipse 项目中。
这种情况什么时候最好使用源代码链接?
我总是发现在 Eclipse 项目中拥有源代码更方便
I know that there is the option to have links to source code under your src
directory instead of having the source code files directly in your Eclipse project.
When is this case i.e. links for source code is best used?
I always found it more convenient to have the source code inside the Eclipse project
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我可以想到两个可能的用例。
A
和B
,其中A
依赖于B
。如果您不使用依赖项管理工具或愿意在每次修改 Jar 时从B
构建 Jar 并将其导入到 A,则可以链接到 B 中的源。我确信还有很多其他用例。
I can think of two possible use cases for this.
A
andB
whereA
depends onB
. If your not using a dependency management tool or willing to build and import the Jar fromB
to A each time you modify it, you could link to the source in B instead.I'm sure there are plenty of other use cases floating around.
除了 Kingamajick 提到的之外,您还可能有一个导致路径名过长的结构。
Windows 只能处理这么多字符(旧版本中为 256 个字符),而深层包结构很容易打破该限制。
因此,将类放在顶部附近的浅目录中可以让您的工作空间更深入,并且仍然留有一些摆动的空间。
In addition to what Kingamajick mentions, you could have a structure that causes overly long path names.
Windows can only handle so much (256 characters? in older versions), and a deep package structure easily breaks that limit.
So, having your classes in a shallow directory near the top allows you to have your workspaces deeper down, and still leaves some room to wiggle.
其他场景;您拥有多个操作系统通用的源代码,但 Eclipse 项目是针对每个操作系统的。
您还可以创建与环境变量相关的链接资源的形式。我已将其用于版本控制系统 (ClearCase) 添加用户特定目录名称的情况。
Other scenarios; You have source code which is common for several OS:es, but the Eclipse projects are specific for each OS.
You can also create a form of linked resources that are relative to an environment variable. I've used that for situations where the version control system (ClearCase) adds user-specific catalognames.