简体   繁体   English

无法转换项目... Intellij IDE 中的文件过早结束错误

[英]Cannot convert project… Premature end of file error in Intellij IDE

I am using Intellij IDEA as an IDE for running Java programs.我使用 Intellij IDEA 作为运行 Java 程序的 IDE。 Dues to power fluctuation computer got restarted.由于电源波动,计算机重新启动。 Now when I launch the IDE after reboot i am getting the error Cannot convert project: /home/aniket/IdeaProjects/JavaDemoCodes/.idea/workspace.xml: Error on line -1: Premature end of file.现在,当我在重新启动后启动 IDE 时,出现错误Cannot convert project: /home/aniket/IdeaProjects/JavaDemoCodes/.idea/workspace.xml: Error on line -1: Premature end of file.

Has anyone encountered this situation before?有没有人遇到过这种情况? What can I do to view my project back again?我该怎么做才能再次查看我的项目?

I also had this after a power failure, I simply deleted the workspace.xml file from the projects .idea folder, restarted IntelliJ and it seemed to be OK apart from loosing which files were open.我在断电后也遇到过这个问题,我只是从项目 .idea 文件夹中删除了 workspace.xml 文件,重新启动了 IntelliJ,除了丢失打开的文件之外似乎还可以。

Cheers, Nick干杯,尼克

I had this exact error when my laptop bluescreened.当我的笔记本电脑蓝屏时,我遇到了这个确切的错误。 I solved it by:我通过以下方式解决了它:

  • Exit IntelliJ IDEA退出 IntelliJ IDEA
  • Rename .idea folder重命名 .idea 文件夹
  • Start IntelliJ IDEA启动 IntelliJ IDEA
  • Create new project from existing sources从现有源创建新项目
  • Exit IntelliJ IDEA退出 IntelliJ IDEA
  • Copy all files from old .idea folder to newly created one.将旧的 .idea 文件夹中的所有文件复制到新创建的文件夹中。
  • Restart IntelliJ IDEA重启 IntelliJ IDEA

Finally solved the problem.终于解决了问题。 Hers is the solution.她的就是解决方案。 First of all I had two Intellij IDEA projects open in two separate windows.首先,我在两个单独的窗口中打开了两个 Intellij IDEA 项目。

One was the project which had corresponding subversion repository.一个是有对应subversion仓库的项目。 This was a file-based format project .这是一个file-based format project Files that define a project are .iws, .ipr and .iml .定义项目的文件是.iws, .ipr and .iml .iws is the one corresponding to the workspace configuration. .iws 是对应于工作区配置的那个。 I just reverted back this file with svn revert project.iws and I could launch my project again.我刚刚用svn revert project.iws恢复了这个文件,我可以再次启动我的项目。

But the problem in second project JavaDemoCodes still persisted as it was custom project I created and it looks by default we get a directory-based format project instead of file-based format project .但是第二个项目JavaDemoCodes的问题仍然存在,因为它是我创建的自定义项目,并且默认情况下我们得到的是基于目录的格式项目而不是基于file-based format project This has all its configurations in /home/aniket/.IdeaIC12 directory.它的所有配置都在 /home/aniket/.IdeaIC12 目录中。 As many of you suggested i searched for workspace.xml here but could not find it.正如你们中的许多人建议我在这里搜索 workspace.xml 但找不到它。 I tried find . -name *.xml我试过find . -name *.xml find . -name *.xml but i still could not find it(Also as the error suggests there is no file /home/aniket/IdeaProjects/JavaDemoCodes/.idea/workspace.xml ).Finally I did import project from my first project(the one with svn repo) it detected my JavaDemoCodes project as Intellij IDEA project and let me open it in new window. find . -name *.xml但我仍然找不到它(同样因为错误表明没有文件/home/aniket/IdeaProjects/JavaDemoCodes/.idea/workspace.xml )。最后我从我的第一个项目(the一个带有 svn repo)它检测到我的JavaDemoCodes项目是 Intellij IDEA 项目,并让我在新窗口中打开它。

Not sure if this is the perfect answer but it solved my problem and yes as someone suggested I deleted .iws file from my 1st svn repo based project and tried to restart but was of no help.不确定这是否是完美的答案,但它解决了我的问题,是的,因为有人建议我从我的第一个基于 svn repo 的项目中删除 .iws 文件并尝试重新启动但没有帮助。 New .iws file was created but it still gave me the same error.创建了新的 .iws 文件,但它仍然给了我同样的错误。

I have experienced this same problem.我也遇到过同样的问题。 It happens to me when I have IntelliJ open and for whatever reason (usually problems with having multiple VPN connections open), my computer freezes and I have to do a forced re-boot.当我打开 IntelliJ 时,无论出于何种原因(通常是打开多个 VPN 连接的问题),我的计算机都会死机,我不得不强制重新启动。

My solution is to use Windows 7 restore.我的解决方案是使用 Windows 7 还原。 I'll go to the folder it is complaining about, right click on it, and do a restore.我会转到它抱怨的文件夹,右键单击它,然后进行还原。 If I'm lucky, I have a restore point only a few days old.如果幸运的话,我有一个只有几天大的还原点。

For me, rebuilding my configuration on several projects from scratch is too time consuming.对我来说,从头开始在几个项目上重建我的配置太耗时了。 Using a restore point from a few days or even a week makes more sense.使用几天甚至一周的还原点更有意义。

Good luck.祝你好运。

我只是通过创建一个新项目,然后启动它,然后重新打开旧项目来解决它。

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

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