If I use command line command like "mvn compile" and "mvn install", I see a jar file under target directory.
But if I build the same project from Eclipse using m2e plugin, I don't see a jar file but only compiled class directories under target directory but they are empty. Any insight on this problem?
m2e won't build a jar unless you ask it to. (An exception to that is when you're using it with certain connectors to develop OSGi bundles, but I assume you aren't.)
To build a jar:
Right-click on the project folder in the 'Package Explorer' view;
Select "Run As"
Select "Maven install"