IntelliJ Idea created extra .iml files when it's not supposed to - intellij-idea

I have this exact same problem as the one in this SO: Cannot build artifact 'ProjectName:war exploded', but when I tried to remove the .iml files and reimport maven project again, the 2 .iml files show up again, these affected the artifacts and other project settings that made me unable to run the project

Use File | New | Project from Existing Sources action and select to delete the existing configuration.

turns out this happened because the project has
pom.xml.versionsBackup file which intelliJ detected as another source of valid pom.xml, I deleted the backup and everything working normally now

Related

Unable to download all maven dependencies

I have multi module maven project in intelliJ 2019.3 (Ultimate)
I am not able to get all dependencies after several tries. I tried below solutions as well
Solution 1
Solution 2
I noticed under the Maven tool same module shows twice as below
Not sure that caused the issue here.
Strangely I don't see any red lines in the any of the POMs
Provided that you can build project from command line Maven and dependencies are downloaded.
In IntelliJ IDEA please try: File | New | Project from Existing Sources action and point to pom.xml file to import project from. Then choose to delete existing project configuration.

How do I rename my entire project in IntelliJ without having so many manual steps?

I have IntelliJ 2019.2
I occassionally mis-name my project during creation.
I have to quit IntelliJ, renaming the folder, opening project again and renaming package and project module manually as well.
Any way to improve this?
Please follow the discussion on the issue: Renaming a project in IntelliJ IDEA
There are project, module name, name in file system etc that can all be different and can be renamed. Rename of folder can be done in file system, project, module rename in the Project Structure settings.

how to correct an incorrectly imported project in Intellij. Getting error - Not a valid project ID

I cloned my repo and using the existing build.sbt, I imported the project in Intellij (I don't remember the setting I used when doing so). I notice that Intellij have the project a name of its own - web_3075 while the name of my project is TestProject (name := "TestProject"). Now when I try to compile the project, I get the error Not a valid project ID: web_3075. How could I solve the issue?
Could I safely delete .idea file and import the project again?
Workaround (but certainly not preferred approach). Unless I made some mistake, Intellij should fix this issue
1) I imported the project using build.sbt. I let Intellij do what it likes
2) It gives my project a name - web_5012. It creates .idea directory which has modules directory and some files. The trick is to replace web_5012 with your project name in all the files in .idea (.NAME file, modules.xml, scala_compiler.xml)and to replace web_5012.iml and web_5012-build.iml in .idea/modules with your project's iml files

IntelliJ IDEA directory-based format and .iml file(s)

We started a directory-based project in IntelliJ IDEA (currently using version 2016.3 build 163.7743.44). Everything is fine, the .iml file is inside .idea/modules and we can easily share/update it.
The issue is that, sometimes, when someone clones the project and start using it the IDE doesn't care about that file (or project structure) and puts an .iml outside the project's root. It's an intermittent/random issue and I'm not able to reproduce it step by step.
We opted for deleting the .idea directory from Git and keep the configurations/settings in a JAR file.
Is there any way to tell the IDE to use one approach or the other? It's not a big deal, but I would like to know what's the reason behind that behavior.
The reason for that behavior may be that people don't use the "Open" action to open the project but use the "Import project from existing sources" action instead. The latter action does not use the existing .idea directory, but instead recreates the project structure from scratch. You should teach your colleagues not to use that action.
Note that storing the settings in a .jar file is not a replacement for sharing the project structure, because shared settings do not include project-specific items such as libraries and run configurations.

How to generate a jar from a java module in IntelliJ with the dependencies placed in a separate directory?

I have a module for which I want a jar to be created. So, here is what I do:
Adding a jar artifact, using the "From module with dependencies ..." option
In "Jar files from libraries" I select "copy to the output directory and link via manifest"
Leave all the defaults.
After that I can build the jar and all the dependencies would be placed near it in the same directory. So far so good.
Now I wish all the dependencies to be placed in a separate directory near the final jar. So, I repeat the same steps, but this time I create a new directory under the node in the artifact Output Layout tab (using the "Create Directory" button). Next I drag all the dependencies onto the new folder and apply the changes.
On the surface, everything is cool - the dependencies are indeed placed in the dedicated directory, but the MANIFEST.MF file is never updated! It should reference the dependencies via the new directory. As of now, the produced jar cannot be run - its dependencies are not visible.
This is unlike Eclipse, which does make sure the manifest file is correct when exporting a project as jar.
How can I workaround this problem, given that:
I want all the dependencies in a dedicated folder.
I want to use IntelliJ IDEA
I do not want to edit the manifest file manually.
I am using the latest download of the IntelliJ IDEA for windows - 11.1.2, build 117.418
Thanks.
At the moment you have to update the classpath manually in the artifact configuration dialog so that it includes the subdirectory:
I've created an issue for this limitation, please star/vote.