intelliJ 12 - cannot find the xml file i want it to - intellij-idea

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"

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.

Java sources replaced by decompiled files in Intellij

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.

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.

ClearCase not working via Intellij Idea

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.

Intellij IDEA not importing dependencies from #Grab in Groovy project

I have a groovy script I am working on, which imports dependencies using the #Grab annotation. This script will run within IDEA, and from the command line. However, within the IDE, the imports are shown in red (as unresolvable), and no auto-completion on the classes so imported is given.
I am accessing a corporate repository via a proxy, which has been configured as the Http Proxy within IDEA (the module should be, and is, in my local .m2 repo anyway!)
Anyone got any ideas (no pun intended!)?
I am using IntelliJ IDEA 12.5 Ultimate (IU-129.1135), JRE 1.7, and Groovy 2.1.6
As stated by CrazyCoder, Alt + Enter then select Grab the artifacts and Enter
There could be 2 problems interfering with the resolution of the Grab dependencies
Your source code folder has not been marked as "Sources Root". To do that, right click on the folder and select "Mark Directory As" -> "Sources Root"
Your project does not have a valid Project JDK. To do this, hit Ctrl-Alt-Shift-S, select "Project" -> "Project SDK" and give it a Java JDK.
Once these steps are done, you should be able to hit Alt + Enter and then select "Grab the artifacts"