什么是Eclipse .classpath / .project文件? [英] What's in an Eclipse .classpath/.project file?

查看:166
本文介绍了什么是Eclipse .classpath / .project文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近对我们的一个团队成员有一个Eclipse项目的问题。 Tomcat没有部署应用程序的JAR。



我们最终注意到 .classpath Eclipse文件与项目确定的团队成员不同。我们将一个项目替换为 .classpath 文件,而Tomcat部署完成。



只需出于好奇,并且知道如果出现错误,将来会发现什么, .classpath .project 文件。我可以添加什么,这是什么意思?

解决方案

Eclipse是一个用于插件的运行时环境。几乎所有您在Eclipse中看到的内容都是Eclipse上安装的插件的结果,而不是Eclipse本身。



.project 文件由核心Eclipse平台维护,其目标是从通用的独立于插件的Eclipse视图来描述项目。项目名称是什么?工作空间中还涉及到哪些其他项目?为了构建项目而使用的构建器是什么? (记住,构建的概念不是专门针对Java项目,而是与其他类型的项目有关)



.classpath 文件由Eclipse的JDT功能(功能 =插件集)维护。 JDT在项目中包含多个这样的meta文件(参见项目中的 .settings 目录); .classpath 文件只是其中之一。具体来说, .classpath 文件包含JDT功能为正确编译项目所需的信息:项目的源文件夹(即 编译);输出文件夹(在哪里编译);和类路径条目(例如工作区中的其他项目,文件系统上的任意JAR文件等)。



将这些文件从一台机器盲目复制到另一台机器有风险。例如,如果任意的JAR文件放置在类路径上(即位于工作区外部的JAR文件,并通过绝对路径命名引用),则 .classpath 文件呈现为不可移植的,必须进行修改才能移植。有确保 .classpath 文件可移植性的一些最佳做法。


We recently had an issue with an Eclipse project for one of our team members. Tomcat was not deploying JARs of the application.

We eventually noticed the .classpath Eclipse file was not the same as for the team members where the project was OK. We replaced the .classpath file with one from a project that was OK and the Tomcat deploy was complete.

Just out of curiosity and to know at what to look in the future if something is wrong, what is inside the .classpath and .project files. What can I add in there, what does it all mean?

解决方案

Eclipse is a runtime environment for plugins. Virtually everything you see in Eclipse is the result of plugins installed on Eclipse, rather than Eclipse itself.

The .project file is maintained by the core Eclipse platform, and its goal is to describe the project from a generic, plugin-independent Eclipse view. What's the project's name? what other projects in the workspace does it refer to? What are the builders that are used in order to build the project? (remember, the concept of "build" doesn't pertain specifically to Java projects, but also to other types of projects)

The .classpath file is maintained by Eclipse's JDT feature (feature = set of plugins). JDT holds multiple such "meta" files in the project (see the .settings directory inside the project); the .classpath file is just one of them. Specifically, the .classpath file contains information that the JDT feature needs in order to properly compile the project: the project's source folders (that is, what to compile); the output folders (where to compile to); and classpath entries (such as other projects in the workspace, arbitrary JAR files on the file system, and so forth).

Blindly copying such files from one machine to another may be risky. For example, if arbitrary JAR files are placed on the classpath (that is, JAR files that are located outside the workspace and are referred-to by absolute path naming), the .classpath file is rendered non-portable and must be modified in order to be portable. There are certain best practices that can be followed to guarantee .classpath file portability.

这篇关于什么是Eclipse .classpath / .project文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