Imports Unrecognized By IntelliJ when Getting A Project From GitHub - github

I've faced this problem quite a lot lately but I didn't care in the past and decided to rewrite the whole project I'm getting from GitHub but now when the project is enormous I can't do this anymore.
Here is a picture of the problem:
As you see the classes are already in their places but the import still failing I don't know why. I checked my SDK and it's already added so anyone have an idea why this happening?

If it is a Maven project, open the Maven tab and click Reimport all dependencies button.
Another solution is to use the Terminal, just run mvn clean install command.

Related

Cannot build/run Scala project in IntelliJ after packaging with Maven

So my Scala project was working perfectly fine in IntelliJ, then I tried to run package in Maven to obtain a .jar file, which was not working because I was missing a dependency. So I tried to edit pom.xml however reverted it back shortly.
Anyhow, thereafter, without any changes I tried to run my Scala project normally locally and it doesn't work anymore. I get the error:
Error: Can not find or load main class Name.Name
I double checked Edit Configurations in IntelliJ and the main class is specified.
What went wrong? There has been no changes at all except that I tried to package my project using Maven, and then my normal program stopped working.
Solved it by recreating the project from scratch, however I'm still unsure what the cause was.

Debugging Error in STS grails project

I've got a grails project in STS. Recently an error has appeared at the project level ( the red [X] on the project) and it warns me everytime I run the project, but I can't see any files/directories showing errors and I've tried cleaning, refreshing dependencies, and even deleting the project and checking it out from SVN again. The project builds fine and runs without any actual errors as far as I can tell.
An additional tips on debugging this? It's basically an annoyance, but it's going to make it easier more me to miss real problems down the line...

IntelliJ show errors in scala source files but the project compiles successfully

I'm working with project in intellij IDEA IDE based in maven. I can perform all maven goals but IntelliJ is showing a lot of errors in the source code like bellow:
Everything worked fine a few hours ago. I don't understand why the IDE continue
showing errors. When I rebuild or compile the entire project (CTRL + F9) or a single
scala class I always receive a success message like that:
I already had configured scala plugin before, so I don't know what is happen.
thanks for your help
Sometimes the IntelliJ cache gets corrupted. You can fix this by the following:
File > "Invalidate Caches / Restart"
After choosing "Invalidate and Restart" when prompted, IntelliJ will restart and rebuild its cache.
If IDEA has lost track of obviously correct types such as Database or DateTime it probably means the configuration of the project is wrong or corrupted. Most commonly it does not have the required 3rd part dependencies such as Joda Time.
If you're not already doing so, define your project solely in SBT and use the sbt-idea plug-in to produce your IDEA project definition. Then whenever you change the project dependencies, re-run gen-idea to regenerate your IDEA project files. No muss, no fuss.
There are many bugs raised in jetbrains's bug tracker for this. I suggest you raise some bugs or vote for existing ones.
It loos like the problem you have is with the type aware highlighting which is worse than useless.
thanks for your responses.
I solved this problem importing the project again.

ScalaTest Run Configuration in Eclipse: cannot find Suite Class

Problem: I cannot setup Run Configurations to run scalatest for the Scalatests in my project.
Steps to reproduce:
Right click on Scala Suite and click on Run as -> Run configurations..
On the left, I see a configuration template for ScalaTest. I click on New and fill the Name but it cannot find the suite-class.
Note: It is mentioned here that I should see Run as -> ScalaTest - Suite but I do not see that option. I tried using context menu in the editor, and in the package explorer
Steps taken:
Using: Scala IDE for Eclipse version: 2.1.0.m3-2_09
Using SBT, assemble project, run eclipse command and then import project and dependencies into Eclipse
Project compiles. ScalaTest code compiles(scalatest_2.9.2-1.8.jar is in the 'Referenced Libraries' configuration)
I've been fighting a similar problem for the past few days; Lily / Jimbo's answer didn't quite match my situation, but helped me find the right direction.
In my case, I was using a third-party library that I'd copied in. The package names of the classes and tests matched, but the folder structure did not -- all of my tests were directly in Play's "/test" folder, rather than in folders that matched the package names. This didn't show any errors, but was broken: packages ought to match folders. When I built the right folder structure underneath test, and recompiled, the expected "Run As -> ScalaTest - Suite" options showed up.
Don't know if your problem is the same, but you might check this if you haven't already found the issue...
This could be caused by a misalignment between the scalatest and the scala eclipse IDE version. Try scalatest_2.9.0-2.0.M5b.jar or scalatest_2.10-2.0.M5b.jar. The former jar definitely works with ide 2.0.9.x so maybe the new version needs the 2.10 jar. Pick your version carefully from here
Willem's answer is what worked for me. Getting both plugins from the same update site (from the list on Scalatest's github site), seemed to work for me using Kepler.
for my case, one click on 'Reimport All Maven Projects' icon, like 'Refresh' icon, solved the problem.
Not sure if you fixed the error, but I had similar a error yesterday and was pulling my hair trying to fix it (none of the suggestions I found by googling seemed to help me). So for me, it turns out that it's as easy as package hierarchy in my test suite.
I am using the play framework, so naturally my folders look like this controllers.package1.package2.... and this applies to my test folders also.
Now my test classes however, have the package definition package1.package2..... (no "controllers" as prefix).
If I run the tests on sbt/play command prompt, it's not a problem. But running them through Eclipse would give me the problem you described.
So anyways... thought I'd share this, in case this could help.
it's a bit annoying combined with the view template compile issue in play framework. but my approach is to regenerate the eclipse project file and add view template path into the class path

Eclipse: Import Maven project, missing maven-gae-plugin

Coming from Visual Studio, I'm pretty new to the Eclipse IDE.
And finding it very difficult. I seem to get error messages of the type "missing ..." a LOT.
The latest issue I'm having, where I just can't get around is this:
I"m trying to compile & run this sample project: http://code.google.com/p/gwtgae2011/
When I choose "checkout maven projects from SCM" my SCM drop down is empty...
So I just checked it out with Hg manually. No problem.
Trying Import > Existing Maven Project. Seems to read the pom.xml alright, but shows an error:
"No marketplace entries found to handle maven-gae-plugin:0.8.1:unpack in Eclipse. Please see Help for more information."
Since I can't find it through updates or market within eclipse I downloaded maven-gae-plugin (http://code.google.com/p/maven-gae-plugin/downloads/list). I figured just dropping it into the "plugins" or "dropins" folder should be enough. Apparently not so...
Question: How do I fix this error?
(I tried both 3.6 & 3.7)
Links to some good eclipse tutorials covering these kinds of topics are very welcome too!
THANKS!
maven-gae-plugin is in central repo so it should be found.
Did you set the path to your local repo? http://united-coders.com/phillip-steffensen/maven-2-part-3-configuring-eclipse-for-apache-maven-2-projects
I ran into this error, what worked for me was:
Comment the plugin
Import into eclipse
Uncomment the plugin
Discover an error in the plugin XML
Fix error found in the plugin XML
I am not certain, but it seems like this is a unclear error that something about the pom.xml is invalid.