Building Lifecycles and Plugins11:38 with Chris Ramacciotti
The commands that can be used with Maven to trigger compiling, building, and testing, among other tasks, are based on the idea of a build lifecycle. In this video, we explore how Maven is composed of lifecycles, phases, and goals.
See the Maven docs for a list of all phases included in each of the three built-in lifecycles:
Creating an Executable Java App with Maven
To create an executable JAR with Maven, you can use the shade plugin. Configuring this plugin involves altering pom.xml to include configuration of the plugin, which consists of indicating the main class that should be run when this JAR is executed. After adding this configuration to your POM, you can run the following in your terminal:
Then, you can run the app just like any other executable JAR:
java -jar your-archive-1.0.0-SNAPSHOT.jar
You need to sign up for Treehouse in order to download course files.Sign up