visit
Working with Maven as a build management tool, you’ve grown accustomed to its core plugins and abilities. Now, it’s time to up your Maven game and discover the top plugins that add time-saving functionality to your favorite build tool.
If you’re a Java developer, you’re probably familiar with Maven, a leading build tool that has been serving Java developers since 2014. A robust and flexible solution, Maven lets developers set standards for the software build process by (among others) mapping the objects and dependencies in a project, deploying it as an application, and making it accessible to other projects.At its heart, Maven is a plugin execution framework, and can’t really do much without plugins to enable different categories of functionality. Before we discuss the useful Maven plugins we collected for you, let’s quickly review what it is Maven plugins do exactly and how they fit in the Maven build process.
Supported in Maven 3+ (but with an older version for those of you out there still using Maven 2+), Build Helper is a multitool plugin includes a number of goals to enable some very useful capabilities in Maven. Among them are goals like resolving the latest released version of this project, adding test source directories to the POM, attaching additional artifacts to be installed and deployed, and more.
2.The Jetty Maven plugin, developed by the Eclipse Foundation, lets you quickly deploy and test your Java webapp without having to create a WAR and deploy it to a web container. Once you’ve added jetty to the build section of your POM, you’ll be able to use your IDE to make changes to the project, and the Jetty Plugin will automatically reload the modified classes and web sources when you make changes to them. This allows for a more productive and speedy development cycle.
3.With this plugin by the Apache Foundation you can package the artifact in an uber-jar, including its dependencies and to shade the packages of some of the dependencies. Shading, in this context, refers to renaming the packages of some of the dependencies. This provides a clear advantage over your default JARing or WARing of artifacts as dependencies are taken into account.
4.Spring Boot is frequently used to deploy the backend of a webapp, and this handy plugin adds Spring Boot support to Maven, so you can package executable JARs or WARs and run an application “in-place”. The plugin includes five goals for running, starting and stopping your Spring Boot application, repackaging your JAR/WAR to be executable, and a build-info goal to generate build information to be used by the Actuator.
5.Need to execute SQL commands in your build process? The Maven SQL plugin got you covered. You can execute SQL statements in a combination of strings with sqlCommand, a list of files with srcFiles and a set of files with fileset.
The last three plugins on our list perform a very similar task: packaging your for easy execution on your operating system of choice.6. Windows:Launch4j is a wrapper for JAR files, turning them into executable files to ease deployment of Java desktop applications. Launch4j can run on Windows, Linux, Solaris, or OS X and is configured through an XML file. The Maven plugin for Launch4j lets you generate the executable as part of the Maven build process.
7. Apple:Testing the app on an Apple machine? No problem. This Maven plugin creates an Application Bundle for OS X that will contain all your project dependencies and the necessary metadata.
8. Linux:Last but not least is this plugin for creating .deb package files, copyright file and transitively copying runtime dependencies. Cross platform and independent (does not require additional external tools), all you need in order to add it to your Maven build process is Java 8 and Maven 3.3.
This is, of course, a very short list. If you’re reading this and wondering “why isn’t X on the list”? Odds are it’s simply because our resident Maven experts have yet to come across it, and would be grateful if you make the introduction and mention your favorite Maven plugin (or plugins) in the comments.