angular 2 seed, webstorm 2016.1 suddenly stop importing libraries - import

I'm using the newest Webstorm 2016.1 und angular 2 seed.
Somehow it doesn't auto import libraries from node modules any more (e.g. RouteConfig or OnInit)
any suggestions?
Thanks!

Go to Settings -> Language & Framework -> Javascript and add new library typed node-modules pointing to your node-modules directory.

In my case Idea was using wrong tsconfig.json (src/tsconfig.json) file. You can see which tsconfig.json is being used when the project is loaded to the IDE. After renaming src/tsconfig.json to src/tsconfig.json_disabled it started to use tsconfig.json from the root of the project. At this point, Idea didn't compile anything under src, because it was excluded in the tsconfig.json. I commented out the exclusion and everything started to work.
Although not perfect solution, the problems seems to be caused by wrong tsconfig.json. Unfortunately you cannot specify which tsconfig.json is used in project configuration.

I couldn't figure out what was the issue but I did this and it started working again
Make a copy of the app folder using finder/explorer
Delete .idea and node_modules folders from finder/explorer
Open the folder in webstorm and do npm install
Wait for webstorm to index all files.
It started working

Related

KDevelop - force import of cmake project even when selected build directory not empty

I've just started using KDevelop (ver. 4.6) and I'm having an issue with the way the IDE imports existing cmake projects. When you execute cmake the pre-selected build directory gets filled with all sorts of things including the CMakeCache, make artifacts, libraries (if defined in the CMakeLists.txt), executables etc. This seems to be a problem for KDevelop since whenever I try to import a cmake project where the build directory isn't empty the import is basically impossible since the OK button inside the wizard for importing projects is grayed out and it tells me:
The selected build directory is not empty
Is there a way to force KDevelop ignore a full build directory during the import process?
Especially when working with ROS (Robot Operating System) where a workspace normally has at least a dozen of packages plus downloading additional ones each built at some point having to delete each build folder of a package before importing it into KDevelop is a tedious work.
EDIT: Upgrade to 4.7 or newer version is not an option.
I just checked in KDevelop 4.7.3.
- Ran cmake in build folder from terminal.
- Imported project in KDevelop.
The message reads: "Using an already created build directory." and everything works fine.
I also do not have access to a KDevelop 4.6 to check but it might be worth trying 4.7 for you.
KDevelop 4.7 reads the CMakeCache.txt file and checks if it corresponds to the same source directory. I don't remember if it is so for 4.6, so I'd recommend you to upgrade KDevelop.
If it wouldn't help, you'd better file a bug with instructions to reproduce this.

Intellij Idea is loading *.class file instead of *.scala from library source

My problem is best described with a screenshot:
As you can see, there is a org.virtuslab:unicorn-core_2.11 dependency loaded in my SBT/Scala project. The jar file with corresponding sources is available as well. For some reason, Intellij Idea decided to ignore the available source file Table.scala and uses the .class file instead. Clearly, all other files are okay.
Obviously, without the information contained in the .scala file, Intellij is not able to properly analyze my code and I'm getting Cannot resolve symbol BaseIdRepository errors (and similar) all over my project.
I manually checked the source package and the Table.scala file is there and seems alright. Plus this worked flawlessly until two days ago. I don't know why it broke down. I tried to revert my project using git to an earlier version when this was still working, but no luck.
I tried to both downgrade and upgrade the library, I tried to remove it and add it again, I tried create a completely new project based on existing sources, but once again, no luck.
Just for the record, I'm able to compile and run my project. The only thing that might be related is this warning that I get when compiling the project:
[warn] /home/tobik/scala/payola-viz/src/app/model/appgen/repository/UsersRepository.scala:7: Could not find any member to link for "BaseIdRepository".
I got an update for the Scala plugin which seems to fix this issue.
In case you experience similar problems, this temporary solution worked for me: I added the unicorn sources directly to my code base and manually removed it from the project libraries. I got rid of the errors and it still compiles as the library remains as a dependency inside built.sbt. To avoid polluting my project, I added the included sources to .gitignore. The workaround broke after a while but all I had to do was repeat the procedure again.

Why does IDEA report errors for build.sbt in a new sbt project?

