我想在控制台和Intellij中使用Git作为我的

时间:2015-11-29 10:51:32

标签: java eclipse git intellij-idea

我想与Intellij合作,但没有它的git插件。 我在控制台中使用eclipse + git,从来没有遇到过问题。只需推/拉/提交/添加等,并用eclipse打开文件。 现在我已经切换到Intellij,无论我如何打开/导入拉出的文件到Intellij,我都会遇到很多错误。

大多数时候它看起来像这样:

 Exception in thread "main" java.lang.NullPointerException
    at Test.main(Test.java:18)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

甚至这个:

Exception in thread "main" java.io.FileNotFoundException: C:\Users\John\Desktop\Test\Program\GitFiles\GG\DC\out\production\DC\level1.txt (The system cannot find the specified path.)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileReader.<init>(FileReader.java:72)
at model.Map.mapImport(Map.java:35)
at model.Map.<init>(Map.java:26)
at model.Model.initialize(Model.java:120)
at model.Model.<init>(Model.java:37)
at Test.main(Test.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

但是,有没有办法绝对正确地将项目文件导入到已通过Git正确提取的Intellij中? 我甚至怀疑来自Intellij的Git-Plugin会破坏一切,因为它注意到我正在使用的文件夹上有Git。

我已经浪费了很多时间来解决这个问题,我会对帮助感到非常高兴!

问候, 约翰

2 个答案:

答案 0 :(得分:2)

如果你不想在IntelliJ中使用Git,你应该禁用它。转到配置(在欢迎菜单中)&gt;插件&gt; Git Integration,并取消选择它。 Looks like this

希望它对你有所帮助。

答案 1 :(得分:1)

终于做到了。我之前玩过输出路径设置,但是我错过了一个配置:

<强> 1。项目设置 - 项目 - 输出路径(选择EXTERNAL输出(不选择项目文件本身),您想要的任何其他地方)   2.Project Settings - Modules - Paths - 继承项目编译输出路径。