IntelliJ: display folder structure like NetBeans - intellij-idea

I prefer IntelliJ over NetBeans for Maven Java development, but I'm wondering how to get the displayed project structure that NetBeans has into my IntelliJ project. Please see the image below.
Edit: some more information about what I want.
IntelliJ displays the actual folder layout: the folder webapp is under root/main/webapp. However, NetBeans recognizes that this is an important folder and pulls it up to project level, so virtually root/webapp. This is just a visual thing: in reality the folders remain the same.
In this example, the folder is only 1 tier lower in IntelliJ than in NetBeans. But sometimes, the webapp folder is in root/./././webapp (example). Having to open 5 folders before finally ariving at the webapp folder is annoying and by pulling it up it is clearer and it saves time.

Go to settings(as shows in image) of Project Structure.
Then select Flatten Packages and Hide Entry Middle Packages. You will get structure like Netbeans in the IntelliJ
For more details please visit: https://www.jetbrains.com/help/idea/2017.1/project-tool-window.html

Related

How to see dependency tree for JARS in IntelliJ using SBT

I am using intelliJ IDEA 2017.2.5 for spark-scala using SBT.
i have many dependencies jars but i wanted to know that which jar is getting downloaded or coming along BECOZ of which jar.
For example i have specified Jar_1 in my build.sbt file. Now when the project is built using SBT, along with Jar_1, multiple jars like jar_1.1, jar_1.2, jar_1.3 also gets downloaded. Now when i click on jar_1.3 or jar_1.2 i don't see the directory or any tree like structure which shows that its a child of Jar_1.
This feature is present in Eclipse. Attaching the image which shows this kind of Hierarchy.
As you can see the jars and also it shows that because of which jars it was downloaded. I need to know that whether such thing is available in IntelliJ if yes how to use it
It's not possible in IntelliJ IDEA for the SBT based projects at the moment, please vote for this feature request.

Command line generation of IntelliJ IDEA project files?

I prefer having one IDEA project per task I'm working on. If it's a Gradle project, I can run gradlew idea to generate the project files then rename them to be indicative of the task I'm working on (so that when re-opening from IDEA a project, it's obvious what the task is and IDEA is able to list several tasks for the same Gradle project). This works well enough if it's a Gradle project, but if it's not, I'm left with using the IDEA GUI to open the project by pointing to the working directory. Is there a command-line way to generate the IDEA project files so I can rename them prior to using the GUI? Being able to do this would also obviate the need for using gradlew idea for this purpose.
Using the GUI, create the project by pointing it to the build.gradle file or project root directory. Once the project is created:
click the File menu
click the Project Structure menu item
change the Project name text value

IntelliJ and Perforce Integration: Client Spec issue when using Project structure outside of client spec root