I'm running IntelliJ 13.1.5 community edition. I've got JDK, Scala, SBT installed. The JAVA_HOME, JDK_HOME, SCALA_HOME and SBT_HOME variables are set. If I create a new SBT project, after initial sbt refresh, I get this:
The thing compiles and runs fine, even if I add dependencies, but the file itself shows tonnes of errors. F4 settings show empty SBT module stuff:
I then installed https://github.com/mpeltonen/sbt-idea and ran sbt gen-idea in the project folder. This created a bunch of files, and reloading the project, the reds in the sbt file went away.
This is on my laptop. However, on my work machine, simply creating a new project works fine, and the sbt file isn't filled with red. Can't seem to figure out how that machine's different. Any pointers on how to resolve this annoying issue?
In case IntelliJ IDEA struggles a bit with caching, try the first and if still not working the second should definitely do the trick:
File -> Invalidate cache and restart
Close IDEA, delete .idea, re-import your project
I was also getting highlighted errors in all of the build.sbt file.
What fixed it was to select to Download "Sources for SBT and plugins" in the Import Project from SBT window.
Please, check if you added the “scala-library*.jar” to Scala compiler library
This link might be helpful:
http://blog.jetbrains.com/scala/2010/09/02/project-configuration-explained/
If you are using windows or linux, please also see:
http://confluence.jetbrains.com/display/SCA/Setting+up+Scala+plugin+project+in+IntelliJ+IDEA
Update on 2020, Apr
This works for scala 2.13 and Intellij 2020.1 when:
sbt files has error
project structure is wrong
Reason is 'External libraries' from sbt is not loading for IDE.
To do so, similar to old version: https://www.lagomframework.com/documentation/1.6.x/java/IntellijSbtJava.html
1. rm -rf .ida
2. Click Menu item: Open... to pick the project directory
If not working, I assume you need to setup Global SDK for intellij by
cmd+; and pick the path of scala.
In case of mac,
brew install scala normally echo out the path /usr/local/opt/scala/idea
Let ide browse to this path by holding cmd+shift+G to open path.
IDE should find the path like /usr/local/Cellar/scala/2.13.1/idea/lib/scala-library.jar and scala-compiler.jar and scala-reflect.jar
There might be better way to do the global scala setting though.

Running tests on Intellij: Class not found

