‘mainClass’ parameter specifies, which runnable class (with ‘main’ method) is to be started when running JAR file.‘classpathPrefix’ is a string, which will be added (as prefix) to each JAR dependency, so we can place our required libraries in separate folder (relative to main application JAR file).‘addClasspath’ parameter forces Maven to list all required libraries (JAR dependencies) in target JAR meta information, so it won’t be necessary to specify them in classpath when running our java application.This plugin will generate JAR MANIFEST file in order to make our application JAR easily runnable: For some configuration (old plugin versions) class path manifest parameters are being ignored and generated manifest doesn’t contain required information. Use following plugin configuration for JAR manifest: We will not use “Export to runnable JAR file” function of the Eclipse to create a JAR for our application. We will create this file using Maven ‘install’ goal instead.
So the application can be started directly from Eclipse in standard way: Use “Run as Java application” menu item for your main class. When you add new dependencies to the project (in pom.xml), Eclipse automatically downloads all required libraries (in JAR files) into Maven repository and sets appropriate links to the files in the project build path. Eclipse (Luna) with embedded Maven (m2e) plug-in (tested also on Mars release)Ĭreate new Maven project or open a Java project and add Maven Nature to it.