Rule Format:

Define rules one per line in the following formats:
  [command] [originPattern] [direction] [targetPattern]
  classpath [path]
  ignore class [classPattern]
  import interface [classPattern]
  import annotation [classPattern]
  import annotation [classPattern].[methodName]()
  group [packagePattern]
  group [packagePattern] as [group name]
  ignore group [packagePattern]
  class group [classPattern]
  class group [classPattern] as [group name]
  ignore class group [classPattern]
  location group [location1, location2...] 
  location group [location1, location2...] as [group name]
  ignore location group [location1, location2...]
  group RMI
  group RMI instances
  ignore RMI [classPattern]

Lines ending with '\' or ',' are continued on the next line:
  - Backslashes '\' are removed when lines are combined.
  - Commas ',' are preserved when lines are combined.

Comments:
  - Configuration lines starting with '#' or '//' are disregarded, allowing for comments and documentation within the configuration file.

Commands:
- Commands such as 'allow', 'forbid', 'ignore', and 'group' are integral to dependency management.
  - 'allow': Enables dependencies from origin to target patterns.
  - 'forbid': Restricts dependencies from origin to target patterns.
  - 'ignore': Omits specific dependencies from consideration.
  - 'group': Gathers Java classes into logical groupings (slices) based on specified package patterns.

Direction: ->, ->v, ->^
- Specifies the dependency flow:
  - '->' indicates a standard dependency flow.
  - '->v' denotes a dependency moving downwards in the package hierarchy.
  - '->^' signifies a dependency ascending in the package hierarchy.

Patterns:
- Employs AspectJ-like syntax for matching packages and classes.

Path:
- Identifies specific directories to augment the root paths within the 'locations' table.

ClassPattern:
- Designed to match class names, offering broader pattern matching for 'ignore class' and 'class group' commands, allowing for more granular control.

LocationPattern:
- Specifies locations like 'app.server' or 'app.server.jar' (not full paths).
- Multiple locations can be specified as a comma-separated list.

Locations Table:
- Outlines the root directories for project analysis, serving as a foundational element for configuration.

Default Classpath Behavior:
- The classpath is determined by the presence of 'pom.xml' or 'build.gradle', defaulting to the current directory in their absence. This flexibility accommodates various Java project structures.

Examples:

- 'allow *.service.* -> *.repository.*': Facilitates a clean architecture by allowing dependencies from 'service' packages to those in 'repository' packages.

- 'forbid *.*.controller*.. ->^ ..model..': Preserves separation of concerns by blocking controller layers from directly depending on model layers.

- 'ignore ..util.. ->v ..*Helper..': Simplifies analysis by excluding common utility functions from dependency considerations.

- 'classpath /target/classes': Aligns analysis with Java build conventions by setting '/target/classes' as the analysis root directory.

- 'ignore class com.example..*ServiceImpl..': Excludes specific service implementation classes, refining the scope of analysis.

- 'import interface java.io.Serializable', 'java.util.List': Ensures essential Java interfaces are recognized, enhancing dependency analysis accuracy.

- 'import annotation com.example..*Annotation', 'com.example..*Annotation.*.value()': Incorporates custom annotations, accommodating configurations reliant on annotations.

- 'group ..model.(*)..': Enhances focus on model segment analysis by organizing classes within 'model' packages into logical groups.

- 'group com.[example1|example2].model.. as Model': Simplifies analysis by grouping model classes from two potential packages under a unified 'Model' group.

- 'ignore group com.example.util..': Optimizes analysis performance by excluding 'com.example.util' package classes from dependency checks.

- 'class group ..(*).*Model': Offers a finer level of analysis control by organizing classes ending in 'Model' into logical groups.

- 'class group com.[example1|example2]..*Model as Model': Streamlines analysis by grouping classes ending in 'Model' from two potential packages under a single 'Model' group.

- 'ignore class group ..*Helper': Enhances performance by excluding classes ending in 'Helper' from dependency checks, avoiding unnecessary analysis reloads.

- 'location group app.server, app.client': Groups classes from the 'app.server' and 'app.client' locations.

- 'location group app.server, app.client as app': Groups classes from multiple locations under a unified 'app' group name.

- 'ignore location group legacy.core, legacy.utils': Excludes classes from specified locations from dependency checks.

Important Notes:

- 'Ignore Group' vs. 'Ignore Class': Opting for 'Ignore group' commands can significantly boost performance by reducing the need for frequent code base reloads for each ignored dependency.

- Grouping and Nested Classes: In grouping operations, all nested classes are considered part of their top-level class.