I'm evaluating IntelliJ (13.0.2 133.696) and cannot get jUnit tests to run from within the IDE.
My project is a multi module gradle project and uses scala.
Test class is located under src/test/scala/xxx/xxxxx/xxx/xxxx/xxxxx and everytime i try to run from IDE i get the same error:
Class not found: "xxx.xxxxx.xxx.xxxx.xxxxx.AccountRepositoryTest"
Test class is nothing fancy, simple jUnit test:
#RunWith(classOf[SpringJUnit4ClassRunner])
#ContextConfiguration(classes = Array(classOf[DataConfig], classOf[SettingsConfig]))
class AccountRepositoryTest extends AssertionsForJUnit {
I've found a related question Cannot run Junit tests from IDEA 13.0 IDE for imported gradle projects , but the provided fix (upgrade to 13.0.2) does not work.
I've even tried upgrading to the latest EAP, still the same issue.
I looked through some of these answers, fussed with Project Settings, tried a few things, etc. and nothing worked. (Full disclosure: I'm not trying to juggle Gradle here; I'm just using Maven, but I don't see what this has to do with Gradle.)
I'm using IDEA 14.
What I found to work, because it just simply seemed IntelliJ had lost its way, was this:
$ rm -rf .idea project-name.iml
Then relaunched IntelliJ and did File -> Open -> navigate to the root of my project, etc.--in short, just recreated my project.
IntelliJ got over it. I may have messed something up originally in this project as I had done plenty of refactoring both package- and class names and I had even changed the project name. (It was probably my fault it happened.)
I had this same problem, and in my case the problem was due to the "Project compiler output" path being left blank in Project Settings.
To fix it I created a classes directory in my project root, and set Project compiler output to the absolute path (use the … button to browse).
Go to Project Settings -> Project.
Fill in Project compiler output:
ex. D:\repo\Project\out
Go to Module -> Paths
Make sure that:
output path is like D:\repo\Project\out\production
test output path like D:\repo\Project\out\test
Should work!
Simply 'Build > Rebuild Project' worked for me.
Check Run/Debug configuration for that test
"Use classpath and SDK of module:" should point into your module.
In meantime you module must have a Scala facet and that class must be inside the
"Test source Folders".
You can try to invalidate the cache and restart. That usually will resolve issues when you add new dependencies / classes.
Make sure your test class package and the class for which you are writing test case are not same. If both test case and the class is having the same package, the compiler will look in the src folder and ignores the test folder.
I had the same problem. I changed a path in Module Settings -> Modules -> Paths -> Test output path to my directory for test classes bytecode (exclude output paths on). Now everything works!
IDEA restart solved the issue for me.
Just make shure the folder of your test file marked as a test folder in Intellij IDEA. That worked for me.
If you have multiple directories with source files with the same name, add package to your class source file, if not present!
I had the same problem, Intellij wasn't finding the Test output path. Running the regular application had no problems however.
For me, the fix was changing from inherited project compile paths, to using module compile output paths.
Project Settings -> Modules -> (Your module) -> Paths (tab)
Change the radio select button to "Use module compile output path". For me the autofilled suggestion worked, you may need to manually put in the correct Test Output Path if the autosuggestion doesn't work. Remember to apply the settings change.
As of for gradle project X, deleting both:
X/build
X/out
and running tests again helped me resolve this issue.
Try this in this order:
rebuild project (+strangely, select another app, reselect idea for context-switch, seems to force files reload ?!)
invalidate cache/restart idea
reimport project /create a new project
Just renaming the file to something different and back worked for me :)
modify the content in tag of the module's .iml file just as the following. It works for me.
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
Had the same problem, fixed it by recreating the project in a directory path that had no spaces, colons, periods or other special characters anywhere in the full path. Apparently IntelliJ can be finicky about the project path.
My issue remained after building, clean and rebuild, closing and opening the project (using intellij), project compiler output was correct; in the end I just deleted the folder out from my project directory. Note that my issue was only on the newly added Junit calling a newly added method. The rest of Junits were working fine.
For me it was that one test was failing and the error was misguiding.
So:
I re-imported module in intellij as standalone project
Run the test
Fix test issues
Run modules again and it started to work.
tl;dr:
Missing file extensions can cause this error.
details:
In my case the test classes were missing the .java extension. E.g. a
file named UserTest instead of UserTest.java
Was hard to find, everything looked normal from within the IDE
(apparently IntelliJ rather uses the file contents to display a
corresponding symbol).
Was not an issue as long as I used mvn from command line (with the surfire plugin enabled in pom.xml) or a dedicated maven launcher configuration, but caused
the initial error message when launching using IntelliJs test or coverage menu / buttons.
Everything working as expected as once I added the missing file endings.
The root cause might be hidden in Java Compiler settings, it was so for me at least. In particular, feel free to adjust those settings using some hints from another thread.

Output path is shared between the same module error

When I try to compile any class in my project I get the error below:
Error scala: Output path .../eval/target/test-classes is shared between: Module 'eval' tests, Module 'eval' tests
Output path .../eval/target/classes is shared between: Module 'eval' production, Module 'eval' production
Please configure separate output paths to proceed with the compilation.
I've seen how to set the output path in IDEA and I've done it. But as the error claims that it is shared between the same module I couldn't solve it.
Obs.: Using Maven and IntelliJ IDEA.
Please, can anyone help?
all you need to do is:
synchronize both modules (right click > Synchronize)
re-import pom.xml for both modules (right click > Maven > Re Import)
Enjoy
Set up the output paths for your modules to different directories, as explained here: https://www.jetbrains.com/idea/help/configuring-module-compiler-output.html
On Project "Open Module Settings" -> Modules -> Paths -> Output/Test path
I resolved this by selecting "Inherit project compile output path" in the Project Structure settings window.
Files --> Invalidate caches and restart
Close intellij
delete (extenrally from intellij) .idea folder (backup runConfigurations folder if you have one).
delete the project.iml file
Open intellij
Open the project again from pom or from sbt (or whatever source build tool you have.
I had this happen with the root module in a multi-module project. Since the root module was just a placeholder, it didn't actually contain any code, but IDEA still complained that it was sharing an output path ([project]/build) between test and production.
The fix was to add
plugins {
id "java"
}
at the top of the root build.gradle file (applying the otherwise unnecessary Java plugin) and reimporting the project. This allowed IDEA to pick up the Java-default [project]/build/classes/main and [project]/build/classes/test output directories.
Open up the module settings and look for errors. Fix said errors and everything should work.
Problem solved!
I have reset backward and forward my git repository many times and close-reopen idea after some of it. When finaly IDEA shows a red message at the right top while it was starting. It says something like: the project has already a eval module, and if I want to delete eval module. Yes, it was quite confusing, but I click on delete and my problem disappear. I guess that for some reason I become with 2 eval modules and it delete one of it solving output path error.
For a Spark project, the IDE created _2.11 versions of SBT modules. I had to delete them by hand.
enter image description here
Idea itself reports an error, the prompt is already very obvious, calm analysis can solve;
Open Project Structure --> modules. Delete or reconfigure outputPath,The computer is the most honest
This is really a response to #habitat's comment on #Corey Klein 's answer. If someone with enough reputation wants to edit, please go ahead...
I had the same problem with the setting being reset every time I refreshed the project. My solution (with Gradle, although I'm guessing there is an equivalent Maven plugin) was to add
apply plugin: 'idea'
idea {
module {
inheritOutputDirs = true
}
}
For gradle, I delete the .idea folder and reopen the project. Everything is recovery.
I had 2 differently named versions of the same module and needed to delete one to avoid this clash. This is what worked for me:
In IntelliJ IDEA go to File -> Project Structure -> Modules -> Your Project -> Paths
Ensure each Modules "Output path" and "Test output path" locations are unique across all your modules.
If you have more than one module with the same paths, you can specify unique paths for every module or as in my case, delete the module that you do not require as it was a duplicate of an existing module
I face the same issue i resolve this by deleting .iml2 from the module which was created by intellij.