IntelliJ IDEA load module error - intellij-idea

I am in IntelliJ IDEA 2017.1.2. I recently renamed a module from mod_plus to exp-packs and now I keep getting the error:
Error Loading Project: Cannot load module mod_plus
The old module does not exist. Under File-> Project Structure->Modules->Dependencies it does not show up, it was there, but I removed it when I first saw the error. It does not show up in the .iml file:
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Pyhton-Snippets" />
<orderEntry type="module" module-name="exp_packs" />
</component>
</module>
In the event log, when I click 'Details' and it asks do I want to remove, I click YES and it is gone for that session, but on restart it comes back. Any thoughts on how to get rid of it?

IntelliJ IDEA loads modules according to .idea/modules.xml file which contains the relative paths to the .iml files.
If you rename a module in IntelliJ IDEA using refactoring, modules.xml file is updated automatically. In other cases you may need to update the path manually.

Related

Intellij: Get rid of iml file

A colleague has downloaded my project which I've composed using IntelliJ-2019.2
On my machine, there is no .iml file (not in project root, nor in .idea folder).
He opened it using IntelliJ-2018.1 and a .iml file was created in project root.
We thought we could: Close IntelliJ-2018, uninstall, install 2019.2, delete the .iml and reopen the project with 2019.2.
However, that .iml file was created again...
Since he will be pushing to a repo, and in general because we want the whole team to work in the same way, I would like to remove this .iml, so that his project is handled by the IDE in the same way as the rest of the team.
How to "migrate" from .iml to whatever project configuration (module description) I am using (which has no .iml)?
if you use git, just add *.iml to the .gitignore file in the root of the project.
checkout https://www.gitignore.io/ to create a .gitignore for you project
in your case you need at least: https://www.gitignore.io/api/intellij
.iml file is a module file and generated by Intellij idea IDE that is used for keeping module configuration.
More info : https://www.jetbrains.com/help/idea/creating-and-managing-modules.html
For most of the people not familiar with module configuration, we don't have to worry about this file. Since it is auto generated file and used by Intellij Idea IDE, it is not needed for other team members.
To get rid of my-project.iml file I have tried 2 ways and both works :
Method 1:
add the .iml file to .gitignore file of you project.
Method 2:
Move it to any other directory on you system.
Move the file to any other directory (I moved it inside .idea directory of project as it waas added to gitignore)
Open module.xml file present in you .idea folder of project
Modify this part and update new path for the .iml file
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/my-project.iml" filepath="$PROJECT_DIR$/.idea/my-project.iml" />
</modules>
</component>
In the case of a vite project that stopped loading when i deleted the .iml file, i noticed (thanks to the second answer) that you can simply replace:
<module fileurl="..../some.iml"></module>
with the contents of some.iml:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<!-- previous contents: -->
<!--<module fileurl=""></module>-->
<!-- replacement contents: -->
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
</modules>
</component>
</project>
and the project works after using the repair ide function to reopen the project.

IntelliJ - Groovy start - Error: Cannot compile Groovy files: no Groovy library is defined

In similar questions I could not find a sufficient answer. I followed the IntelliJ tutorial for Groovy, but it did solve the solution. Finally I solved it via a 1A4 Maven file.
For getting started more easy, maybe you could help me and others with Groovy in IntelliJ.
What did I do:
I installed the Groovy SDK
I started IntelliJ, created a new Groovy project and I could see the library was added.
After creating my first Groovy class, a compile error mentioned:
Error: Cannot compile Groovy files: no Groovy library is defined
I double checked that the library is there. And I also added the library to the module via the File > project structure > libraries. I get this result:
Added on request: I added project structure > modules > dependencies:
How your .iml file looks like?
I repeated all steps from your message and have successfully run GroovyDemo.groovy class without any errors.
My .iml file is:
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="groovy-2.4.15" level="application" />
</component>
</module>
Make sure what you have groovy library inside. If you don't have it, you need to open project setting and add it manually into Libraries or Global Libraries.
I'm using IDEA 2018.1.6 UE. What is your version?
EDIT 1:
I finally reproduce your error.
I delete .idea folder from my project scope;
I open old project and it recreate the whole structure;
After that I see the same error when trying to run groovy class
I fix it by manually add groovy library to the project dependencies.
ctrl+shift+alt+s.place in Project Structure.then setting your Libraries,attending to your groovy install-file-folder lib--> groovy-***.jar。

Intellij 10.8 Command line is too long. Shorten command line in Maven

