Eclipse Helios Classpath Error While Working With Maven

Eclipse Helios Classpath Error While Working With Maven

I usually work on both terminal and Eclipse for my development.
Like compiling, creating of the war using maven and usage of Tomcat from terminal, and for coding Eclipse.
But, there are times I might need Eclipse like for debugging. And I want to run Tomcat from Eclipse itself.

I was using Helios, the project runs great from terminal. But, when I try it from Eclipse, it is not publishing it b/c it can’t get the jars.
I have updated the maven dependency and everything seems there. Like when I am developing, Eclipse knows about the imported files and I had no problem.

In short, eclipse can’t import the jars from maven or eclipse class path error was there while reading from maven.

Solution to how to import dependencies from maven to eclipse or how to import jars from maven to eclipse

1. Make sure you have the M2E plugin on your eclipse. To check that:
1.a Go to Eclipse–Help–Install new software
1.b On the work with text box insert Sonatype – and follow the wizard
When you are done restart your eclipse

2. Check if M2_REPO class path variable is there. To check that:
2.a Window–Preferences–Java–Build Path–Classpath Variable in this there should be M2_REPO variable being set. If it is not set, click the New button and add the repository of your maven path there.

3. Go to Window–preference–Maven–User Settings and check if there are not any warnings there. Mostly on User Settings. If there is one, update with the correct one. I am on Ubuntu and mine is on /etc/maven2/settings.xml

Go to your terminal and issue mvn eclipse:eclipse
then, right click on your project–maven and hit update dependencies.
Here is the fun part::
right click on your project, select build path and look at the library tab your dependencies would be listed there with M2_REPO path at the beginning
Then, Click on Deployment Assesment, it is right above Java Build Path, Select Java Build Path Entries
Hit next, select all the listed ones and hit finish

Refresh the project, clear the tomcat and all should be fine.

This should fix your eclipse class not found exception only because it not reading from maven correctly problem

See how you would solve these known algorithm problems

Finding missing numbers from billion sequential number list file

Find K Complementary numbers from array Java implementation

Check if there are three numbers a, b, c giving a total T from array A

Changing decimal number to its binary equivalent

binary tree problems with solution

Implementing tokenizer and adding tokens to the linked list

String Ordered Permutation Algorithm Problem

Java solution for checking anagram strings – tell if phrases are anagrams

Find longest palindrom from sequence of characters

Find the first occurence of number in the sorted array

  1. Lupe Rouhoff

    This is very nice blog, keep posting

  2. Testing maven project in eclipse step by step – Gullele's Corner

    […] Lupe Rouhoff on Eclipse Helios Classpath Error While Working With Maven […]

Leave a Reply

Your email address will not be published. Required fields are marked *