Intellij is not showing "External Libraries" in Project Tab - intellij-idea

There is nothing on left. It is a maven project. Why?

I've had the same problem and narrowed it down to the following configuration that might have been messed up during the upgrade.
File (on Mac): ~/Library/Preferences/IntelliJIdea2018.1/options/projectView.xml
<application>
<component name="ProjectViewSharedSettings">
<option name="showLibraryContents" value="false" />
<option name="showMembers" value="true" />
</component>
</application>
Change/remove the showLibraryContents entry. This setting is no longer available in the UI, "External Libraries" are always shown.

I solved this by selecting "Project" as view (by default i had "Project Files"). Hope this helped.
Project View VS. Project Files view

I was facing the same issue on windows, i solved it by
right click on pom.xml > maven > reimport
Then reopen the project, It worked for me.

Hmmm, it seems I have seen this same kind of thing recently. Check your module settings (right click on highest level folder - open module settings, or Command-;). Make sure you have one module if it is a single-POM project, and check the sources, paths, dependencies tabs and make sure they look right. I think I've seen this once when I created a module manually rather than letting intellij create one for the Maven module automatically.
That "recycle/refresh" icon on the far right pane you show - the Maven project pane - can also sometimes get it to fix things it didn't get right when you initially check out project.

If maven re-import does nothing, check your pom.xml for errors and try commenting out the offending ones (marked in red).
In Intellij: Ctrl + Alt + Shift + S -> Select Modules and ensure that there is only one module. Delete the other ones.
If all else fails:
In Intellij, Select "Invalidate caches/Restart" -> Close Intellij -> Go to the project folder and delete .idea folder -> Reopen Intellij and "mvn clean install"

Deleting ./idea directory and re-importing the project worked for it.

Related

When IntelliJ starts up I always have te reimport my Maven dependencies

When I start up my IntelliJ IDEA, all my classes and feature files are not being recognized.
When I reimport all my maven dependencies, it is just working fine, but I have to do this every time I start IntelliJ up.
Is this a setting issue or does anyone has any idea?
It looks like your folders are missing marked "Sources Root", "Test Sources Root" and "Test Resources" -> you can right click on src/main/java, src/test/java and src/test/resources and choose "Mark Directory As..." to do this.
When you first created the intellij project, if you created it off the pom.xml then these folder designations should be in place (since you are following the default). But in your screenshot they arent, so something is amiss here.
Try to add them manually, and see how you go.

Intellij maven not exist

