Occasionally I see eclipse lose the reference to the third party jars contained in the a projects. (you get the the build path error stating the jar cannot be found)
偶尔我看到eclipse失去了对项目中包含的第三方罐子的引用。 (你得到了构建路径错误,说明无法找到jar)
Its easy enough to fix as you can remove the jar, save the properties of the project and then go in and re-add the jar that it could not find, eclipse can then see the path to the jar and you can then compile again.
它很容易修复,因为你可以删除jar,保存项目的属性,然后进入并重新添加它找不到的jar,eclipse然后可以看到jar的路径,然后你可以再次编译。
the problem is that if you have a lot of projects in your build you would have to do this task a lot.
问题是,如果你的构建中有很多项目,你将不得不做很多事情。
Is there anything you can do to force eclipse to recognise that it actually has the jar on its classpath?
有什么办法可以强迫eclipse识别它的类路径上有jar吗?
2 个解决方案
#1
I have also faced the similar situation many times with my projects in eclipse. The jar file path is correct in the .classpath file and the jar is present still eclipse do that. To fix it you open the .classpath file and resave it and refresh the probject in eclipse and it builds fine.
我在Eclipse中的项目也多次遇到过类似的情况。 jar文件路径在.classpath文件中是正确的,并且jar仍然存在eclipse那样做。要修复它,你打开.classpath文件并重新保存它并在eclipse中刷新probject并且它构建正常。
#2
That's a weird behaviour...
这是一种奇怪的行为......
If that's ok you can use Maven 2 for your projects. This means that you have to follow Maven's project structure, which is quite ok, but it can be a pain if you decide to migrate old projects.
如果没关系,您可以将Maven 2用于您的项目。这意味着您必须遵循Maven的项目结构,这是相当不错的,但如果您决定迁移旧项目,则可能会很痛苦。
Then you can run mvn eclipse:eclipse whenever you want and that will fix your problem in a few seconds.
然后你可以随时运行mvn eclipse:eclipse,这将在几秒钟内修复你的问题。
#1
I have also faced the similar situation many times with my projects in eclipse. The jar file path is correct in the .classpath file and the jar is present still eclipse do that. To fix it you open the .classpath file and resave it and refresh the probject in eclipse and it builds fine.
我在Eclipse中的项目也多次遇到过类似的情况。 jar文件路径在.classpath文件中是正确的,并且jar仍然存在eclipse那样做。要修复它,你打开.classpath文件并重新保存它并在eclipse中刷新probject并且它构建正常。
#2
That's a weird behaviour...
这是一种奇怪的行为......
If that's ok you can use Maven 2 for your projects. This means that you have to follow Maven's project structure, which is quite ok, but it can be a pain if you decide to migrate old projects.
如果没关系,您可以将Maven 2用于您的项目。这意味着您必须遵循Maven的项目结构,这是相当不错的,但如果您决定迁移旧项目,则可能会很痛苦。
Then you can run mvn eclipse:eclipse whenever you want and that will fix your problem in a few seconds.
然后你可以随时运行mvn eclipse:eclipse,这将在几秒钟内修复你的问题。