-
-
Notifications
You must be signed in to change notification settings - Fork 183
Exporting a jar file for Release
mvn clean package
A Maven run configuration for the "package" goal is necessary for taking the compiled code and packaging it in a runnable JAR. See steps with accompanying screenshots below which detail how to create one via the Project Explorer view. These steps should also be applicable to the Package Explorer view, and as with most things in Eclipse can be accomplished in multiple ways. It is left up to the reader to decided which works best for their workflow and happily accept more documentation on different ways to achieve the same result.
The screenshots documented below are from the Eclipse IDE for Java Developers packaged solution of Eclipse Luna SR2 (4.4.2). The "installed" IDE used for capturing the screenshots contains some extra plug-ins(PMD, GitHub, etc.) that are not included in the packaged solution, so your IDE might have different features. These plug-ins are not necessary to create Maven run configurations and whose inclusion in the screenshots can be safely ignored for our purposes.
The console view in Eclipse will display the output from running your Maven run configuration. This will detail where to find jars. The runnable jar is Makelangelo-{version.name}-jar-with-dependencies.jar NOT Makelangelo-{version.name}.jar, where {version.name} is something like v7.1.0
Note some output has been omitted for brevity.
...
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ Makelangelo ---
[INFO] Building jar: /foo/bar/Makelangelo/java/target/Makelangelo-v7.1.4-SNAPSHOT.jar
[INFO]
[INFO] --- maven-assembly-plugin:2.5.3:single (make-assembly) @ Makelangelo ---
[INFO] Building jar: /foo/bar/Makelangelo/java/target/Makelangelo-v7.1.4-SNAPSHOT-jar-with-dependencies.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.442 s
[INFO] Finished at: 3030-03-14T15:92:32-65:35
[INFO] Final Memory: 31M/270M
[INFO] ------------------------------------------------------------------------
It is recommend to read over this tutorial.