I want to use IntelliJ in the following manner. A Project (akin to Eclipse workspace) that contains multiple modules (akin to Eclipse Projects). As you can guess I am moving over to IntelliJ from a more recent Eclipse background.
I set up an empty project called MainProject which appears in the dir structure:
C:\IntelliJProjects\MainProject
This correctly contains my ".idea" directory. I want this to stay out of source control and on the C drive.
I then added two Java modules, one for each component within the project that I will work on. These are in perforce and under a p4 client spec with a root
V:\dev
("V" is a network drive that the code has to live on but I do not want the IntelliJ project files to live there). The two modules have a content root
v:\dev\component1\trunk\src
v:\dev\component2\trunk\src
This all works ok. I have marked the content correctly in the module, src, test etc
Now for the issue. When I try to set up perforce the project root is:
C:\IntelliJProjects\MainProject
but the client spec root is
v:\dev
so I get the following error when I test the connection
<pre>
Connection problems: </br>
Wrong client specification: </br>
Client roots: </br>
v:\dev </br>
Actual root: </br>
C:\IntelliJProjects\MainProject </br>
</pre>
When using Eclipse, Perforce has never been concerned with where the Eclipse workspace is so likewise I was not expecting IntelliJ to be concerned with where the project file is stored. I can see many cases where you would not want the project or indeed the module .iml files under perforce but the code certainly would be.
The only way around this would be to have the project file on the network drive under the client spec but as it is at the project level it could not rightly live under either:
v:\dev\component1
v:\dev\component2
so I would have a project under
v:\dev
which would break if I ever altered client specs
The only other way I have figured out is that I add
v:\dev
as a directory under "Version Control" where you can add in directories
has no VCS
v:\dev has VCS defined as perforce
Is this the only way or can anyone advise a better approach?
I know this is an old question, but i'm having the same problem now and i managed to solve it.
I have an IntelliJ project in a folder A, while my Perforce workspace is in folder B.
In my project i have both modules inside the project folder and inside the Perforce workspace, and i was having the "Wrong client specification" error as i mapped the whole project to Perforce.
All i had to do was to go to:
IntelliJ project preferences -> Version Control
click on the + and add map my entire Perforce workspace directory to Perforce as a VCS, as in the picture:
Your setting is correct. If you map whole "Project" to Perforce VCS, IDEA will consider everything in your project (including .idea) to be under Perforce, which is not what you want.
BTW it's strongly advised to keep project source on local disks, otherwise IDEA might have issues with file synchronization or just might function slower than it could be.

IntelliJ IDEA Report Highlighting error when using routes in Controller

I have a Scala Play project. I'm using Play 2.2.1. I downloaded Scala, Play 2 supported and SBT plugins. Everything is OK, but When I call route on Action in the Controller appear following error(Look screenshots):
I'm using IntelliJ IDEA 12.1.6 Ultimate version. Scala version 2.10.2
Anybody know how to fix this problem?
Thanks in advance!
Edit
When I generate my project to Intellij IDEA via "play idea" command in play console, and I opened project in IDEA project structure was such:
Then I saw answer #millhouse and discussing on this githup([Play 2.2] "play idea" creates not working source mapping in target) and I removed following folders from Sources Folders:
target\scala-2.10\src_managed\main\controllers
target\scala-2.10\src_managed\main\views
and "Report highlighting error" disappeared, but now there is another error:
and
my route:
And I've changed "Sources Folders" as shown below:
But it doesn't help me. And remains "Unspecified value parametrs" error.
millhouse's answer helped me find the right answer. Play 2.2 (and perhaps earlier versions, haven't checked) output a scala version of the routes file to project_dir/target/scala-2.10/src_managed/main So for IntelliJ to get the highlighting right you need to make sure that src_managed/main is added as a source folder. The reverse routes for javascript are for some reason included in project_dir/target/scala-2.10/classes_managed so you'll have to add that as well. (In your screenshot it looks like classes_managed is set to excluded so you'll want to un-exclude it by pressing the x button on the right hand side.)
Here's a screen shot of my project structure:
Update:
In Play 2.3 (or perhaps recent versions of IntelliJ) adding the classes_managed no longer fixes the problem. Instead of adding classes_managed to the project's sources add it to it's dependencies. By doing that IntelliJ should be able to pick up the compiled routes.class.
This is a common problem, it's because IntelliJ needs to be shown where to look for the compiled Scala templates and routes file. Here's how I fixed it on my IntelliJ 12.1 installation:
Go to the Module Settings for your project in IntelliJ (select the top-level, hit F4)
Choose the Modules item in the Project Structure window that appears
Select the projectname item (as opposed to the projectname-build item)
Add the compiler's output directory to the Source Folders items;
For Scala 2.10 it's target/scala-2.10/classes
I personally find the IntelliJ UI for this to be very non-intuitive; you might need to take the target directory and/or one of its subdirectories out of the Excluded Folders first
After applying that change, IntelliJ should see the results of compiling each routes and .scala.html file as just-another source file, so they won't show as "broken" and auto-complete should work for them.

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.