

enforcer:enforce goal: runs during a project build to execute rules specified in the configuration.Now lets see how to use this plugin using an example: 4. Enforce a specific version of Java, OS, and Maven.Reduce package size when packaging the application in a war or jar, by excluding banned dependencies.For example: If your project uses Logback and SFL4j, it is a best practice to ensure no other logging frameworks are included in the build. Some third party dependencies include transitive dependencies that may conflict with your project’s dependencies.

Dependencies that are undesirable by your organization can be banned and reported during the build so that other developers can not add them to the pom.Generally we can use it to guarantee the level of compliance in our project, it is especially handy when we have distributed teams: What can the Enforcer plugin do for the project? General instructions on how to use the Enforcer Plugin can be found on the usage page. The Enforcer plugin helps maintain project standards and provides goals to control certain environmental constraints such as Maven version, JDK version and OS family along with many more standard(built-in) rules and user created rules.
