Skip to content

Latest commit

 

History

History
82 lines (68 loc) · 2.67 KB

File metadata and controls

82 lines (68 loc) · 2.67 KB

Dependency Management Metrics Maven Plugin


Maven plugin that computes the Dependency Management Metrics for your multi-module Java projects.

Apache License, Version 2.0, January 2004 Maven Central

Dependency Management Metrics

For the theoretical part behind the metrics, please refer to the book itself, or read this Medium post.

Getting Started

This plugin calculates and outputs the metrics stated and explained above for each component within a design:

  • Stability metric
  • Abstraction metric
  • Distance from Main Sequence

The plugin also outputs the components present in the Zone of Pain and the Zone of Uselessness (if there are any) in the Zones of Exclusions section.

And finally the plugin can potentially break the build if any of the following principles are broken:

  • Stable Dependencies Principle
  • Stable Abstractions Principle

Add the following in your parent pom.xml file:

<build>
  <pluginManagement>
    <plugins>
      <plugin>
        <groupId>com.github.ignatij</groupId>
        <artifactId>dependency-management-metrics-maven-plugin</artifactId>
        <version>1.0.17</version>
      </plugin>
    </plugins>
  </pluginManagement>
  <plugins>
    <plugin>
      <groupId>com.github.ignatij</groupId>
      <artifactId>dependency-management-metrics-maven-plugin</artifactId>
      <inherited>false</inherited>
      <executions>
        <execution>
          <phase>verify</phase>
          <goals>
            <goal>check</goal>
          </goals>
        </execution>
      </executions>
    </plugin></plugins>
</build>

If you want to potentially fail the build if any of the principles are violated, add the following configuration tag:

<plugin>
    <groupId>com.github.ignatij</groupId>
    <artifactId>dependency-management-metrics-maven-plugin</artifactId>
    <version>1.0.17</version>
    <configuration>
        <failOnViolation>true</failOnViolation>
    </configuration>
    <inherited>false</inherited>
</plugin>

By default, the output file is generated in the root target folder. But you can customize that if needed:

    ...
    <configuration>
        <output.file>...</output.file>
    </configuration>
    ...

Feel free to report any issues or open a Pull Request for further improvements.