Maven is a leading Java project management tool. A project’s build, documentation, reporting can be managed from a central piece of information. This concept is based on the project object model (POM).
Maven provides a uniform build system by building a project using POM concept and plugins which will be shared by all projects. Using the right plugin in your development environment can save a lot of unwanted efforts in day to day coding and other activities. We have found that some of these plugins help automate and simplify the everyday build and release related work.
The best Maven plugins we found to be really useful and time-saving for your project team are described below:
- White Source’s Licenses Management Maven Plug-in
License Management Plugins
Any software development project that uses Open Source (almost all of us), must identify and track the OSS components it uses, their licenses, requirements, etc. This can be quite a time consuming and sometimes complex for developers. White Source offers a free SaaS solution for that. The White Source’s Maven plugin continuously and automatically updates the White Source repository whenever a new open source component is added, to ensure that all the open source components are immediately reported, analyzed, and reviewed for approval -without any overhead. This allows companies to accelerate the development process and manage the open source license more efficiently, and with fewer errors.
White Source provides a simple to use, yet powerful solution for companies that need to manage their open source assets to ensure license compliance in order to avoid pitfalls such as lawsuits, penalties, and lost business. Developers and managers use White Source’s free cloud-based solution to track, audit and report on open source components throughout the software development life cycle. Unlike other solutions, White Source is a convenient cost-effective solution even for medium and small companies. With White Source’s easy-to-use, cloud-based platform companies can:
- Track the inventory of Open Source Software (OSS) modules used by development
- Automate the adoption and approval process
- Get continuous updates about legal and technical vulnerabilities
- Audit and report on OSS status and compliance
White Source Software is offered as a free, cloud-based service. White Source fully supports Java and plans to support additional languages in the future.
This plugin is mainly to manage licenses of a Maven project and its dependencies. It carries out updating file headers, check third-party licenses, download dependencies license, retrieving license information from dependencies, updating license.txt files, etc.
Project Release and Version Management Plugins
Different versions of artifacts in a project’s POM can be managed. Updating artifacts referenced in a Maven pom.xml file can be carried out. Rereading modifications of the pom.xml within one invocation of Maven is not possible in Maven 2.0, 2.1, 2.2 and 3.0.
Rules can be executed for projects in a multi-project build. Environmental constraints in a project such as Maven version, OS family and JDK version can be controlled through the Enforcer plugin goals with user-created and standard rules.
A distinctive build number for each project can be obtained by this plugin. A version for a project may remain the same, but many iterations will be done till the release. Each build will have a unique identifying build number.
Unit and Functional Testing Plugins
Unit tests of a particular application during the test stage of a build life cycle can be executed with this plugin. Reports are generated in plain text files (*. Txt) format and XML files (*. Xml).
As the name suggests, this plugin supports the use of Selenium with Maven. Automated web-application testing can be done by invoking the Selenium Remote control server through the Selenium Maven Plugin.
Using this plugin XML files can be parsed and rendered to DOXIA which enables the creation of a web interface version of the test results. The results are generated in HTML format.
Code Quality Plugins
Findbugs is a plugin for Java programs to tackle bugs. The bug patterns concept is used. Basically, the bug pattern is a code idiom. Most often it is an error. Java bytecode is inspected for bug patterns using static analysis.
As the name suggests, Cobertura features can be brought into the Maven 2 environment by this plugin. Unit testing efforts can be determined by this plugin which helps to understand the part of Java program lacking test coverage.
Relational Database Integration Plugins
SQL statements can be executed in the combination of a string, a list or set of files through SrcFiles, SqlCommand and fileset configurations respectively.
A database can have administrative access to the support of this plugin. Database statements can be also be executed. It has the ability to create and drop databases.
This an open source plugin licensed under Apache 2.0. It has a database-independent library. The database can be managed or tracked for any changes. The database is saved in human readable formats.
NoSQL DB Integration Plugins
A test instance of Apache Cassandra can be controlled within Apache Maven build with the support of Mojo’s Cassandra Plugin.
This plugin is mainly designed to create, execute database scripts. The updated scripts can also be executed. This plugin supports the attribute. This helps in storing host/usr/pass in maven settings.xml.
Mini HBase can be started and stopped by this Maven plugin. The testing code can be integrated to interact with the HBase cluster with the support of this plugin.
Light Weight Web Container Plugins
Manipulation of WAR projects within the servlet container of Apache Tomcat is made possible with the support of the Apache Tomcat Maven plugin. The WAR Apache Maven project can be implemented with the help of Apache Maven. However, the WAR file need not be deployed to an Apache TomCat every time.
The last two steps of a web application testing can be skipped with the help of this application. Its default function is to scan target/classes for changes in Java sources.
Application Server Plugin
JBoss application can be started or stopped with his plugin. Files can be deployed or undeployed to the JBoss application server.
Glassfish domains can be managed and the components deployed within the Maven build lifecycle. The integration loop can be rapidly developed from this plugin.
Other Utility Plugins
Eclipse IDE files like wtpmodules, settings folder and Classpath can be generated for use within a project with the support of this plugin. This plugin proves to be very powerful for project generated using maven archetypes. In case you are using Eclipse for your project development, you would also find this post useful: Best Free Eclipse Productivity Plugins for Developers
The project output can be aggregated along with its site documentation, modules, dependencies, and other files into a single archive with the support of the Assembly Plugin.
A way to pollute the POM is possible with this plugin. It is better to move all Ant tasks to a build.xml file and when required calls it from the POM with Ant task command.
Execution of system, Java programs in a separate process is possible with the help of this plugin. Java programs can also be executed in the same VM.
JSP pages can be pre-compiled and be included in the War file through this plugin. JSPC plugin has to be used in conjunction with maven-war-plugin.
There are both free and paid plugins available. Even though it is tempting to go for a free plugin, developers and teams should choose the right plugin based on the requirements. Furthermore, advanced features, full support, and updates for the plugin have to be checked while choosing the plugin.
I hope you found this post useful. What maven plug-ins do you use in your project? Feel free to share in the comments section.
- Updated on May 2019: Minor changes and updates to the introduction section. Images are updated to HTTPS.