EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login
Home Software Development Software Development Tutorials Maven Tutorial Maven Plugins
Secondary Sidebar
Maven Tutorial
  • Maven Basic and advance
    • What is Maven
    • How to Install Maven
    • Maven Commands
    • Maven GroupId
    • Maven WAR Plugin
    • Maven Build Command
    • Maven Failsafe Plugin
    • Maven Profile
    • IntelliJ Maven
    • Maven Enforcer Plugin
    • Maven Javadoc Plugin
    • Maven WAR Plugin
    • Maven Build Command
    • Maven GroupId
    • Maven Force Update
    • Maven Encrypt Password
    • Maven Environment Variables
    • AssertJ Maven
    • Maven Run Single Test
    • Maven kafka-clients
    • Maven Quickstart Archetype
    • Maven Install Dependencies
    • Maven XMLBeans
    • Maven Local Repository
    • Maven Versions
    • Maven Jar Plugin
    • Maven Assembly Plugin
    • Maven exec plugin
    • Maven Central Repository
    • Maven Surefire
    • Maven Deploy
    • Maven Phases
    • Maven Archetype
    • Maven Skip Test
    • Maven Dependency Scope
    • Maven Shade Plugin
    • Maven Repository Spring
    • Maven Eclipse Plugin
    • Maven Exclude Dependency
    • Maven Life Cycle
    • Maven Repository
    • Maven POM File
    • Maven Plugins
    • What is Maven Plugins
    • Maven Interview Questions
    • Maven Flags
    • Maven Project
    • Maven Settings.XML

Maven Plugins

By Priya PedamkarPriya Pedamkar

Maven Plugins

Introduction to Maven Plugins

Maven Plugins is a project management tool. Maven is based on the Project Object Model i.e. POM. Primarily maven is used as a build automation tool for Java projects. Maven can be used with other programming languages e.g.: Ruby, scala, etc. Plugins are where the real action takes place in project execution.

Example: Compiling Code, Testing Code, and Creating JAR/WAR files, etc…

Types of Maven Plugins

It provides two types of plugins:

  1. Build Plugins: Build Plugins will be executed during the build process and they should be configured in the<build> <build/> tag of POM file.
  2. Reporting Plugins: Reporting Plugins will be executed during site generation and should be configured in <reporting><reporting/> tag of POM file.

Different Plugins Supported by Maven

Below are mentioned some of the different Plugins of Maven:

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

All in One Software Development Bundle(600+ Courses, 50+ projects)
Python TutorialC SharpJavaJavaScript
C Plus PlusSoftware TestingSQLKali Linux
Price
View Courses
600+ Online Courses | 50+ projects | 3000+ Hours | Verifiable Certificates | Lifetime Access
4.6 (86,388 ratings)
1. Core Plugins of Maven

Plugins refer to the default phases (i.e. clean, compile) may also have multiple objectives.

Plugin Name Description
Install Install the build artifact into the local repository.
Clean Clean up after a build.
Compiler Compiles java program.
Deploy Deploy the build artifact to the remote repository.
Resources Copy the resources to the output directory for including in the JAR
Verifier Useful for integration tests – verify the existence of certain conditions.
Surefire Run the JUnit unit tests in an isolated classloader.
Failsafe Run the JUnit integration tests in an isolated classloader.
2. Reporting Plugins

These Plugins generate reports and execute under generation lifecycle

Plugin Name

Description

Javadoc Generates Javadoc for the project.
Changelog Generate a list of recent changes from SCM (Software Configuration Management).
Changes Generate a Report from an issue Tracker.
checkstyle Generate a Check style report.
Dock Documentation checker plugin.
Doap Generate a Description of a Project file from a POM (Project Object Model).
Jdeps Run JDK’s JDeps tool on the project.
JXR Generate a source cross-reference.
PMD Generate a PMD report.
Project-Info-Reports Generates standard project reports.
Surefire-Report Generate a report based on the results of unit tests.
Link Checks Generate a Link check report of your project’s documentation.
3. Packaging Tools/Types

These relate to packaging types

Plugin Name Description
EAR Generate an EAR(Enterprise Application ARchive) from the current project
EJB Build an EJB (Enterprise Java Bean) from the current project.
JAR Build a JAR (Java ARchive) from the current project.
RAR Build a RAR (Roshal Archive) from the current project.
WAR Build a WAR (Web application ARchive) from the current project.
Source Build a source-JAR from the current project.
Jlink Build Java Run Time Image.
App-Client/acr Build a JavaEE application client from the current project.
4. Miscellaneous tools available through Maven by default

These are by default tools that are available through Maven

Plugin Name Description
Antrun Run a set of ant tasks from a phase of the build.
Assembly Build an assembly of sources or binaries.
Archetype Generate a skeleton project structure from an archetype.
Dependency Dependency manipulation and analysis.
Enforcer Environmental constraint or User Custom Rule Execution.
GPG Create signatures for the artifacts and POMS.
Help Get information about the working environment for the project.
Invoker Run a Set of Maven Projects and Verify the Output.
Patch Use the gnu patch tool and apply patch files to source code.
PDF Generate a PDF version of project documentation.
Plugin Create a Maven plugin descriptor for any mojos found in the source tree, to include in the JAR.
Release Release the current project, update the POM.
Remote-Resources Copy remote resources to the output directory for inclusion in the artifact.
SCM Execute SCM commands for the current project.
Stage Assists with release staging and promotion.
Toolchains Allows sharing configuration across plugins.
Scm-Publish Publish the Maven website to an scm location.

Configuring of Maven Plugins

The Configuration to Plug-ins are given below:

<project>
<groupId>com.org.educba.Example</groupId>
<artifactId>Jar_Name</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>Jar</packaging>
<name>Jar_Name</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.edu</groupId>
<artifactId>edu-maven-plugin</artifactId>
<version>1.2.4</version>
<executions>
<execution>
<goals>
<goal>bind</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build&gt
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
  • In most cases, Plugins should be added within the build/plugin section.
  • Adding plugins in the build/plugins section directly part of the default maven builds.
  • Adding plugins in build/plugin management/plugins are not part of default maven build, it’s a management.
  • Ordering of plugins sections within pom.xml is irrelevant in most of the cases.
  • Plugin elements within build/plugins sections may be important.
  • Maven 3.0.3 version plugin execution will be invoked in their order of declaration in pom.xml file, the order is required in this case it may affect the behavior of the build process.

Conclusion

Since maven is built-in plugins based architecture; it enables the users to make utilization of any application through standard inputs. Plugins are the central feature of Maven allows reuse of common build logic with multiple projects. Plugins behavior can be customized through unique plugin parameters exposed by a description of each plugin goal.

One of the most important features of maven is dependency management i.e. automatic updating and dependency closure. It also has the ability to handle multiple projects simultaneously. Dependencies and repositories are external java files required for project repositories i.e. JAR files, Maven automatically downloads the repositories from the central maven repository and puts in a local repository in case of absence.

Recommended Articles

This is a guide to Maven Plugins. Here we discuss the basic concept along with types of Plugins in Maven, Configuring Plug-ins as well as some different plugins that are supported by Maven. You can also go through our other suggested articles to learn more –

  1. Maven Life Cycle
  2. Maven Exclude Dependency
  3. Maven Eclipse Plugin
  4. Maven Surefire
Popular Course in this category
Maven Training (4 Courses, 6 Projects)
  4 Online Courses |  6 Hands-on Project |  26+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course
1 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Software Development Course

C# Programming, Conditional Constructs, Loops, Arrays, OOPS Concept

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more