Intellij 12 - Can't Reimport Module

冷暖自知 提交于 2021-02-05 19:35:12

问题


So I ran into a strange problem today. I was having some issues with one of my modules in IntelliJ so I decided I should try blowing it out and rebuilding it from a fresh checkout. I deleted the module from the Project window and then deleted / redownloaded from my file system.

I went back to Intellij and tried importing the module. It took me through the normal steps of selecting options and then seemed to succeed. Only it didn't reappear in my projects window.

I'm not sure what I did, but recreating the whole project isn't an option at this point. I'm hoping someone can shine some light on why Intellij is angry with me.

System Specs: Mac OSX Mountain Lion IntelliJ 12.1.4


回答1:


If this is a Gradle module, please check the .idea project folder there is a gradle.xml

  <GradleProjectSettings>
    <option name="distributionType" value="DEFAULT_WRAPPED" />
    <option name="externalProjectPath" value="$PROJECT_DIR$/xxx" />
    <option name="gradleHome" value="/opt/gradle/gradle-2.13" />
    ......
  </GradleProjectSettings>

you should remove this entry and try to reimport your module

I am using Intellij Idea 2016.1.3, Mac OSX El Capitan 10.11.5




回答2:


I also had this problem with an SBT module. You can remove the offending module by going to the SBT tool window, right clicking on the module and selecting "Detach external project".




回答3:


Ah ha! I think I found the answer.

In my .idea project folder there is a misc.xml. In this file I found

<option name="ignoredFiles">
    <set>
        <option value="$PROJECT_DIR$/../Projects/.../module/pom.xml />
    </set>
</option>

I removed that and also cleaned up some duplicate entries from other areas that pertained to my module and I was able to import again.

IntelliJ is pacified for at least another day!




回答4:


1.delete the file .idea/modules/your module.iml 2.edit the file .idea/gradle.xml del about your module like this:

<GradleProjectSettings>
    <option name="distributionType" value="LOCAL" />
    <option name="externalProjectPath" value="$PROJECT_DIR$/../fs-jycloud-monitor" />
    <option name="gradleHome" value="$USER_HOME$/gradle/gradle-2.14.1" />
    <option name="modules">
      <set>
        <option value="$PROJECT_DIR$/../fs-jycloud-monitor" />
      </set>
    </option>
  </GradleProjectSettings>



回答5:


This was resolved by going to GRADLE Tab on the project and removing other modules that needs to be reimported.




回答6:


If you are using a maven structure, it could be that you ignore the poms after unloading modules. Check this at:

File | Settings | Build, Execution, Deployment | Build Tools | Maven | Ignored Files

Uncheck your modules and try again.

(If you have many files listed there, just deselect all via Ctrl + A, Space)




回答7:


A cleaner solution would probably be to first try File -> Invalidate Caches / Restart....




回答8:


I had the same problem with a Gradle module. For me the fix was simply to delete this entry from the .idea/workspace.xml

  <component name="ExternalProjectsManager">
    <system id="GRADLE">
      <state>
        <task path="$PROJECT_DIR$/Locations">
          <activation />
        </task>
        <projects_view>
          <tree_state>
            <expand>
              <path>
                <item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
                <item name="locations" type="f1a62948:ProjectNode" />
              </path>
              <path>
                <item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
                <item name="locations" type="f1a62948:ProjectNode" />
                <item name="Run Configurations" type="7b0102dc:RunConfigurationsNode" />
              </path>
            </expand>
            <select />
          </tree_state>
        </projects_view>
      </state>
    </system>
  </component>



回答9:


Click on your Gradle tab, right-click on your project, click on 'Reload Gradle Project'



来源:https://stackoverflow.com/questions/18881062/intellij-12-cant-reimport-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!