Class ArchitectureValidatorExtension

java.lang.Object
com.arc_e_tect.gradle.architecture.ArchitectureValidatorExtension

public class ArchitectureValidatorExtension extends Object
DSL extension for the Architecture Validator Gradle plugin.
 architectureValidator {
     basePackage = 'com.example.myapp'
     failOnViolation = true

     hexagonalArchitecture {
         inPorts = ['..application.port.inbound..']
     }
 }
 
  • Field Details

    • NAME

      public static final String NAME
      Extension DSL block name, i.e. the name used to register the extension with the project.
      See Also:
  • Constructor Details

    • ArchitectureValidatorExtension

      @Inject public ArchitectureValidatorExtension(org.gradle.api.model.ObjectFactory objects, org.gradle.api.file.ProjectLayout layout)
      Creates the extension, with every property already set to its default. Instantiated by Gradle's extension-creation infrastructure.
      Parameters:
      objects - Gradle's object factory
      layout - the project's layout, used to default getTestDirectory()
  • Method Details

    • getTestDirectory

      public org.gradle.api.file.DirectoryProperty getTestDirectory()
      Directory holding hand-written architecture tests, compiled into the testArchitecture suite alongside the generated ones.
      Returns:
      mutable directory property for the hand-written test directory
    • getBasePackage

      public org.gradle.api.provider.Property<String> getBasePackage()
      Root package ArchUnit rules are scoped to. Defaults to the empty string; the plugin further defaults an unset value to the project's own group at apply time.
      Returns:
      mutable property for the base package
    • getFailOnViolation

      public org.gradle.api.provider.Property<Boolean> getFailOnViolation()
      Whether the build fails when a rule is violated.
      Returns:
      mutable property for the fail-on-violation flag
    • getMaxAllowedViolations

      public org.gradle.api.provider.Property<Integer> getMaxAllowedViolations()
      Violation count tolerated before failing, when getFailOnViolation() is true.
      Returns:
      mutable property for the allowed violation count
    • getIgnoreFailures

      public org.gradle.api.provider.Property<Boolean> getIgnoreFailures()
      Whether violations are reported but never fail the build, overriding getFailOnViolation()/getMaxAllowedViolations().
      Returns:
      mutable property for the ignore-failures flag
    • getFailOnDuplicateRules

      public org.gradle.api.provider.Property<Boolean> getFailOnDuplicateRules()
      Whether the build fails when duplicate rules are discovered across the built-in rule pack, external rule packs, and hand-written tests.
      Returns:
      mutable property for the fail-on-duplicate-rules flag
    • getUseBuiltInHexagonalRulePack

      public org.gradle.api.provider.Property<Boolean> getUseBuiltInHexagonalRulePack()
      Whether the built-in hexagonal rule pack is generated, in addition to any external rule packs and hand-written tests.
      Returns:
      mutable property for the use-built-in-hexagonal-rule-pack flag
    • getJunitVersion

      public org.gradle.api.provider.Property<String> getJunitVersion()
      JUnit version used for the testArchitecture suite. The plugin maps JUnit Platform Suite dependencies to the matching line automatically.
      Returns:
      mutable property for the JUnit version
    • setJunitVersion

      public void setJunitVersion(String junitVersion)
      Convenience setter for getJunitVersion(), for a build script pulling the version from a version catalog (e.g. setJunitVersion(libs.versions.junit.get())).
      Parameters:
      junitVersion - the value to set getJunitVersion() to
    • getRulesDisabled

      public org.gradle.api.provider.ListProperty<String> getRulesDisabled()
      Rule names to skip, whether from the built-in hexagonal rule pack, an external rule pack, or a hand-written test.
      Returns:
      mutable list property of disabled rule names
    • getHexagonalArchitecture

      public HexagonalArchitectureExtension getHexagonalArchitecture()
      Package-pattern overrides for the built-in hexagonal rule pack.
      Returns:
      the nested hexagonal-architecture configuration block
    • hexagonalArchitecture

      public void hexagonalArchitecture(org.gradle.api.Action<? super HexagonalArchitectureExtension> action)
      Parameters:
      action - the configuration block