Maven on the intellij was unavailable(think removed).I can not make new maven project or import dependency form pom.xml using: right click->maven->reImport.No maven option exist when right click.
Maybe Maven integration is disabled.
Windows: Navigate File > Settings > Plugins
MacOS: Navigate Preferences > Plugins
Then switch to Installed tab, search for maven and click enable button.
https://www.jetbrains.com/help/idea/managing-plugins.html
It looks like the installation iscorrupted.
Remove the .IntellijXX or .IdeaICXX settings folder, which can be found under in the current user directory and after restarting Intellij, it should recreate everything fixing the problem.
Apart from getting the Maven option on right click on a project, there is a Maven option on the right hand side of intellij (As shown below, and highlighted). Click on the circle arrows icon for re-importing maven dependencies.
Usually if you open settings and search for the term "maven" you should be able to see under "Build, execution deployment" - "Maven" with its corresponding settings. The Maven Home directory should point to a valid maven installation. For example:
(unix
$ /home/xy/intellij/plugins/maven/lib/maven3
If that doesnt work, try to reinstall intellij by either through intellij (windows software remove) or removing the config files in your home directory
(unix)
$ /home/xy/.intellijXY
(windows)
%USERPROFILE%\.IdeaICXX
In the file menu select settings -> plugins.
search for maven, select maven, select enable. Restart intellij.
Once restarted you will now have the option to start new maven project and maven functionality will be accessible in all your previous projects.
Tried a few solutions but this is the only thing that worked. In short make sure maven is ON for you.
Try navigating to the pom.xml file and open as a project.
Maven is not integrated
Navigate to File > Settings > Plugins
Search for 'maven' here and add it
Click on enable and restart the intellij
You will be able to find 'maven'

Unable to make the module: related gradle configuration was not found. Please, re-import the Gradle project and try again

I use IntelliJ IDEA Ultimate 14 and Gradle 1.2. I manage the project from the console, but I need to debug some of the code from the IDE.
When I try to make the project, this error window appears. When I try to debug the project,
Error: Unable to make the module: idappcli, related Gradle configuration was not found.
Please, re-import the Gradle project and try again.
is written in the message window. How can I add the regular output paths to the project?
Try by opening the gradle task view and then click the refresh button. For me it solved the problem.
I also had a similar problem,
Go to : View -> Tool Windows -> Gradle.
Then press in Refresh Icon
This fixed the issue "Please, re-import the Gradle project and try again." for me (IntelliJ Ultimate 17.3.3):
(1) Detached Gradle project:
(2) Closed the project and (3) re-opened it via File > Open recent. IntelliJ will promt to import the now unlinked Gradle project. (4) Imported it and selected "Use auto-import" in the dialog.
I had the same problem with my Intellij IDEA version 2016.2 (Mac)
The solution was: In Intellij, Click on "View" then "Tool Windows" then "Gradle" then click on
I had to make sure the Use auto-import and the Use default gradle wrapper (recommended) were both checked.
File > Other Settings > Default Settings > Build, Execution, Deployment > Build Tools > Gradle
I faced the similar issue when i update my IntelliJ Idea.
To fix it i ran the below command in terminal and it fixed my problem.
gradle cleanIdea idea
For most people the refresh of Gradle that has already been suggested might solve the issue.
For the others I figured out, that deleting the .idea direcotory and reimporting the project might help.
It can be that your resources directory is not added to classpath when creating a project via Spring Initializr. So your application is never loading the application.properties file that you have configured.
To make a quick test if this is the case, add the following to your application.properties file:
server.port=8081
Now when running your application you should see in the spring boot console output something like this:
INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): **8081** (http) with context path ''
If your port is still default 8080 and not changed to 8081, your application.properties files is obviously not loading.
You can also check if your application runs with gradle bootRun from command line. Which most likely will be work.
Solution:
Close IntelliJ, then inside your project folder delete the ".idea" folder
Reimport your project to IntelliJ like following: "Import Project" -> "select ONLY your build.gradle file to import". (IntelliJ will automatically grab the rest)
build and run your application again
See official answer by IntelliJ Support:
IDEA-221673
This works for me:
Close the IntelliJ Idea
Delete 'gradle' and '.gradle' folders from the project root
Start IntelliJ Idea and import the project as gradle
In my case the root cause was a missing proxy configuration. Once I configured it properly I was able to Refresh gradle projects and it finally downloaded missing files and set up the project correctly.
File > Settings > Appearance & Behaviour > System Settings > HTTP proxy
then
View > Tool Windows > Gradle
and Synchronize button
I went into the IntelliJ Gradle preferences:
Menu: Preferences > Build, Execution, Deployment > Build Tools > Gradle
And under Project Level Settings, switched the radio button to "Use default gradle wrapper (recommended)"
Hit the make button, and was in business!
#user1339 I also had the same problem. Please, read this question Building war with Gradle, Debugging with IntelliJ IDEA. It'll be very helpful for you. And recommendation for the 'Make' task. As message said, I should try to re-import the Gradle project and try again. In my case this advice became very helpful.
I recommend to try to 'Build > Rebuild Project'.

How to see java files in project tree in intellij idea?

I'm working with intellij idea but I can't see the java source files in the project tree. I see the packages, I can open it, but the class files are not displayed. Any idea? This has worked until a few days ago...
Under the intelliJ IDEA 14.0.3 community edition, upon launch I don't see my project folders. I found by going into
View > Tool Windows > Project
seems to show the folder structure.. Same as ALT + 1
Below the menubar , on the left there is a dropdown which in your case may be showing "packages" now (because you can see the packages). From the same dropdown, select "Project Files" below "SCOPES"
You need to check out the project correctly if you are checking out from SVN repo or you must not have selected correct project folder.
You can also configure your project from File->Project Structure check your Source folder is excluded or not.
Also Alt+1 will give you project structure of files in tree format
Check in "Project Structure" (ctrl+alt+shift+S) if you didn't set your source as "Excluded" (in Modules, sources).
If you are develop a maven project, you could run mvn idea:idea and then open the project in your Intellij, the source files and the project tree would become the shape you like.

How to open and edit multiple projects in the same window?