I have the latest version of intellij 2018.1.1 and I am running a very basic maven project. I get an error message as "Command line is too long" when I try to run main. I updated the run config to JAR Manifest and now intellij doesnt pick up the latest changes in my java files. I am assuming it picks up a pre-made jar and doesnt re-compile? I am trying to figure out how to get intellij to work.
To fix this, Edit the configuration the Run/Debug job in Intellij and select an appropriate "Shorten Command line" value that makes sense for your environment. Then try running the test again. If you are not sure about the correct value, simply try each of them till you get it to work. Here's a screenshot and the value that worked for me on Windows.
In the newer versions of Intellij they've hidden the menu for shortening the command line by clicking "More Options" then select the Short Command Line.
change project/.idea/workspace.xml from
<component name="PropertiesComponent">
...
</component>
to
<component name="PropertiesComponent">
<property name="dynamic.classpath" value="true" />
...
</component>
Inside your .idea folder, change workspace.xml file
Add
<property name="dynamic.classpath" value="true" />
to
<component name="PropertiesComponent">
.
.
.
</component>
Example
<component name="PropertiesComponent">
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
<property name="dynamic.classpath" value="true" />
</component>
Try to delete .idea folder and import the project again. Run 'mvn clean compile' and then run the main method.
I needed to add before launch settings to make it work with JAR Manifest option to shorten command line. This did the trick for me.
Thanks for the quick responses!
I had the same issue and resolved it in :
closing IntelliJ
removing the .idea directory
Reopening the project

Ghost modules in modules.xml

Here is my modules.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/../...iml" filepath="$PROJECT_DIR$/../...iml" />
<module fileurl="file://$PROJECT_DIR$/7Wonders.iml" filepath="$PROJECT_DIR$/7Wonders.iml" />
<module fileurl="file://$PROJECT_DIR$/../AFLib/AFLib.iml" filepath="$PROJECT_DIR$/../AFLib/AFLib.iml" />
<module fileurl="file://$USER_HOME$/Documents.iml" filepath="$USER_HOME$/Documents.iml" />
<module fileurl="file://$USER_HOME$/Documents.iml" filepath="$USER_HOME$/Documents.iml" />
<module fileurl="file://$USER_HOME$/Documents.iml" filepath="$USER_HOME$/Documents.iml" />
<module fileurl="file://$PROJECT_DIR$/../MultiConnect/MultiConnect.iml" filepath="$PROJECT_DIR$/../MultiConnect/MultiConnect.iml" />
<module fileurl="file://$PROJECT_DIR$/../MultiConnect/lib/MultiConnect-lib.iml" filepath="$PROJECT_DIR$/../MultiConnect/lib/MultiConnect-lib.iml" />
<module fileurl="file://$PROJECT_DIR$/_7Wonders/_7Wonders.iml" filepath="$PROJECT_DIR$/_7Wonders/_7Wonders.iml" />
<module fileurl="file://$PROJECT_DIR$/../AFLib/lib/lib.iml" filepath="$PROJECT_DIR$/../AFLib/lib/lib.iml" />
</modules>
</component>
</project>
"7 Wonders" is the app, "MultiConnect" and "AFLib" are my libraries.
The stuff starting with $USER_HOME is completely unneeded: there is no Documents.iml file. I delete these lines, Android Studio adds them back. Then it complains that it can't open a module... 2 modules... 3 modules... and so on, until I delete those lines manually again. If I click on "Details" in the error message, it offers to remove those modules from the project, but that doesn't seem to have any effect. I even tried to make the modules.xml file read-only, but Android Studio complains and refuses to work.
This issue does not affect usability, but seeing that "Error Loading Project" every single time is rather annoying.
I don't need the ...iml file (the 1st line) either, but at least the Studio doesn't complain about it, and doesn't add several copies of it.
Can anyone explain what's going on?
There could be many reasons why this is happening.
1. Uninstall plugin "Markdown support" from plugins in settings.
Try compiling the whole project before gradle refresh is done. And set gradle settings as "Offline Work".
This will save a lot of time and will also save on re-installation of gradle dependencies. This re-install probably will cause refresh in modules.xml

Windows 8 App Manifest: Image Assets Error

These images default VS images.But it doesn't work.
Error 4 Payload file
'C:\Users\Mert\documents\visual studio 2012\Projects\Y\P\Assets\StoreLogo.scale-100.png' does not exist.
Error 3 Payload file
'C:\Users\Mert\documents\visual studio 2012\Projects\Y\P\Assets\SplashScreen.scale-100.png' does not exist.
Error 2 Payload file
'C:\Users\Mert\documents\visual studio 2012\Projects\Y\P\Assets\SmallLogo.targetsize-32.png' does not exist.
Error 1 Payload file
'C:\Users\Mert\documents\visual studio 2012\Projects\Y\P\Assets\SmallLogo.scale-100.png' does not exist.
I know question is incomprehensible but I don't find different way to explain.
Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="" Publisher="CN=Mert" Version="1.0.0.0" />
<Properties>
<DisplayName>Y</DisplayName>
<PublisherDisplayName>Mert</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Y.App">
<VisualElements DisplayName="Y" Logo="Assets\Logo.png" SmallLogo="Assets\SmallLogo.png" Description="Y" ForegroundText="light" BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>
I also had this problem last day. I noticed that when I deleted an image from assert, it wont delete its occurrence from the Solution explorer in Visual Studio. Delete those files from solution explorer fixed the issue.
Cheers...!
I just encountered this myself.
It seems Visual Studio can't handle a trial-and-error approach for logos.
I got rid of it by manually editing the .csproj file and removing the missing assets from there.
There is a workaround by setting the Generate App Bundle setting to Never.