Related
In Eclipse Neon, I did an 'import existing maven project' from a local folder, whose content was copied from another machine. The project is not reading the dependencies on the POM file, and one example is the log4j dependency. A workaround is to add the log4j-1.2.17.jar manually to the project as an external jar, but this is wrong. Does anyone have tips on how to troubleshoot? I am fairly inexperienced with maven so I m not sure if there are additional settings or configuration that I have do when importing an existing project into eclipse.
You can make sure if your project dependencies are being pulled correctly or not by executing
mvn clean install
from within the project directory on the command line. This would download the required dependencies of the project as well.
The most common cause I have seen for this issue occurs whenever Maven encountered an error while downloading an artifact from a repository. In this case, Maven marks the download as failed and won't retry until some time elapses (I do not remember how long).
The easiest way to test this is to delete the .m2/repository folder in your home directory and let Maven download the artifacts again. If you have Maven installed you just execute "mvn install" from a console. Otherwise, you can try:
Right click the project in Eclipse
Select "Maven > Update Project"
Check "Force Update of Snapshots/Releases"
Click "OK"
I completely uninstalled IntelliJ and have now reinstalled and imported my project. I imported using gradle and can see all of the files in my project present. However, when I open a file I can't find any declaration to go to by doing cmd + click. I have the Java 7 SDK setup, and I can't even go to the declaration of classes in my own project. Going to a Java core class like String or List doesn't work either. How can I enable the IDE to be able to find my classes?
I'm on OSX Yosemite, IntelliJ 2016.1.2 build 145.972.
I had this same problem, and #AniaG's solution in the comments worked for me.
Right-click src folder
Mark Directory as > Sources Root
I faced the same issue and spent almost 15-16 tiring hours to clean, rebuild, invalidate-cache, upgrade Idea from 16.3 to 17.2, all in vain.
We have a Maven managed project and the build used to be successful but just couldn't navigate between declaration/implementations as Idea couldn't see the files.
After endlessly trying to fix this, it finally dawned to me that it's the IDEA settings causing all the headache. This is what I did (Windows system):
Exit IDE
Recursively delete all .iml files from project directory del /s /q "C:\Dev\trunk\*.iml"
Find and delete all .idea folders
Delete contents of the caches, index, and LocalHistory folders under <user_home>\.IntelliJIdea2017.2\system
Open Idea and import project ....
VOILAAAAAAAAAAAA...!!
I hope this helps a poor soul in pain
I had the same issue with idea and I was trying to open a maven project but the pom files where not identified. So right clicking on the pom file and choosing "add as maven project" did all the magic for me :)
Had the same problem. But only on my own methods.
Just fixed it by invalidating cache: (File-> Invalidate Caches/Restart)
I was having similar issues in my IntelliJ mvn project. Pom.xml was not recognized.
What worked for me was right click on the pom.xml and then add as a maven project.
Most of the times there has been a problem with building the cache of the IDE, or something related.
Most probably, File -> Invalidate Caches / Restart, will resolve this problem, just let the IDE finalize it's caching.
Your source folders where your Symbols are (Classes) are need to be configured as "Content Root".
Open Project Structure: #;
Click Modules
You can configure your Content Root (Sources, Tests, Resources etc) for each module that you want to Navigate to.
Once done you should be able to navigate to your symbols.
If you see red circle on the icon of Java files, and got warning like "cannot find declaration to go to". Then you can do something below:
Right click root folder of your project/module.
Mark Directory As -> Excluded.
It works for me. in Windows 7, Intellij 2016.1.1
Right-click on your src folder and choose the option "mark directory as" --"Source root" and along with it again right-click on your project and choose "reformat code"(under this choose cleanup code too) and that will work fine.
I got this problem on Big Sur.
Solution:
File -> Invalidate Caches. After that press Option + Enter on every red field.
In my case, I just updated my IntelliJ to Ultimate 2018.2 and all of my projects suddenly cannot find the implementations and the 'src' folders - it turned out IntelliJ removed the type of project (e.g. Maven).
What I did is:
Right click on the root project > Add Framework support... > Look for Maven (in my case) > Wait to re-index again > Then it worked again.
UPDATE 2:
I have always been encountering this when I update IntelliJ (2019.1.1 Ultimate Edition).
Just click the refresh button of Maven Tab and it should re-index your current project as Maven Project:
I found this cannot find declaration to go to problem once in my Maven project. The reason for this was just that one of the sub-projects in my project did not import as maven project correctly.
None of the methods listed in this channel works for me.
However, I am able to resolve it using the following method, and I hope that it works for you too.
Right Click the pom.xml file and then select "Maven". After that, click "Import Maven Project"
Ensure that the directory which contains your compiled classes and libraries is marked as sources Root.
I too faced this issue. I've tried the solutions mentioned here. The issue seems not with the source folder.
For me the issue occurred when I installed a new version of IntelliJ, was using 2019 version moved to 2020 version.
The project got opened in the new version but the declarations were missing.
I fixed this by :
- File>Project Structure.
- Under Project Settings go to Modules. Here you should see the different project folders, for me it was not there.
- Click the + button on top and click Import Module.
- Select the root pom.xml and wait for the indexing to complete.
After the indexing is done all the declarations were working.
Importing my project (which had 3 different modules in it) - as File -> Module From Existing Sources fixed it for me.
Just run below commands
mvn idea:clean
mvn idea:idea
IDEA may ignore some of your maven dependency files. The "External Libraries" node in your project structure might be empty or incomplete.
Go to:
IntelliJ --> Preferences
Search for Maven [on the left tab] -> Ignored Files
See if there is any path on the right side that is checked(ignored) and uncheck that.
Came across the same issue and in my case (Java project), I had to include all the dependent jars in the project's libraries section.
File -> Project Structure -> Libraries
I had to add my project dependent jars in the above section (for example; project/web/lib/). After doing so, all resolved fine. I hope this will help someone.
For someone whom the above solution didn't worked.
For gradle,
File -> Project Structure
Click on Project Under Project Settings
Update Project Language level as Modules, private methods in interfaces etc.
Click OK and Import Gradle Settings
I had similar issue with Goland JetBrain and what worked for me is similar to what #user8382868 said but I only closed the IDE, renamed the folder .idea file to .idea.old and after re-opening the project everything worked.
For Java based project, this is what worked for me :-
-Download Intellij 2020.3.4 version instead of 2021.1.1
-Add configuration, plugins.
-Configure settings, Project Structure
-Right click on the root folder -> Mark Directory as -> Sources Root
-File -> Invalidate caches/restart -> Invalidate and Restart
In my case I was using a gradle project with subprojects. The reason IntelliJ couldn't find declarations was that the subprojects were not built.
After investigating why subprojects were not built, I found out that using "auto-import" was breaking the subprojects.
After importing the project from build.gradle without auto-import, it worked for me.
For what its worth, in Pycharm it is: Right click on the root folder->Mark Directory as-> Sources Root
Same Problem for Python Project!!!
I tried to make a clean new intellij project and updated everything. Tried different virtualenvs but nothing worked out.
UNTIL I uninstalled the Python Plugin + Restart IntelliJ + Intall Python Plugin + Restart IntelliJ again. I'm not sure if this is a "real" solution, but it solved my issue.
Maybe you can try something familar for Java "Plugin"/JDK?
In my case, none of the above helped. Only upgrade of Intellij from 2017.3 to 2018.2 helped.
Do not try 2018.1 as it had a bug wherein the Find files popup would not come up.
Somehow I set my Maven modules to be ignored. In the Maven tool window right click and select 'Unignore Projects'.
Then all the directories will be automatically selected.
I had the same issue.
what i did was.
Select your project >right click> go to settings> plugins > search for cucumber > and then re-bundled the plugin
and restart your intellij.
It should fix the issue.
Nothing above worked for me unfortunately. I deleted all downloaded dependencies from .m2\repository and did a mvn clean install to download them again. (Although i did not have any issues in the pom.xml at the first place)
That worked for me.
In my case, I've to open preferences:
And I went to Project -> Project Structure -> set my folder project in +Add Content Root
So now all it work fine!
I'm using Apache Maven in my Java project. in NetBeans there are build and clean build icons but there aren't in IntellIJ IDEA. How can I clean or clean build my project in it?
Maven > Lifecycle > clean
Open the Maven Projects panel. Click lower-left corner for pop-up menu if that panel is not already visible.
In that panel, open the Lifecycle item. There you will find clean and install items for you to run.
As commented, you can also invoke this by command-line/console. But if already using IntelliJ, I do not see the point. Just show/hide this pane as you work. I use it countless times a day to hit install to build complete app, and hit clean whenever I suspect not all of the project is up-to-date in the build-results.
Build > Rebuild Project
If you are having weird problems in running the app in development also try the menu item Build > Rebuild Project.
I have asked what is the difference between a Build > Rebuild Project versus doing a Maven clean. But I still do not understand the precise details. So when things seem wonky, I do both to right the ship.
Tips:
Restarting IntelliJ may help when behavior seems odd.
Keep Intellij updated.
The answer here with the most votes suggests running the clean and install Lifecycle items separately in IntelliJ, which is easy enough and works. But it’s worth mentioning that you can combine these steps (and/or others) by instead creating a new Run/Debug Configuration of type maven and adding the command clean install (or whichever combination of maven lifecycle methods you run on a recurring basis).
Thereafter, running a mvn clean install is as simple as clicking the green button to run that Run/Debug Configuration.
Here is a faster way to do that:
in IntelliJ IDEA window hit Ctrl key twice, then a pop-up window appears like this:
there you can enter your command and use recommendation tools, too.
including template commands and the list of your previous ones:
In IntelliJ, go to your Toobar, View>Tools Windows>Maven Projects
From there, you can click Clean to clean the project
click on maven panel --> select project--> lifecycle --> double click clean.
source: vaadin.com
I have the same problem. I found some suggestions but nothing get me to an acceptable solution. Here are some things I found maybe it will help you:
File -> Invalidate caches / restart
or just rebuild the project: Build -> Rebuild project (Shift+F11)
But it's nothing like Clean or Clean and Build from netbeans.
By the way I use intellij-15.
Edit: Finally, Build->Build Artifacts->Build or Rebuild works for me.
So far, the best I can come up with (for a non-Maven project) would be to manually delete the target folder and then do your build. But I'm still looking for a better answer, myself.
I'm building a Maven project, and I discovered if I run the Maven Clean phase from the IntelliJ "Maven Projects" pane, it deletes the target folder. The target folder itself (without subfolders) corresponds to NetBeans' dist folder, and the subfolders in target have corresponding subfolders of the build folder in NetBeans. When you clean and build in NetBeans, the first thing that happens is the build folder and dist folder are deleted, and this corresponds to deleting the target folder in IntelliJ, so that's why I suggest it.
Note that just as you get an error if you try to clean and build in NetBeans while holding open a file that happens to be in the build or dist directory, you will similarly get an error in IntelliJ if you try to execute the Maven Clean phase while a file is open in the target folder - the difference is, if you are doing this in Windows, IntelliJ will half-way delete the folder and there isn't a simple straightforward way to clean up the mess even after you close the program that is holding the file open. Probably if you reboot it will clean up, but who wants to do that? I ended up identifying the culprit process (processes, actually - two copies of explorer.exe) with Sysinternals Process Explorer, killing all instances of explorer (killing only the two culprits didn't seem to work), then starting explorer back up via Task Manager, and everything was fine.
You can use the terminal to switch to the current project directory and use mvn clean install
If it's a Maven project:
Go to your project's root folder (where your pom.xml is located)
In address bar of windows explorer type cmd
You should be prompted with cmd window where you should type mvn clean
That will clean your target folder which is getting created after build
Make sure you have your system variables set so mvn commands can work (otherwise you will get "mvn is not recognized as an internal or external command")
This is how it should look:
Hope this helps.
As explained in Jetbrains help there are three ways to execute maven goals in IntelliJ.
One simple way to execute clean and install and also save the configuration is to select with CRTL button the goals "clean" and "install" from the maven tab -> Right click in one of the selected -> Modify Run Configuration -> check all the fields -> click OK. Then you can execute this configuration in order to clean and install.
This way works for the InteliJ IDEA 14 upwards not exceeding InteliJ IDEA 20:
Click Run -> Edit Configurations -> Press + -> Search for "Maven" -> Locate "Command Line" field and enter in following maven commands "clean install" -> Press OK.
Now click the green button to run that Run/Debug Configuration, this will maven clean install the module/project.
The output of the module if you are to deploy somewhere can be seen in the target directory in the project.
Maven Clean Install refers to clear any compiled files you have, making sure that you're really compiling each module from scratch
I just imported a project from subversion to IntelliJ IDEA 11 - it's a maven project. But I have a problem in maven library dependencies so that I can't include all maven dependencies automatically - IDEA shows dependency errors only when I open that class/ Thats what I get here:
So I want all dependencies to be added automatically - is that possible or do I have to go through all class files to identify and add maven dependencies?!
UPDATE: After doing some modifications I found how to resolve my problem in some way. Thats what I did:
but I think logically it will not include and check new dependencies ahead?!... Is there any settings area for this in intelliJ - auto export dependencies to classpath?
IntelliJ should download and add all your dependencies to the project's classpath automatically as long as your POM is compliant and all the dependencies are available.
When importing Maven projects into IntelliJ an information box usually comes up asking you if you want to configure Auto-Import for Maven projects. That means that if you make any changes to your POM those changes will be loaded automatically.
You can enable such feature going to File > Settings > Maven > Importing, there is a checkbox that says "Import Maven projects automatically".
If that doesn't help, then I would suggest to make a full clean-up and start again:
Close your project window (and IntelliJ) and remove all *.iml files and all .idea folders (there should be one per module)
Run mvn clean install from the command line
Re-import the project into IntelliJ and pay attention when it asks you to enable auto-import
IntelliJ 2016 Update:
The Import Maven Projects automatically setting has been moved to Build, Execution, Deployment > Build Tools > Maven > Importing in your IntelliJ preferences.
Fix before IntelliJ 14
File [menu] -> Settings -> maven -> importing and uncheck "use maven3 to import project"
ref: http://youtrack.jetbrains.com/issue/IDEA-98425 (which may have a few other ideas too)
Fix IntelliJ 15+
Ran into this again, with IntelliJ 15 this time, which has no "use maven3 to import" option available anymore. The cause was that sometimes IntelliJ "doesn't parse maven dependencies right" and if it can't parse one of them right, it gives up on all of them, apparently. You can tell if this is the case by opening the maven projects tool window (View menu -> Tool Windows -> Maven Projects). Then expand one of your maven projects and its dependencies. If the dependencies are all underlined in red, "Houston, we have a problem".
You can actually see the real failure by mousing over the project name itself.
In my instance it said "Problems: No versions available for XXX" or "Failed to read descriptor for artifact org.xy.z" ref: https://youtrack.jetbrains.com/issue/IDEA-128846
and
https://youtrack.jetbrains.com/issue/IDEA-152555
It seems in this case I was dealing with a jar that didn't have an associated pom file (in our maven nexus repo, and also my local repository). If this is also your problem, "urrent work around: if you do not actually need to use classes from that jar in your own code (for instance a transitive maven dependency only), you can actually get away with commenting it out from the pom (temporarily), maven project reload, and then uncomment it. Somehow after that point IntelliJ "remembers" its old working dependencies. Adding a maven transitive exclude temporarily might also do it, if you're running into it from transitive chain of dependencies."
Another thing that might help is to use a "newer version" of maven than the bundled 3.0.5.
In order to set it up to use this as the default, close all your intellij windows, then open preferences -> build, execution and deployment -> build tools -> maven, and change the maven home directory, it should say "For default project" at the top when you adjust this, though you can adjust it for a particular project as well, as long as you "re import" after adjusting it.
Clear Caches
Deleting your intellij cache folders (windows: HOMEPATH/.{IntellijIdea,IdeaC}XXX linux ~/.IdeaIC15) and/or uninstalling and reinstalling IntelliJ itself. This can also be done by going to File [menu] -> Invalidate Caches / Restart.... Click invalidate and restart. This will reindex your whole project and solve many hard-to-trace issues with IntelliJ.
When importing the project, select pom.xml instead of the project directory. It should work.
Try to Re-Import the project from the Maven Projects panel in IntelliJ IDEA. It should download and configure all the dependencies defined in your pom.xml automatically.
If download doesn't work from IDEA for some reason, try mvn install from the command line and see if the dependencies can be fetched.
Of course all the required dependencies and any custom repositories must be defined directly in the pom.xml file.
For IntelliJ 2016-2.4 (and I believe other new-ish versions):
View > Tool Windows > Maven Projects
In the newly revealed toolbar, select Maven settings (icon of a toolset).
When this screen opens, expand the Maven menu and click 'Importing'
Here, click "Import Maven projects automatically." Also ensure that the 'JDK for Importer' option matches the JDK version you mean to use.
Click OK. Now go to the red dependency in your pom.xml, select the red lightbulb, and click 'Update Maven indices'.
What helped me:
Navigage:
Settings | Build, Execution, Deployment | Maven
Specify "Maven home directory" - the place you installed the maven
If certain maven modules are not compiling check if their pom.xml is on the "ignored files" list. In IntelliJ goto
preferences -> project settings -> maven -> ignored files
and check if the related pom.xml is ignored.
I had the same issue and tried all the answers mentioned here, none worked.
The simple solution is go to your project folder and delete all the .idea and .iml files and restart the IntelliJ ide. It works. No need to do anything with the settings.
Open IntelliJ Idea, Go to
File > Other Settings > Default Settings... > Maven (Preferences) > Importing or|
Preferences > Maven > Importing
Click on Enable Auto-import in the console.
When you create a new project you simply need to choose the option:
...
Import project from external model
Create IDEA project structure over existing external model (Eclipse, Maven...)
...
You'll find it pretty straight forward from there.
And in your case you can close your project and simply create a new one. Choose your project's directory, which will override it, making it a Maven project.
Importing Maven dependencies may not work if you import the same path several times. This may happen automatically after importing an existing maven project. I can't figure out why this happens, so I'm inclined to think it is a bug.
For example, if my project is
hibernate
src/main
src/test
the three paths may be imported as top nodes:
hibernate
src/main
src/test
If such is the case, the dependencies appear to be right, but they won't be used until you remove the superfluous paths (in this case, src/main and src/test). Once you do this, refresh and click Build > Rebuild Project. IDEA will pick up the dependencies.
A symptom of this problem is that IDEA warns you of a duplicated path when you manually check a library (second screenshot in the question).
There are several ways to re-read the dependencies in case you need it. If you go to the “Maven Projects” tab, there is a “Reimport All Maven Projects” icon at the top left of the tab. If you suspect IDEA became confused you can click on File > Invalidate Caches.
First check path Specified for User Settings file: in Settings -> Build,Execution,Development -> Build Tools -> Maven .
The field should have path of the settings.xml of your maven. Also the settings.xml should have correct path of remote repository.
Go into your project structure, under project Settings, Modules, select the dependencies table. For each dependency, change the scope from 'Test' to 'Compile'.
If in the lower right corner it says "2 processes running..." or similar, you may just need to wait for that to finish, since it may take time to download all the jars.
Reimport the project. If you install maven plugin you can use this.
Right click on the project -> Maven -> Reimport
I had a similar issue, in my case I am using a custom settings.xml which was not picked from IntelliJ.
Solution:
File > Settings > Build, Execution, Deployment > Maven: User settings file (chose here my custom settings.xml).
IntelliJ 2020.3.3
This one did it for me.
Build, Execution, Deployment > Build Tools.
Change "Reload project after changes in the build scripts":
from default "External Changes" to "Any Changes"
With this, it took a while for the project to rebuild but now I can see Maven dependencies in IntelliJ:
I ran into the problem that some subdependencies couldn't be resolved in IntelliJ 2016.3.X. This could be fixed by changing the Maven home directory in Settings > Build, Execution, Deployment > Build Tools > Maven from Bundled (Maven 3) to /usr/share/maven.
After that all subdependencies got resolved as in previous IntelliJ versions.
In my case, path for JAVA used by MAVEN was not set as JAVA_HOME as configured on the machine. Hence, it was not even trying to download the dependencies.
Steps I followed which solved this issue,
Checked for JAVA path , Settings >> Build >> Build Tools >> Importing >> JDK for importer. Pointed it to JAVA_HOME.
mvn clean install -U
Used above command to force the dependencies download.
Re imported Maven Projects
So I was also facing this problem in lots of my organisation's codebase. On addition to the answers suggested above, we can tweak around with the allocation pool memory of the jvm. This is because, the volume of the dependencies brought in large codebases may be overwhelming for the jvm for IDE to build the project completely. Hence tried increasing XMX value and it worked! Added -Xmx3072 to resolve the issue of "not building" my Java project in IntelliJ
Maven - Reimport did not work for me.
I have Spring project in STS(Eclipse) and my solution is to import project to IDEA like so:
1) File - New - Project from Existing Sources... - select directory - choose Eclipse.
2) Set Maven autoimport to true in settings.
3) Then right click in pom.xml and choose Add as Maven Project.
After this it has imported everything.
I had the similar issue with my macbook, just did a small change in pom.xml and it started downloading all dependencies:
Earlier dependencies were written as below for my windows machine:
<dependencies>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
I just removed the <dependencies> and </dependencies> tags and it started downloading all the dependencies:
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
I am not sure it will work for you or not.. but worked fine for me.
Thanks
Deleting the .idea folder from the project directory, and then re-importing the project as a Maven project is what worked for me.
Invalidate Caches worked for me:
File > Invalidate Caches
Checks:
Clear file system cache and Local History
Clear downloaded shared indexes
Then Invalidate and Restart
I solved this issue by updating my settings.xml file with correct mirror config, seems that intellij will try to download meta-data from repository every time the maven module imported.
Hijacking a bit to add what ended up working for me:
Go into the Maven Projects sidebar on the right edge of the IDE, and verify that your dependencies are listed correctly under your module there. Assuming they are, just ask IDEA to reimport then (the first button at the top, looks like two blue arrows forming a counter-clockwise circle).
Once I did that, and let IDEA reload the project for me, all my dependencies were magically understood.
For reference: this was with IDEA 13.1.2
I faced the same problem and tried everything suggested which did not solve the issue, I was using Intellij version 13.1.3
Finally after spending more than couple of hours trying to fix it, I decided to try an upgraded version and opened the project in version 14.1.4 which ultimately resolved the issue. I would think this as a probable bug in the previous version.
I hope this helps!
I was able to resolve it by removing unnecessary modules from Project Settings -> Modules list.
It turns out these additional modules were created automatically by IntelliJ IDEA when I created the IntelliJ project by importing from the project folder (instead of by opening pom.xml). Then, after declaring the project as Maven project, proper modules were created, and existing modules were conflicting with them. It is also possible to exclude those modules during project creation.
In my case, one of the modules was ignored for some reason.
To resolve that: Right click the problematic module and choose "Unignore Projects".
You might be working under a company's internal network.
If so, to download or add external Maven dependencies your settings.xml file under user/<username>/.m2 folder might need to be updated.
Contact your administrator to provide the right settings.xml file and then paste it into you .m2 folder.
I am getting a class not found exception for my Login Controller when I try to login to my application(It is a spring MVC Application). Before running the maven clean command the Application was running perfectly, I used maven clean and then again done a build using maven package command, suddenly it stopped working. I tried restarting the TomCat, re-deployed the application on TomCat, restarted the Eclipse IDE but nothing has worked so far.
Why this happens and what is the possible solution to this ??
Are you trying to run your project under Eclipse?
And does it generate source files?
If these are both true, you probably need to update the project config (select project or pom, right-click, Maven..Update..Project Configuration and Maven..Update..Project Dependencies).
The problem is that when Maven does a clean, it gets rid of the generated directories, which Eclipse observes and removes from your Build Path. But then when Maven rebuilds the directories, Eclipse doesn't notice it - you have to give it a hint.
Check your project for build errors and build path errors.
Make sure you've defined an M2_REPO classpath variable in Eclipse (Preferences - Java - Build Path - Classpath Variables).
If you're using the m2eclipe plugin, right-click your project and click on Maven - Update project configuration. That will configure an Eclipse build path for your project based on your pom dependencies.
If you're not using m2eclipse, execute mvn eclipse:clean eclipse:eclipse in your project folder. Then refresh your project in Eclipse.
What you haven't said is that you've checked and the missing class is in fact present.
A quick way to check is in the code editor SHIFT+CTRL+T and type the name of the missing class. Eclipse should not only show you the class if it exists, on highlighting the class, Eclipse should tell you which jar it is in.
Based on the info you have provided, I would say some dependecy in your POM has been removed by mistake or you need a newer version of some jar. If you find the class is not present, then you can figure out which jar you need by googling something like Maven 2 MyMissingClass jar that usually works for me.
Delete the .metadata folder in your eclipse workspace and then again open the workspace and import the required project.
This will solve your problem.
In .metadata folder it maintains the temporary copy of the project.
what worked in my case was simply removing the project from work space and importing it back again.
But I still don't know why it worked Vs why other things mentioned did not work (I tried updating dependencies in fact I removed all the dependencies from pom.xml and added everything again)