When I'm opening a specific class using ctrl + right click I should be redirected to a window with the java sources which contains all the lines and the appropriate comments. But instead I get a window with the decompiled .class file.
I have tried to deactivate the decompiler plugin but it does not work.
If I add http://docs.oracle.com/javase/8/docs/api to Project Structure -> SDKs -> Documentation Paths I can get an overview of the class or method's I'm rolling over, but still can't open the right source file.
Any ideas?
When navigting to sources, IDEA will first go to attached sources. If not present, it will decompile the class and display it.
Try the following troubleshooting to track down the issue:
1. Make sure the sources are properly attached.
For libraries, Open the Project Structure dialog (Ctrl+Alt+Shift+S or ⌘;) and sel4ct "Libraries" on the left under "Project Settings". Find the library in question, and select it. It will show if the source is attached. You mentioned you have Maven's "Automatically download" sources/documentation both checked. So for any maven libraries that have source available, it should be listed.
If it is not listed or is in red, run "Download Sources" or "Download Sources and Documentation" from the Maven tool window. If the source is till in red, it likely means it is not available for that artifact in the maven repository. Use Maven Search to verify such.
For the JDK, select "SDKs" in the Project Structure dialog, find the JDK, and then select the "Sourcepath" tab. Make sure the {jdk-home}/src.zip file is listed.
IDEA should automatically set this when you add the JDK, but if not, add it.
2. Make sure the source JAR/ZIP file is not corrupt
Navigate to the archive in explorer/finder and make sure it can be opened and viewed.
3. Refresh IDEA's Caches
It's possible that IDEA's caches/indexes are corrupted. As such, IDEA is not "seeing" the link between the class and the source code. Go to File > Invalidate Caches / Restart...". Invalidate the caches and restart IDEA. Wait for IDEA to finish re-indexing the project and libraries (watch the progress in the bottom right of the IDEA window).
One of the above should resolve the issue.
FYI, If you do not want IDEA to decompile code(as a backup to no source being present), to the best of my knowledge (and based on the its help page), the only way to do such is to disable the "Java Bytecode Decompiler" in the Plugins list.
After ensuring my sources were attached, checking the source ZIP, invalidating the IntelliJ cache and restarting, I was still having the same problem.
To fix it, I created the project anew File > New > Project From Existing Sources..., and when I got to the library selection step I deselected the .jars for my own modules.
Related
I started to learn Selenium.
After creating the project I tried to add some jar files.
As you see all required jars were added. But
...sources.jar
looks like Empty Project. Why this is happening?
Probably this happening because ...source.jar file has a multiple files.
Click Libraries from Project Settings
+and add this .jar file here first.
When you added turn back to Modules
After these steps "Empty library" error is gone.
I am an Eclipse/STS user/developer, now trying to use IntelliJ Idea (CE)
2020.2.(1,2,3)
For a project based on Gradle, how spring-integration, when I open the IDE it happens the following
Ok, let the IDE load the project ... but
From above, that is the problem, I don't want that the IDE starts automatically to build/rebuild the project. I just need, open the project and that's all.
Observation: for example in Eclipse/STS exists the option to disable Build Automatically
I did do a research in the Web and I read the following posts and questions:
How to disable automatic gradle builds?
IntelliJ IDEA “Build project automatically” apparently not working
Intellij IDEA Java classes not auto compiling on save
Sadly the dialog options were changed but ...
Therefore:
From above, seems nothing to do.
Observation: from above observe the Build project automatically option is disabled
Even with that disabled and after to restart the IDE, I must always stop manually the build process
So what is missing? or Do I need a special extra plugin to accomplish my goal?
The images that you show indicate that you are building with Gradle, but the Compiler option that you disable is relevant for building projects with Idea not with Gradle.
For the 2020.2 version, you need to do the following:
Open the Setting > Build Tools page.
Disable the "Reload changes in build scripts" option.
This way you can manually control the reload. When you change the build script, you will see a small gradle icon in the right side of the editor.
For more info, refer to the IntelliJ IDEA help > Gradle section.
https://www.jetbrains.com/help/idea/work-with-gradle-projects.html#auto_reload
There are two different things in IntelliJ's Gradle support that sometimes confused: sync and build. Your pictures demonstrate sync process (note caption on the toolwindow). Word build is kind of misleading here.
What is sync? In gradle we use Groovy to define the build procedure. Groovy is an imperative programming language, so it's hard to predict resulting dependencies graph without actually executing the script. During the sync Idea executes configuration phase of gradle build (one that builds dependency graph), and obtains configured objects from the Gradle daemon. This information is used to setup project in the IDE: modules, libraries, dependencies, which sources are test, which are prod, etc.
Actual build is not happening during sync. You can convince yourself by adding syntax error to any source file, and observe that the sync succeeds. But build will fail if you invoke it.
In answer to the original question: you can't disable automatic build, because it is not enabled.
Is it possible to disable sync in Gradle project? Short answer - no. If you need a code browser, which is not required to understand all the cross-references in the source code, IDEA is not the best choice probably.
TL;DR;
Without sync IDE does not know which files are sources, and which are not. IDEA cannot open folders. It only can open projects. Good thing is that module can contain folder. So you can do the following: File | New | Project. Select Empty project, Next, select some random folder outside the source folder you want to open, Finish.
Then add new module:
Select Java in the left panel, everything else keep default, Next, Finish. Then in new module remove existing content root, and add folder with sources as new content root
Resulting project is mostly useless. Tons of red code (at least, unresolved symbols from external libraries), no inspections, no navigation, no sense. But it might be useful in some rare situations indeed.
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.
Intellij Idea 12.1.4, Windows 7 Professional.
It seems bundled ClearCase Intellij Idea plugin not working at all. When I try to checkout(or type sth. in a file which is not checked out or hijacked) Idea says:
Cannot edit file(s): cleartool: Error: Not an object in a vob: {File path}
Actually this is an error that I am expecting because I couldn't find any ClearCase configuration that I can type my user name and password in Intellij Idea:
That's why it doesn't know where to connect and retrieve data. So question is, where are the correct configurations? Should I prepare a script for SCR text file or is Intellij Idea plugin useless?
Try first to fall back to cleartool (the ClearCase CLI -- command Line Interface), and check if your view is correctly configured.
cd /path/to/your/file
cleartool ls
That will allow you to see the config spec selection rule for that file.
And that will give you a clue for that "Not an object in a vob" error message: maybe the issue isn't in the plugin, but in your current view.
I know this is a contrite answer but the best advice really is: Don't use ClearCase.
Save your organization the headache and make the effort to switch over.
Anything will do, even svn.
Go to Settings, click on "Version Control". In the right-hand pane you need to add a Directory/VCS configuration tuple. Do this by pressing the green PLUS (+) icon.
Select "Project" and select "Clearcase" as Source Control tool. You should now have a context menu item "Clearcase" in your IDE and can check out files by right-clicking on the file. One small disadvantage in my Intellij 12.1.6 is that he only sees the change sets (Activities) that were created using Clearcase Explorer... (only loaded at startup time of Intellij). So you cannot add new change sets that will be propagated to Clearcase.
I want to get, when i press the little green "run me" button in intelliJ, the running program to pick up and use this file (in the project structure)
/src/config/some_folder/some_xml.xml
However, when i press that green run button, intelliJ 12 is giving me this error:
Resource not found on classpath using context ClassLoader: some_folder/some_xml.xml
In an attempt to resolve, this, I have this in my Settings:Compiler: Resource patterns
!?*.java;!?*.form;!?*.class;!?*.groovy;!?*.scala;!?*.flex;!?*.kt;!?*.cl;?*.xml;?*.config
note the penultimate xml entry.
I also unchecked the "use external build" button. I do not know what it means or does, but I read somewhere that it should not be used.
I also have these (among other entries) in Project Structure:Modules: Sources tab
config
config\some_folder
Marked in blue (sources) under the Source Folders heading.
There is no fancy pom.xml for this project - it is an old legacy project. If i add a pom.xml to resolve this, where would i put it, what would i put in it (in entirety) and would i need to tell intelliJ i now have a pom.xml?
EDIT ok, so intelliJ can find the file when i refer to it as
./config/some_folder/some_xml.xml
but will not find it if it is reffered to as
some_folder/some_xml.xml
I think this is the real issue - how do i resolve this?
src/config needs to be configured in the project as a resources folder. In the project tray, right click /src/config and select "Mark Directory As" -> "Source Root"