本文介绍了如何为特定的O / S平台指定Eclipse .classpath条目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在作为团队的一员从事SWT项目。我们一直在互相破坏对方的构建环境,因为Eclipses .classpath文件已签入版本控制,并且我们为机器包括了不同的SWT库。

I am working on an SWT project as part of a team. We are constantly breaking each others build environment because Eclipses .classpath file is checked into version control and we include different SWT libraries for our machines.

.classpath条目取决于最后提交的人:

Depending on who committed last, the .classpath entry can be:

<classpathentry kind="lib" path="lib/swt/swt-win32.jar"/>

<classpathentry kind="lib" path="lib/swt/swt-carbon.jar"/>

<classpathentry kind="lib" path="lib/swt/swt-gtk.jar"/>

似乎这些库是互斥的,即您不能一次包含所有库并使SWT工作出来。因此,我们需要以某种方式为每个平台筛选它们...

It appears that the libraries are mutually exclusive, i.e. you cannot include them all at once and let SWT work it out. So we need to filter them for each platform somehow...

有人对如何执行此操作有任何想法吗?我最初的想法是将其拆分为自己的 .classpath-swt文件(被VCS忽略),使用Ant自动生成该文件并将其包含在主.classpath中,但是Eclipse不支持拆分该文件。 .classpath文件。

Does anyone have any ideas on how to do this? My initial idea was to split this into its own ".classpath-swt" file (ignored by the VCS), auto-generate it using Ant and include it in the main .classpath, but it seems Eclipse doesn't support splitting up the .classpath file.

我们当前的解决方法是避免提交.classpath,除非我们实际更改了依赖关系,但这仍然意味着许多人必须每次更改.classpath时都要修复其开发环境。

Our current work-around is to avoid committing the .classpath unless we have actually changed the dependencies, however this still means that a number of people have to fix their development environments each time the .classpath is changed.

只要不使用不要使用Eclipse,任何建议都将不胜感激,因为这不是该项目的一个选项:)

Any suggestions will be much appreciated, as long as it's not "don't use Eclipse" as this is not an option for this project :)

推荐答案

Eclipse将允许您定义类路径变量,以便您可以保持.classpath相同,但是每个开发人员都会根据平台配置她的Eclipse。您至少可以对.classpath文件进行版本控制。您必须将存储SWT jar的目录结构更改为jar名称在每个平台上都不会更改的位置。可以在以下菜单中找到此菜单: 窗口->首选项-> Java->构建路径

Eclipse will let you define classpath variables so you can keep the .classpath the same, but each developer would configure her Eclipse according to platform. You could at least then version the .classpath file. You will have to alter the directory structure of where you store your SWT jars to something where the jar name doesn't change per platform. This menu can be found in: "Window->Preferences->Java->Build Path"

SWTJARDIRECTORY/
    WIN32/
        SWT.JAR
    CARBON/
        SWT.JAR
    GTK/
        SWT.JAR

Ex。

    SWT_PLATFORM="SWTJARDIRECTORY/GTK", set by developer in Eclipse

.classpath

.classpath

    SWT_PLATFORM/SWT.JAR

这篇关于如何为特定的O / S平台指定Eclipse .classpath条目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 20:31