I have a series of related projects that I've placed under Git control (all these projects are in the same workspace, which is the top-level of the Git repository) and cloned from my desktop (32bit) to my laptop (64bit) so I can work on them wherever. The workspace .metadata
folder is excluded, but everything in the project folders is tracked.
我有一系列相关的项目,我放在Git控件下(所有这些项目都在同一个工作区,这是Git存储库的顶层),并从我的桌面(32位)克隆到我的笔记本电脑(64位)所以我可以在任何地方工作。将排除工作空间.metadata文件夹,但会跟踪项目文件夹中的所有内容。
When I opened the cloned workspace on the laptop, I was greeted by an error:
当我在笔记本电脑上打开克隆的工作区时,我遇到了一个错误:
Project 'project' is missing required library:
'/usr/eclipse/plugins/org.eclipse.swt.gtk.linux.x86_3.5.2.v3557f.jar'
Obviously, the 64bit eclipse doesn't have the 32bit libraries, but I'm curious as to how this should be resolved.
显然,64位eclipse没有32位库,但我很好奇如何解决这个问题。
That library was added as part of the Window Builder SWT/JFace Project template. There is a org.eclipse.swt_3.5.2.v3557f.jar
in the eclipse plugins folder, but changing the classpath to look for that doesn't work (doesn't find SWT, oddly). Looking through the rest of the .classpath
file for the SWT/JFace projects, this particular library is the only one that is so platform specific.
该库是作为Window Builder SWT / JFace项目模板的一部分添加的。在eclipse插件文件夹中有一个org.eclipse.swt_3.5.2.v3557f.jar,但更改类路径以查找它不起作用(奇怪地找不到SWT)。查看SWT / JFace项目的.classpath文件的其余部分,这个特定的库是唯一一个特定于平台的库。
I put both versions of the library in the .classpath
and this allows the code to build/run, though I have to ignore the build path error, and this error will propagate back to my desktop when I pull the laptop changes back.
我把这两个版本的库放在.classpath中,这允许代码构建/运行,虽然我必须忽略构建路径错误,当我拉回笔记本电脑的时候,这个错误会传播回我的桌面。
Can I just symlink the 64bit jar on the laptop to the 32bit name so the classpath can find the library? Is there another, better solution?
我可以将笔记本电脑上的64位jar符号链接到32位名称,以便类路径可以找到库吗?还有其他更好的解决方案吗?
UPDATE: It looks like this type of project has to depend on the concrete SWT fragment, so until there's a better solution I'm going to symlink the fragments in question on both machines to direct the compiler to the correct fragment. Building/running the projects on other machines (and especially Windows) will be !!Fun!! but I'll build that bridge when I get there.
更新:看起来这种类型的项目必须依赖于具体的SWT片段,所以在有更好的解决方案之前,我将在两台机器上对这些片段进行符号链接,以将编译器指向正确的片段。在其他机器(尤其是Windows)上构建/运行项目将会很有趣!!但是当我到达那里时,我会建造那座桥梁。
4 个解决方案
#1
1
What exactly are you keeping in your source control?
您在源代码管理中保留了什么?
The best practice is to keep only hand-written source files on source repository. Not binaries, or generated files, or IDE settings.
最佳做法是仅在源存储库中保留手写源文件。不是二进制文件,生成的文件或IDE设置。
I think you have the problem with the IDE settings for your 64bit Eclipse not working with 32bit one.
我认为您的64位Eclipse的IDE设置存在问题,而不适用于32位的Eclipse。
Just delete .metadata
directory in your workspace, and reimport all projects in this Eclipse.
只需删除工作区中的.metadata目录,然后重新导入此Eclipse中的所有项目。
#2
1
Don't do it with the whole workspace. Just do it with the individual projects. Works well here.
不要在整个工作区中使用它。只需对各个项目进行操作即可。在这里运作良好。
#3
1
Which type of the project you are developing? The java project or plug-in project?
您正在开发哪种类型的项目? java项目或插件项目?
If you're developing plug-in project, your project should not directly depend on the concrete swt fragment(such as swt.gtk, swt.win32). It should depend on the host plug-in 'org.eclipse.swt' that the actual implementation of swt is the different fragments in different platforms.
如果您正在开发插件项目,则您的项目不应直接依赖于具体的swt片段(例如swt.gtk,swt.win32)。它应该依赖于主机插件'org.eclipse.swt',即swt的实际实现是不同平台中的不同片段。
If you're developing a java project that requires the swt as the third-party requirement. You can install eclipse delta package for both your 32bit and 64bit eclipse.
如果您正在开发一个需要swt作为第三方要求的java项目。您可以为32bit和64bit eclipse安装eclipse delta软件包。
#4
0
To avoid platform issues, you could also consider Maven. Using Maven 2 or 3, with optional combination of profiles platform issues can be resolved quite easily. Using a few Maven plugins for Eclipse, Maven projects can be imported into Eclipse directly.
为避免平台问题,您还可以考虑使用Maven。使用Maven 2或3,可以很容易地解决配置文件平台问题的可选组合。使用Eclipse的几个Maven插件,可以直接将Maven项目导入Eclipse。
#1
1
What exactly are you keeping in your source control?
您在源代码管理中保留了什么?
The best practice is to keep only hand-written source files on source repository. Not binaries, or generated files, or IDE settings.
最佳做法是仅在源存储库中保留手写源文件。不是二进制文件,生成的文件或IDE设置。
I think you have the problem with the IDE settings for your 64bit Eclipse not working with 32bit one.
我认为您的64位Eclipse的IDE设置存在问题,而不适用于32位的Eclipse。
Just delete .metadata
directory in your workspace, and reimport all projects in this Eclipse.
只需删除工作区中的.metadata目录,然后重新导入此Eclipse中的所有项目。
#2
1
Don't do it with the whole workspace. Just do it with the individual projects. Works well here.
不要在整个工作区中使用它。只需对各个项目进行操作即可。在这里运作良好。
#3
1
Which type of the project you are developing? The java project or plug-in project?
您正在开发哪种类型的项目? java项目或插件项目?
If you're developing plug-in project, your project should not directly depend on the concrete swt fragment(such as swt.gtk, swt.win32). It should depend on the host plug-in 'org.eclipse.swt' that the actual implementation of swt is the different fragments in different platforms.
如果您正在开发插件项目,则您的项目不应直接依赖于具体的swt片段(例如swt.gtk,swt.win32)。它应该依赖于主机插件'org.eclipse.swt',即swt的实际实现是不同平台中的不同片段。
If you're developing a java project that requires the swt as the third-party requirement. You can install eclipse delta package for both your 32bit and 64bit eclipse.
如果您正在开发一个需要swt作为第三方要求的java项目。您可以为32bit和64bit eclipse安装eclipse delta软件包。
#4
0
To avoid platform issues, you could also consider Maven. Using Maven 2 or 3, with optional combination of profiles platform issues can be resolved quite easily. Using a few Maven plugins for Eclipse, Maven projects can be imported into Eclipse directly.
为避免平台问题,您还可以考虑使用Maven。使用Maven 2或3,可以很容易地解决配置文件平台问题的可选组合。使用Eclipse的几个Maven插件,可以直接将Maven项目导入Eclipse。