First install m2e eclipse plugin in your Eclipse IDE from.
Once m2e-eclipse plugin is installed.
In your eclipse just right click on Java Project and click Configure and you should see “Convert to Maven Project” option.
It will open create new POM dialog for you. Fill up necessary information and click Finish.
It will generate pom.xml file.