I build in maven multiple projects (let's name them A,B,C). Project A uses .jar of project B which uses .jar of project C.
I am modifying the code of all A/B/C projects, (A is MVC app, B are business services and C is some shared layer).
The thing is, in Eclipse/NetBeans I can see all of them at once and it's comfortable to modify them. In IDEA though, I have to open 3 instances (or n instances) of IntelliJ IDEA.
Am I missing something? Is there better approach when using IntelliJ? This is the biggest downside of IntelliJ for me atm.
I think this has improved with recent versions of IntelliJ. In my current version (12.0.2), you can add any number of separate Maven projects to the same "workspace".
The simplest way I've found to do this is to click the little + icon in the "Maven Projects" window (View > Tool Windows > Maven Projects) and then select the additional pom file you want to import.
Step 1: open "Maven Projects"
Step 2: select the project you want to import:
Prequisite
Having all the related projects in the same root directory
can be helpful.
Steps
1) First you create a new Empty project
2) Then you select the root directory of all your projects.
This will create a empty project, with a .idea directory that will simply remember the module organisation we are about to do in the next step
3) Then, in the next window, you import the different projects as modules
4) In the next window, to import each project, simply double click on the build.gradle, or pom.xml
The project will be imported as a new module.
5) Done, you now have all your projects as modules, opened on the same IntelliJ project
Yes, your intuition was good. You shouldn't use three instances of intellij. You can open one Project and add other 'parts' of application as Modules. Add them via project browser, default hotkey is alt+1
In IntelliJ 14.1.2, I did it like following:
Select File->Project Structure->Modules.
Select + and Import Module and select the directory of your project(or directory where pom exists) and click OK.
Follow through the next flow of screens and after you click Finish, you should see the project alongside your existing one.
None of the solutions worked for me, since I am not working on Maven projects. There is a simpler solution. Go to:
File->Project Structure->Modules.
Instead of adding module, simply click the third option (copy). Browse your local directory and select the project you would like to add. Module name will resolve automatically. That's it.
Update: When you want to reopen to project with multiple sub-projects, in order to avoid re-doing steps as described above, just go to
File->Open Recent->'Your Big Project'.
Since macOS Big Sur and IntelliJ IDEA 2020.3.2 you can use "open projects in tabs on macOS Big Sur" feature. To use it, you have to enable this feature in your system settings:
System Preferences -> General -> Prefer tabs [always] when opening documents
After this step, when you will try to open second project in IntelliJ, choose New Window (yes, New Window, not This Window).
It should result with opening new project in same window, but in the new card:
To expand #Neo answer:
after choosing your directory. select import module from external model and choose your model (maven in this case).
Then check keep project files option from next dialog. It will keep all files in original directory.
Your final project structure would be something like this.
Now you can add your module as dependency to other module's pom.xml and if you change the source code of your dependencies, Intellij takes care of updating your project (there is no need to run mvn build manually for dependencies)
new empty project
File -> New -> Module from Existing Sources
For who uses Gradle can also avail the same:
Go to:
1. View --> Tool Windows --> Gradle
2. Click on the + button and add your build.gradle file
Open preference -> appearance & behaviour -> System settings -> select (open project in new window) then apply.
Then you could open and edit multiple projects.
You can use Armory plugin which makes switching between projects comfortable. The default shortcut for Project List is Alt + A.
By default currently opened projects are displayed at the top of this list (with bold style).
Use the button for the add maven projects and go inside the folder of the project. Then, select the pom.xml file and add them in the IntelliJ.
Press "F4" on windows which will open up "Project Structure" and then click "+" icon or "Alt + Insert" to select a new project to be imported; then click OK button...
To Intellij IDEA 2019.2, F4 + click on module, click to + for add any project from your HDD, above this menu yo can edit the IDE with you create the project and more options, very easy
For people not using maven to build and wanting to add a new project (I am using intellij 14.1.3):
Right click the top level folder in the project view, select new ->
Module
Name the module the same name as the project to be added
From the top menu select File->New->Project. Enter the same name as
the new module, same folder locations as well.
Open the Project, and wait for intellij to create the project
structure.
Close this new project, and open the original project the module was
added to in step 2
Depending on your builder, additional steps will be needed to add it to the build process.
For SBT, and in the top level project I modified the Build.scala file to aggregate the new project, and added the project in the SBT projects window. More info on SBT multiproject builds: http://www.scala-sbt.org/0.12.2/docs/Getting-Started/Multi-Project.html
"IntelliJ IDEA 2022.1.1 (Community Edition)" you have to navigate
To Add Exiting Module to same window navigate "File -> New -> Module from Existing Sources" then it will allow you to select pom.xml and then click "Create" button next window then project will be added to your current workspace.
Note :: Who ever switches from Eclipse to Intellij this is the first problem
Assuming they are under the same folder, click File-Open File or Project-<parent folder>.
you can use import module option which will open it just like eclipse in the same navigator.
For IntelliJ Idea 2021.3.3 users, The below solution didn't work for me, although I was selecting my project main folder, I've gotten only the main and test folders imported!
Peoject Structure => Modules => Import module
The solution is:
view => tool Windows => Maven => click the + icon => add the project POM.xml file
I am new to maven and did not understand how I could work with local maven project added through Viktor Nordling's answer and still have a proper dependency in pom.xml file. The answer is simple: intellij first looks at your locally added module and if it doesn't find one it goes to get the project remotely. You can check this by looking at "external libraries" under your project browser when you add or remove maven module.
Hope this helps anyone.
As of release 2019.2, this is as easy as File->Attach Project.
🎉🎉🎉🎉🎉
See: https://youtrack.jetbrains.com/issue/WEB-7968
After importing project into IntelliJ, Go to pom.xml of each module -> right click -> Click on Add as Moven Project. It will add the module as Moven project, do this for all the modules in the Project. Refer this