简体   繁体   English

Eclipse无法识别代码中的更改

[英]Eclipse not recognizing changes in code

A friend and I are working on a java project in Eclipse. 我和朋友正在Eclipse中研究一个java项目。 Whenever we "ship" a new version we export it to a runnable jar. 每当我们“发布”新版本时,我们将其导出到可运行的jar。

It seems whenever we try to send the file back and forth (over google drive) to work on separate parts of it something gets messed up. 似乎每当我们尝试来回发送文件(通过谷歌驱动器)来处理它的单独部分时,一些东西就搞砸了。 This doesn't happen for him, but when I download the file from Google Drive, Eclipse does not recognize any change I make to the src. 这对他来说不会发生,但是当我从Google Drive下载文件时,Eclipse无法识别我对src所做的任何更改。

It doesn't matter how many times I change the workspace, move/ rename the file, clean/ build the project. 无论我多少次更改工作区,移动/重命名文件,清理/构建项目。 Nothing seems to be solving this problem. 似乎没有什么能解决这个问题。 Any advice on why this is happening and how to fix it? 关于为什么会发生这种情况以及如何解决这个问题的建议?

It would be infinitely better for the both of you if you looked into some kind of source control system, as opposed to a file sent through a file sharing service. 这将是你们俩无限美好的,如果你看着某种源代码控制系统的,而不是通过文件共享服务发送的文件。

Sharing the source code in a JAR doesn't allow you to: 在JAR中共享源代码不允许您:

  • Keep a revision of known working code, in case something breaks 保留已知工作代码的修订版,以防万一
  • Reliably import the code 可靠地导入代码
  • Keep track of changes (who did what to what file, etc) 跟踪变化(谁对文件做了什么,等等)

Look into something that's suitable for sharing between users. 研究适合用户之间共享的内容。 GitHub and BitBucket both offer free Git hosting , which is a very popular source versioning tool. GitHubBitBucket都提供免费的Git托管 ,这是一个非常受欢迎的源版本控制工具。

Eclipse is probably building the new version of the runnable JAR in the project's output directory, which by default is something like %PROJECTDIR%/target. Eclipse可能正在项目的输出目录中构建可运行的JAR的新版本,默认情况下类似于%PROJECTDIR%/ target。 The new version of the JAR with your changes will be there, and you'll have to export them again to trade files back again. 随着您的更改的JAR的新版本将存在,您将不得不再次导出它们以再次交换文件。 See also: How do I change a Java project's bin folder in Eclipse? 另请参阅: 如何在Eclipse中更改Java项目的bin文件夹?

这可能是因为它没有更新你的.class ,尝试删除项目“ target ”文件夹的.class,make clean(项目 - 清理)并再次保存更改

There are many steps where you can solved it, 有很多步骤可以解决它,

  • Clean Project and Re-Build 清洁项目并重建
  • Remove .metaData and .settings from Workspace 从Workspace中删除.metaData和.settings
  • Clear cache 清除缓存

  • In my case, I have tried much more and I got to resolve it by removing Classes, test-classes folders if Its there in Target folder 在我的情况下,我已经尝试了更多,我必须通过删除Classes,测试类文件夹,如果它在Target文件夹中解决它

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM