You might have used this command "mvn install" and then you have imported this project in to the eclipse.
to solve this
1)Right-click on your project, select Maven -> Remove Maven Nature.
2)Open you terminal, go to your project folder and do “mvn eclipse:clean”
3)Right click on your Project and select “Configure -> Convert into Maven Project”
This is the error to solve this use above steps.
public class RegexMatches {
public static void main( String args[] ){
// String to be scanned to find the pattern.
String line = "xxxx123@gmail.com";
String pattern = "@gmail.com";